Welcome to RIO Client’s documentation!

RIO Client is a python interface for rapyuta.io. By using it, developers are able to write software that makes use of the services provided by rapyuta.io

rapyuta_io package

client module

class Client(auth_token, project)

Client class provides access to device, package, volume and deployment classes.

apply_parameters(device_list, tree_names=None, retry_limit=0)

Applies configuration parameters for the given device_list. If tree_names is given, only these trees are applied.

Parameters:
  • device_list (list[str]) – List of device IDs
  • tree_names (list[str]) – List of configuration tree names
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

List of dictionaries - each with device_id, bool success status, and an error message if the success status is False for that device_id

Return type:

list[dict]

Following example demonstrates how to use apply_parameters and handle errors.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> devices = client.get_all_devices()
>>> response = client.apply_parameters([device.deviceId for device in devices])
>>> for device in response:
...     if not device['success']:
...         print device['device_id'], device['error']
create_cloud_routed_network(name, ros_distro, shared)

Create a routed network

Parameters:
  • name (str) – Name of the routed network.
  • ros_distro (enum ROSDistro) – ros ditro of the runtime.
  • shared (bool) – Whether the network should be shared.
Returns:

Instance of RoutedNetwork class.

Following example demonstrates how to create a routed network.

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.package import ROSDistro
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> routed_network = client.create_cloud_routed_network('network_name', ROSDistro.KINETIC, True)
create_device_routed_network(name, ros_distro, shared, device, network_interface, restart_policy=<RestartPolicy.Always: 'always'>)

Create a routed network

Parameters:
  • name (str) – Name of the routed network.
  • ros_distro (enum ROSDistro) – ros ditro of the runtime.
  • shared (bool) – Whether the network should be shared.
  • device (Instance of Device class.) – device on which the routed network is deployed.
  • network_interface (str) – network interface to which routed network is binded.
  • restart_policy (enum RestartPolicy) – restart policy of routed network.
Returns:

Instance of RoutedNetwork class.

Following example demonstrates how to create a routed network.

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.package import ROSDistro
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> routed_network = client.create_device_routed_network('network_name',
>>>                                                      ROSDistro.KINETIC, True)
create_package(manifest, retry_limit=0)

Create package from manifest dict.

Parameters:
  • manifest (dict) – dict containing package details
  • retry_limit (int) – No of retry attempts to be carried out if any failures occurs during the API call.
Raises:

ConflictError: Package already exists.

Raises:

BadRequestError: Invalid package details.

Returns:

dict containing package details

Following example demonstrates how to use create_package.

>>> manifest = {'packageVersion': 'v1.0.0',
     'plans': [{'includePackages': [],
     'singleton': False,
     'name': 'default',
     'inboundROSInterfaces': {'services': [], 'topics': [], 'actions': []},
     'dependentDeployments': [],
     'components': [{'executables': [{'cmd': ['roslaunch listener listener.launch'],
         'name': 'listenerExec'}],
         'name': 'default',
         'parameters': [],
         'architecture': 'arm32v7',
         'requiredRuntime': 'device',
         'ros': {'services': [], 'topics': [], 'isROS': True, 'actions': []},
         'description': ''}],
         'exposedParameters': [],
         'metadata': {}}],
     'name': 'listener',
     'apiVersion': 'v1.0.0',
     'description': 'listener arm32v7 sdk test package'}
>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> package_details = client.create_package(manifest)
create_package_from_manifest(manifest_filepath, retry_limit=0)

Create package from a manifest file

Parameters:
  • manifest_filepath (string) – File path of the manifest
  • retry_limit (int) – No of retry attempts to be carried out if any failures occurs during the API call.
Raises:

ConflictError: Package already exists.

Raises:

BadRequestError: Invalid package details.

Returns:

dict containing package details

Copy the below json to listener.json file

Following example demonstrates how to use create_package_from_manifest.

{ "packageVersion": "v1.0.0", "plans": [{"includePackages": [], "singleton": false, "name": "default",
"inboundROSInterfaces": {"services": [], "topics": [], "actions": []}, "dependentDeployments": [],
"components": [{"executables": [{"cmd": ["roslaunch listener listener.launch"], "name": "listenerExec"}],
"name": "default", "parameters": [], "architecture": "arm32v7", "requiredRuntime": "device",
"ros": {"services": [], "topics": [], "isROS": true, "actions": []}, "description": ""}],
"exposedParameters": [], "metadata": {}}], "name": "listener", "apiVersion": "v1.0.0",
"description": "listener arm32v7 sdk test package" }
>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> package_details = client.create_package_from_manifest('listener.json')
create_static_route(name)

Create static route of a certain name

Parameters:name (str) – Name of the static route. It should follow ^[a-z][a-z0-9-]*$ and should not contain black listed keyword and be of length between 4 and 64
Returns:Instance of StaticRoute class.

Following example demonstrates how to create a static route.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> device = client.create_static_route('example-route')
download_configurations(rootdir, tree_names=None, delete_existing_trees=False)

Download all configurations to rootdir following the same directory structure. If rootdir does not exist, it is created.

Parameters:
  • rootdir (str) – Path to directory to store downloaded configurations
  • tree_names (list[str], optional) – List of specific configuration trees to download. If None, all trees are downloaded
  • delete_existing_trees (bool, optional) – For each tree to download, delete existing tree on the filesystem. Defaults to False

Following example demonstrates how to use download_configurations and handle errors.

>>> from rapyuta_io import Client
>>> from rapyuta_io.utils.error import APIError, InternalServerError
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> try:
...     client.download_configurations('path/to/destination_dir',
...                                    tree_names=['config_tree1', 'config_tree2'],
...                                    delete_existing_trees=True)
... except (APIError, InternalServerError) as e:
...     print 'failed API request', e.tree_path, e
... except (IOError, OSError) as e:
...     print 'failed file/directory creation', e
get_all_deployments(phases=None, retry_limit=0)

Get all deployments created by the user.

Parameters:
  • phases (list(DeploymentPhaseConstants)) – optional parameter to filter out the deployments based on current deployment
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

list of instances of class Deployment:

Raises:

APIError: If the API returns an error, a status code of anything other than 200/201 is returned.

Following example demonstrates how to get all the deployments.

>>> from rapyuta_io import Client, DeploymentPhaseConstants
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> deployments = client.get_all_deployments()
>>> deployments_list_filtered_by_phase = client.get_all_deployments(phases=
>>>    [DeploymentPhaseConstants.SUCCEEDED, DeploymentPhaseConstants.PROVISIONING])
get_all_devices(online_device=False, arch_list=None, retry_limit=0)

Get all the devices

Parameters:
  • online_device (bool) – The value True returns only those devices that are online, while the value False returns all devices
  • arch_list (list) – If set, another call is made to filter devices by architecture. Valid architectures can be found in DeviceArch class. Note: Only online devices can be filtered by architecture. Therefore if arch_list is set, non-online devices are not included in the result irrespective of the value of online_device.
  • retry_limit (int) – No of retry attempts to be carried out if any failures occurs during the API call.
Returns:

List of instances of Device class

Raises:

APIError: If the API returns an error, a status code of anything other than 200/201 is returned

Following example demonstrates how to get the device list

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients import DeviceArch
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> devices = client.get_all_devices()
>>> filtered_by_arch_devices = client.get_all_devices(arch_list=[
>>>     DeviceArch.ARM32V7, DeviceArch.ARM64V8, DeviceArch.AMD64])
get_all_packages(retry_limit=0)

Get list of all packages created by the user.

Parameters:retry_limit (int) – Number of retry attempts to be carried out if any failures occurs during the API call.
Returns:List of all packages. Each package is an instance of Package class.
Raises:APIError: If the API returns an error, a status code of anything other than 200/201 is returned.

Following example demonstrates how to get the packages

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> package_list = client.get_all_packages()
get_all_routed_networks()

List routed network

Returns:List instance of RoutedNetwork class.
get_all_static_routes()

List all static routes in a project.

Returns:Instances of StaticRoute class.

Following example demonstrates how to list all static routes

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> device = client.get_all_static_routes()
get_deployment(deployment_id, retry_limit=0)

Get a deployment

Parameters:
  • deployment_id (string) – Deployment ID
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

instance of class Deployment:

Raises:

APIError: If the API returns an error, a status code of anything other than 200/201 is returned.

Following example demonstrates how to get all the deployments.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> deployment = client.get_deployment('deployment_id')
get_device(device_id, retry_limit=0)

Get information of a device.

Parameters:
  • device_id (string) – Device Id
  • retry_limit (int) – No of retry attempts to be carried out if any failures occurs during the API call.
Returns:

Instances of Device class.

Raises:

ResourceNotFoundError: If the device with given device id is not present.

Raises:

APIError: If the API returns an error, a status code of anything other than 200/201 is returned.

Following example demonstrates how to select a device information.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> device = client.get_device(device_id="device_id")
get_package(package_id, retry_limit=0)

Get package class

Parameters:
  • package_id (string) – Package ID
  • retry_limit (int) – Number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

an instance of Package class.

Raises:

PackageNotFound: If the given package id is not found.

Raises:

ComponentNotFoundException: If the plan inside the package does not have components.

Raises:

APIError: If the API returns an error, a status code of anything other than 200/201 is returned.

Following example demonstrates how to get the packages

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> package = client.get_package('test_package_id')
get_persistent_volume(retry_limit=0)

Get persistent volume class

Parameters:retry_limit (int) – Number of retry attempts to be carried out if any failures occurs during the API call.
Returns:PersistentVolumes class.
Raises:APIError: If the API returns an error, a status code of anything other than 200/201 is returned.

Following example demonstrates how to get a persistent volume

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> persistent_volume = client.get_persistent_volume()
get_routed_network(network_guid)

Get routed network for the guid

Parameters:network_guid (str) – guid of routed network
Returns:Instance of RoutedNetwork class.
>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> routed_network = client.get_routed_network(network_guid)
get_static_route(route_guid)

Get static routes by its guid

Parameters:route_guid (str) – GUID string of a StaticRoute class.
Returns:Instance of StaticRoute class.

Following example demonstrates how to get a static route

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> static_route_guid = client.get_all_static_routes()[0]['guid']
>>> device = client.get_static_route(static_route_guid)
get_static_route_by_name(name)

Get static routes by its name

Parameters:name (str) – Name (urlPrefix) of the StaticRoute instance.
Returns:Instance of StaticRoute class or None if it doesn’t exist

Following example demonstrates how to get a static route by its name/url prefix

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> static_route = client.get_static_route_by_name('example-route')
get_volume_instance(instance_id, retry_limit=0)

Get a volume instance

Parameters:
  • instance_id (string) – Volume instance Id
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

instance of class VolumeInstance:

Raises:

APIError: If the API returns an error, a status code of anything other than 200/201 is returned.

Following example demonstrates how to get a volume instance.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> deployments = client.get_volume_instance('instance_id')
upload_configurations(rootdir, tree_names=None, delete_existing_trees=False)

Traverses rootdir and uploads configurations following the same directory structure.

Parameters:
  • rootdir (str) – Path to directory containing configurations
  • tree_names (list[str], optional) – List of specific configuration trees to upload. If None, all trees under rootdir are uploaded
  • delete_existing_trees (bool, optional) – For each tree to upload, delete existing tree at the server. Defaults to False

Following example demonstrates how to use upload_configurations and handle errors.

>>> from rapyuta_io import Client
>>> from rapyuta_io.utils.error import BadRequestError, InternalServerError
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> try:
...     client.upload_configurations('path/to/configs/source_dir',
...                                  tree_names=['config_tree1', 'config_tree2'],
...                                  delete_existing_trees=True)
... except (BadRequestError, InternalServerError) as e:
...     print 'failed API request', e.tree_path, e
... except (IOError, OSError) as e:
...     print 'failed file/directory read', e

catalog module

class Package(*args, **kwargs)

Package class represents a service package. It contains method to provision an instance of the package on cloud or on device. Additionally, it provides other utility method.

Variables:
  • packageId – Id of the package.
  • packageName – Package name.
  • packageVersion – Version of the package.
  • description – Description of the package.
  • plans – List of plans associated with the package.
  • isPublic – Boolean denoting whether the package is public or not.
  • status – Status of the package.
  • tags – Tags associated with the package.
  • buildGeneration – Build generation.
deployments(phases=None, retry_limit=0)

Get all the deployments of the package

Parameters:
  • phases (list(DeploymentPhaseConstants)) – optional parameter to filter out the deployments based on current deployment
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

list of instance of class Deployment:

Raises:

APIError: If deployment info api return an error, the status code is anything other than 200/201

Following example demonstrates how to the deployment list

>>> from rapyuta_io import Client, DeploymentPhaseConstants
>>> client = Client(auth_token='auth_token', project='project')
>>> package = client.get_package('test_package_id')
>>> package.deployments()
>>> deployments_list_filtered_by_phase = package.deployments(phases=
>>>   [DeploymentPhaseConstants.SUCCEEDED, DeploymentPhaseConstants.PROVISIONING])
get_provision_configuration(plan_id=None)

Get provision configuration payload for package provision request.

Parameters:plan_id (string) – Plan Id
Returns:return instance of class ProvisionConfiguration:
provision(deployment_name, provision_configuration, retry_limit=0)

Provision the package (represented by the package class). Package can be deployed on device or cloud. If the required runtime of the package is device, then specify the device in the package config.

Parameters:
  • deployment_name (string) – Deployment Name
  • provision_configuration (ProvisionConfiguration:) – Provision payload
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

Instance of class Deployment:

Raises:

APIError: If the API returns an error, a status code of anything other than 200/201 is returned.

Raises:

OperationNotAllowedError: If the provision request is invalid

class ProvisionConfiguration(package_id, plan, *args, **kwargs)

ProvisionConfiguration class that contains the component configuration for a package deployment.

add_dependent_deployment(deployment)

Add dependent deployments

Parameters:deployment (class Deployment:) – Deployment
Returns:Updated instance of class ProvisionConfiguration:
add_device(component_name, device, ignore_device_config=[])

Map component configuration with a device. ie, Setting the component is going to deploy on the given device.

Parameters:
  • component_name (string) – Component name
  • device (instance of class Device:) – Device
  • ignore_device_config (list) – optional parameter to ignore the device config variables
Returns:

Updated instance of class ProvisionConfiguration:

Raises:

OperationNotAllowedError: If the device is not online

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project')
>>> package = client.get_package('test_package_id')
>>> package_provision_config = package.get_provision_configuration('test_plan_id')
>>> # ros_workspace will be ignored while adding device to provision configuration
>>> package_provision_config.add_device('test_component_name', 'test_device_id',
>>>                                     ignore_device_config=['ros_workspace'])
>>> package.provision(deployment_name, package_provision_config)
add_label(key, value)

Add labels

Parameters:
  • key (string) – Key
  • value (string) – Value
Returns:

Updated instance of class ProvisionConfiguration:

add_parameter(component_name, key, value)

Add component parameters

Parameters:
  • component_name (string) – Component name
  • key (string) – Parameter key
  • value (string) – Parameter value
Returns:

Updated instance of class ProvisionConfiguration:

add_restart_policy(component_name, restart_policy)

Add RestartPolicy for the component

Parameters:
  • component_name (string) – Component name
  • restart_policy (enum RestartPolicy) – one of RestartPolicy enums
Returns:

Updated instance of class ProvisionConfiguration

Raises:

InvalidParameterException: If restart policy is not invalid

add_routed_networks(routed_networks)
Parameters:routed_networks (list) – list of routed network RoutedNetwork
Returns:Updated instance of class ProvisionConfiguration
>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.package import ROSDistro
>>> client = Client(auth_token='auth_token', project='project')
>>> routed_network = client.create_cloud_routed_network('network_name', ROSDistro.KINETIC, True)
>>> routed_network.poll_routed_network_till_ready()
>>> package = client.get_package('test_package_id')
>>> package_provision_config = package.get_provision_configuration('test_plan_id')
>>> package_provision_config.add_routed_networks([routed_network])
>>> package.provision(deployment_name, package_provision_config)
add_static_route(component_name, endpoint_name, static_route)

Add static route to a component in a package

Parameters:
  • component_name – Name of the component to add static route to
  • endpoint_name – Name of the endpoint (Should be exposed externally)
  • static_route – class StaticRoute:
Returns:

Updated instance of class ProvisionConfiguration:

bind_to_local_broker(local_broker_instance, network_interface=None)

Adds the local communication broker as a dependent deployment

Parameters:
  • local_broker_instance (Deployment) – Provisioned local communication broker instance
  • network_interface (string) – interface to which current deployment to bind
Returns:

Updated instance of class ProvisionConfiguration:

mount_volume(component_name, volume_instance, mount_path)

To mount a volume instance

Parameters:
  • component_name (string) – Component name
  • volume_instance (instance of class VolumeInstance:) – VolumeInstance class
  • mount_path (string) – Mount path
Returns:

Updated instance of class ProvisionConfiguration:

set_component_alias(component_name, alias='')

Set an alias for the selected component. This is used in scoping and targeting. It defaults to the component name.

Note: In typical scenarios in the case of a cloud deplyment cloud this is set to the component name (or some derivation thereof) and on the device it is set to the device name. But it is left to the user. All set aliases in a deployment and its dependent deployments are required to be unique

Parameters:
  • component_name (string) – Component name
  • alias (string) – alias for component
Returns:

Updated instance of class ProvisionConfiguration:

class ROSDistro

Enumeration variables for the Supported ROS Distros. ROS Distro may be ‘kinetic’, or ‘melodic’

ROSDistro.KINETIC

ROSDistro.MELODIC

class RestartPolicy

Enumeration variables for the Restart Policy. Restart Policy may be ‘Always’, ‘Never’ or ‘OnFailure’

RestartPolicy.Always

RestartPolicy.Never

RestartPolicy.OnFailure

class Runtime

Enumeration variables for the Supported Runtimes. Runtime may be ‘cloud’, or ‘device’

Runtime.CLOUD

Runtime.DEVICE

class Deployment(*args, **kwargs)

Deployment class represents a running deployment. Member variables of the class represent the properties of the deployment.

Variables:
  • deploymentId – Deployment Id.
  • name – Deployment name.
  • planId – Plan Id.
  • packageId – Package Id.
  • labels – Labels associated with the deployment.
  • parameters – Deployment parameters.
  • componentInstanceIds – List of component instance ids.
  • dependentDeployments – List of dependent deployments.
  • inUse – Deployment is in use or not
deprovision(retry_limit=0)

Deprovision the deployment instance represented by the corresponding Deployment: class.

Parameters:retry_limit
Returns:True if de-provision is successful, False otherwise
Raises:ParameterMissingException: If the planId or deploymentId is missing in the request.
Raises:APIError: If the deprovision-api returns an error, the status code is anything other than 200/201

Following example demonstrates how to deprovision a deployment

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> deployment = client.get_deployment('test_deployment_id')
>>> deployment.deprovision()
get_service_binding(binding_id=None, retry_limit=0)

Get the service bindings of the deployment. Service Bindings contain the credentials that can be used to communicate with the deployment.

Parameters:
  • binding_id (string) – Optional parameter Binding Id
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

Service binding dictionary containing credentials.

Raises:

ServiceBindingError: If the request failed to get the service binding.

Raises:

APIError: If service binding api return an error, the status code is anything other than 200/201

Following example demonstrates how to get the service binding

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> deployment = client.get_deployment('test_deployment_id')
>>> deployment.get_service_binding()
get_status(retry_limit=0)

Get the deployment status

Parameters:retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:instance of class DeploymentStatus:
Raises:APIError: If the get deployment status api returns an error, the status code is anything other than 200/201

Following example demonstrates how to get a deployment status

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> deployment = client.get_deployment('test_deployment_id')
>>> deployment.get_status()
poll_deployment_till_ready(retry_count=15, sleep_interval=6)

Wait for the deployment to be ready

Parameters:
  • retry_count – Optional parameter to specify the retries. Default value is 15
  • sleep_interval – Optional parameter to specify the interval between retries. Default value is 6 Sec.
Returns:

instance of class DeploymentStatus:

Raises:

APIError: If service binding api return an error, the status code is anything other than 200/201

Raises:

DeploymentNotRunningException: If the deployment’s state might not progress due to errors.

Raises:

RetriesExhausted: If number of polling retries exhausted before the deployment could succeed or fail.

Following example demonstrates use of poll_deployment_till_ready, and in case of deployment failure uses error codes to check whether it was due to device being offline. Read more on error codes: https://userdocs.rapyuta.io/developer-guide/manage-software-cycle/deployments/#error-codes

>>> from rapyuta_io import Client
>>> from rapyuta_io.utils.error import (DeploymentNotRunningException,
...     RetriesExhausted)
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> deployment = client.get_deployment('test_deployment_id')
>>> try:
...     dep_status = deployment.poll_deployment_till_ready()
...     print dep_status
... except RetriesExhausted as e:
...     print e, 'Retry again?'
... except DeploymentNotRunningException as e:
...     print e
...     if 'DEP_E151' in e.deployment_status.errors:
...         print 'Device is either offline or not reachable'
class DeploymentPhaseConstants

Enumeration variables for the deployment phase

Deployment phase can be any of the following types

DeploymentPhaseConstants.INPROGRESS

DeploymentPhaseConstants.PROVISIONING

DeploymentPhaseConstants.SUCCEEDED

DeploymentPhaseConstants.FAILED_TO_START

DeploymentPhaseConstants.PARTIALLY_DEPROVISIONED

DeploymentPhaseConstants.DEPLOYMENT_STOPPED

class DeploymentStatus(*args, **kwargs)

DeploymentStatus class

Variables:
  • deploymentId – Deployment Id.
  • name – Deployment name.
  • packageId – Package Id.
  • status – Deployment status
  • phase – Deployment phase
  • errors – Deployment errors
  • componentInfo – List containing the deployment components and their status.
  • dependentDeploymentStatus – Dependent deployment status.
  • packageDependencyStatus – Package dependency status.
class DeploymentStatusConstants

Enumeration variables for the deployment status

Deployment status can be any of the following types

DeploymentStatusConstants.RUNNING

DeploymentStatusConstants.PENDING

DeploymentStatusConstants.ERROR

DeploymentStatusConstants.UNKNOWN

DeploymentStatusConstants.STOPPED

class DiskType

Enumeration variables for the Volume Type. The type may be ‘Default’ or ‘SSD’

DiskType.DEFAULT

DiskType.SSD

class PersistentVolumes(*args, **kwargs)

PersistentVolumes class represents a a persistent volume package. It contains methods to create persistent volume instance and listing all the instances.

Variables:
  • packageId – Id of the package.
  • packageName – Package name.
  • packageVersion – Version of the package.
  • description – Description of the package.
  • plans – List of plans associated with the package. binding of the package.
  • isPublic – Boolean denoting whether the package is public or not.
  • status – Status of the package.
  • tags – Tags associated with the package.
  • buildGeneration – Build generation.
create_volume_instance(name, capacity, disk_type=<DiskType.DEFAULT: 'ssd'>, retry_limit=0)

Create a volume instance

Parameters:
  • name (str) – name of the volume instance
  • capacity (int) – capacity of volume instance in GB. Permissible values: 32, 64, 128, 256, 512
  • disk_type (enum DiskType) – Type of disk to be deployed. Allowed values are - default or ssd
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

volume instance

Raises:

InvalidParameterException: If the disk type and volume capacity parameters are missing or invalid.

Raises:

APIError: If the api return an error, the status code is anything other than 200/201

Following example demonstrates how to create a volume instance

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token')
>>> pv = client.get_persistent_volume()
>>> pv.create_volume_instance(name='myVolume', capacity=32, disk_type='default')
get_all_volume_instances(phases=None, retry_limit=0)

Get all persistent volume instances

Parameters:
  • phases (list(DeploymentPhaseConstants)) – optional parameter to filter out the deployments based on current deployment
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

List of volume instances

Raises:

APIError: If the api return an error, the status code is anything other than 200/201

Following example demonstrates how to create a volume instance

>>> from rapyuta_io import Client, DeploymentPhaseConstants
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> pv = client.get_persistent_volume()
>>> pv.get_all_volume_instances()
>>> volume_deployments_list_filtered_by_phase = pv.get_all_volume_instances(phases=
>>>   [DeploymentPhaseConstants.SUCCEEDED, DeploymentPhaseConstants.PROVISIONING])
get_volume_instance(volume_instance_id, retry_limit=0)

Get a volume instance

Parameters:
  • volume_instance_id (string) – Volume instance Id
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

return instance of class VolumeInstance:

Raises:

APIError: If the api return an error, the status code is anything other than 200/201

Following example demonstrates how to a volume instance

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> persistent_volume = client.get_persistent_volume()
>>> volume_instance = persistent_volume.get_volume_instance('instance_id')
class VolumeInstance(*args, **kwargs)
destroy_volume_instance(retry_limit=0)

Destroy a volume instance

Parameters:retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:True if volume is destroyed is successfully, False otherwise
Raises:APIError: If the api return an error, the status code is anything other than 200/201
get_status(retry_limit=0)

Get the status of volume instance

Parameters:retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:instance of class DeploymentStatus:
Raises:APIError: If the api return an error, the status code is anything other than 200/201

Following example demonstrates how to get a deployment status

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> persistent_volume = client.get_persistent_volume()
>>> volume_instance = persistent_volume.get_volume_instance('instance_id')
>>> volume_instance.get_status()
poll_deployment_till_ready(retry_count=15, sleep_interval=6)

Wait for the deployment to be ready

Parameters:
  • retry_count – Optional parameter to specify the retries. Default value is 15
  • sleep_interval – Optional parameter to specify the interval between retries. Default value is 6 Sec.
Returns:

instance of class VolumeInstanceStatus:

Raises:

APIError: If service binding api return an error, the status code is anything other than 200/201

Raises:

DeploymentNotRunningException: If the deployment’s state might not progress due to errors

Raises:

RetriesExhausted: If number of polling retries exhausted before the deployment could succeed or fail.

Following example demonstrates use of poll_deployment_till_ready.

>>> from rapyuta_io import Client
>>> from rapyuta_io.utils.error import (DeploymentNotRunningException,
...     RetriesExhausted)
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> persistent_volume = client.get_persistent_volume()
>>> volume_instance = persistent_volume.get_volume_instance('instance_id')
>>> try:
...     vol_status = volume_instance.poll_deployment_till_ready()
...     print vol_status
... except RetriesExhausted as e:
...     print e, 'Retry again?'
... except DeploymentNotRunningException as e:
...     print e, e.deployment_status
class VolumeInstanceStatus(*args, **kwargs)

VolumeInstanceStatus class

Variables:
  • deploymentId – Deployment Id.
  • name – Volume instance name.
  • packageId – Package Id.
  • status – Deployment status
  • phase – Deployment phase
  • errors – Deployment errors
  • componentInfo – List containing the deployment components and their status.
  • dependentDeploymentStatus – Dependent deployment status.
  • packageDependencyStatus – Package dependency status.
class RoutedNetwork(*args, **kwargs)

RoutedNetwork represents Routed Network

Variables:
  • name – Name of RoutedNetwork.
  • runtime – Runtime of RoutedNetwork enum Runtime.
  • rosDistro – ROSDistro of RoutedNetwork enum ROSDistro.
  • shared – Whether the network can be shared (bool).
  • phase – Deployment phase DeploymentPhaseConstants
  • status – Deployment status DeploymentStatus
  • error_code – Deployment errors

device module

class Device(*args, **kwargs)

Device class represents a device. Member variables of the class represent the properties of device.

Variables:
  • uuid – Id of the device.
  • name – Name of the device.
  • status – Status of the device. Status can be ONLINE/OFFLINE/REGISTERED.
  • username – User log in to device
  • saltversion – Salt version of the device.
  • registration_time – Device registration time.
  • description – Description of the device.
  • labels – List of labels associated with the device.
  • config_variables – Configuration variables of the device.
  • deployments – List of deployments on device
  • error_code – Error code when device goes to FAILED state. Will be of the form: ‘DEV_E*’.
  • error_message – Error message when device goes to FAILED state.
add_config_variable(key, value)

Add new configuration variable to the device.

Parameters:
  • key (string) – Configuration variable key
  • value (string) – Configuration value
Returns:

instance of DeviceConfig class.

Raises:

ParameterMissingException: If any parameters are missing in the request.

Raises:

DeviceNotFoundException: If the device is not found.

Raises:

APIError: If the API returns an error, the status code is anything other than 200/201

Following example demonstrates how to add a device configuration variable.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.add_config_variable('config_key', 'config_value')
add_label(key, value, retry_limit=0)

Add label to the device

Parameters:
  • key (string) – label key
  • key – label value
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occur during the API call.
Returns:

instances of the class Label.

Raises:

DeviceNotFoundException: If the device is not found.

Raises:

ParameterMissingException: If any parameters are missing in the request.

Raises:

APIError: If the API call returns an error, the status code is anything other than 200/201

Following example demonstrates how to add device labels

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.model import Label
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.add_label('key', 'value')
cancel_log_file_upload(request_uuid, retry_limit=0)

Cancels the ongoing upload operation.

Parameters:
  • request_uuid (str) – UUID of the upload request
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failure occurs during API invocation
Returns:

status of the cancel operation, True indicates operation succeeded False otherwise

Raises:

LogsUUIDNotFoundException: If the request_uuid is not found

Raises:

BadRequestError: if the upload operation is completed

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrate how to cancel the ongoing upload operation
>>> from rapyuta_io import Client
>>> client = Client(auth_token='token', project='project_id')
>>> device = client.get_device('device_id')
>>> cancel_status = device.cancel_log_file_upload('request_uuid')
delete(retry_limit=0)

Delete the device

Parameters:retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occur during the API call.
Returns:True if the device is deleted successfully. Otherwise returns False.
Raises:DeviceNotFoundException: If the device is not found.
Raises:DeploymentRunningException: When any deployment is running on the device.
Raises:APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrates how to delete a device

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.model import Label
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.delete()
delete_config_variable(config_id, retry_limit=0)

Delete configuration variable for the device.

Parameters:
  • config_id (int) – Configuration variable id
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occur during the API call.
Returns:

True if the configuration variable is deleted, otherwise returns false

Raises:

ParameterMissingException: If any parameters are missing in the request.

Raises:

ConfigNotFoundException: If the configuration is not found.

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrates how to delete a device configuration variable.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.delete_config(config_id='config_id')
delete_label(label_id, retry_limit=0)

Delete a device label.

Parameters:
  • label_id (int) – Label Id to delete
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

Boolean value to indicate whether the label is deleted or not

Raises:

LabelNotFoundException: If the label is not found.

Raises:

APIError: If the API call returns an error, the status code is anything other than 200/201.

Following example demonstrates how to delete a device label

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.delete_label('label_id')
delete_uploaded_log_file(request_uuid, retry_limit=0)
Deletes the logs file from cloud storage
Parameters:
  • request_uuid (str) – UUID of the upload request
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failure occurs during API invocation
Returns:

status of the operation, True indicates operation succeeded false otherwise

Raises:

LogsUUIDNotFoundException: If the request_uuid is not found

Raises:

BadRequestError: if the upload is in progress

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrate how to delete the uploaded log file from cloud storage
>>> from rapyuta_io import Client
>>> client = Client(auth_token='token', project='project_id')
>>> device = client.get_device('device_id')
>>> device.delete_uploaded_log_file('request_uuid')
download_log_file(request_uuid, retry_limit=0)
Returns downloadable log file URL, using this URL user can download log file using Wget or curl
Parameters:
  • request_uuid (str) – UUID of the upload request
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failure occurs during API invocation
Returns:

url of the uploaded log file in the cloud

Raises:

LogsUUIDNotFoundException: If the request_uuid is not found

Raises:

BadRequestError: if the upload operation is in progress

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrate how to get the downloadable url
>>> from rapyuta_io import Client
>>> client = Client(auth_token='token', project='project_id')
>>> device = client.get_device('device_id')
>>> download_url = device.download_log_file('request_uuid')
execute_command(command, retry_limit=0)

Execute command on device

Parameters:
  • command (Command) – Command to execute
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

Execution result

Raises:

ParameterMissingException: If any parameters are missing in the request.

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrates how to execute a command.

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.model import Command
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id', )
>>> command = Command(cmd='uname -a', shell='/bin/bash', bg=False)
>>> device.execute_command(command)
get_config_variables()

Get configuration variables associated with the device

Returns:list of instances of DeviceConfig class.
Raises:APIError: If the api returns an error, the status code is anything other than 200/201
get_deployments()

Get partial details of deployments associated with the device. Also, update deployments field with these.

Note: Deployment details are partial. For full Deployment objects, use get_deployment() as shown in the example below.

Returns:List of deployment details.

Following example demonstrates how to get device deployments

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> partial_deployments = device.get_deployments()
>>> # to get full deployments objects:
>>> for dep in partial_deployments:
>>>     full_deployment = client.get_deployment(dep['io_deployment_id'])
get_labels()

Get all labels associated with the device

Returns:list of instances of the class Label.

Following example demonstrates how to get device labels

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.get_labels()
get_log_upload_status(request_uuid, retry_limit=0)

Gets the current upload status

Parameters:
  • request_uuid (str) – UUID of the upload request
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failure occurs during API invocation
Returns:

returns instance of the class LogUploadStatus

Raises:

LogsUUIDNotFoundException: If the request_uuid is not found

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrate how to get the status of ongoing upload operation
>>> from rapyuta_io import Client
>>> client = Client(auth_token='token', project='project_id')
>>> device = client.get_device('device_id')
>>> upload_status = device.get_log_upload_status('request_uuid')
get_runtime()

Get the device runtime :return: value of device configuration variable: runtime

Following example demonstrates how to get device runtime.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.get_runtime()
list_uploaded_files_for_device(retry_limit=0)
Returns list of the uploaded files with status and other properties
Parameters:retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failure occurs during API invocation
Returns:returns the list of instance of the class LogUploads
Raises:BadRequestError: if the upload operation is in progress
Raises:APIError: If the api returns an error, the status code is anything other than 200/201
Following example demonstrate how to get the downloadable url
>>> from rapyuta_io import Client
>>> client = Client(auth_token='token', project='project_id')
>>> device = client.get_device('device_id')
>>> status_list = device.list_uploaded_files_for_device()
metrics(retry_limit=0)

Gets the metric status from the device

Parameters:retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failure occurs during API invocation
Returns:list of instances of class Metric:
Raises:DeviceNotFoundException: If the device is not found
Raises:APIError: If the api returns an error, the status code is anything other than 200/201
Following example demonstrate how to get the status of metric from the device
>>> from rapyuta_io import Client
>>> client = Client(auth_token='token', project='project_id')
>>> device = client.get_device('device_id')
>>> device.metrics()
refresh(retry_limit=0)

Refresh the device details

Parameters:retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Raises:DeviceNotFountException: If the device is not found.
Raises:APIError: If the api returns an error, the status code is anything other than 200/201
subscribe_metric(metric, qos=<QoS.LOW: 0>, retry_limit=0)

Subscribe to given metric on the device

Parameters:
  • metric (SystemMetric) – metric to be subscribed
  • qos (QoS) – QoS value of associated with metric
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failure occurs during API invocation
Returns:

returns the boolean indicating status of the operation

Raises:

DeviceNotFoundException: If the device is not found

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrate how to subscribe to a metric
>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.device import SystemMetric, QoS
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> device = client.get_device('device_id')
>>> device.subscribe_metric(SystemMetric.CPU, QoS.LOW)
subscribe_topic(topic, qos=0, kind=<TopicKind.METRIC: 'METRIC'>, whitelist_tag=[], whitelist_field=[], fail_on_topic_inexistence=True, retry_limit=0)

To subscribe a topic

Parameters:
  • topic (string) – topic name to subscribe
  • qos (integer) – QoS value for topic subscription
  • kind (enum TopicKind) – subscribe the topic as a metric or log
  • whitelist_tag (list) – Optional parameter to specify the tags that needs to be whitelisted in metrics
  • whitelist_field (list) – Optional parameter to specify the fields that needs to be whitelisted in metrics
  • fail_on_topic_inexistence (bool) – Optional parameter to fail with error if topic doesnt exists on device
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

list containing subscription status.

Raises:

DeviceNotFountException: If the device is not found.

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrates how to subscribe a topic

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.device import QoS
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.subscribe_topic('test_topic', qos=QoS.MEDIUM.value, kind=TopicKind.METRIC)
topic_status(retry_limit=0)

Get the subscribed and unsubscribed topics status

Parameters:retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:Instance of class TopicsStatus.
Raises: DeviceNotFoundException: If the device is not found.
Raises: UnknownTopicStatusException: If the topic status is empty.
Raises:APIError: If the API call returns an error, the status code is anything other than 200/201.

Following example demonstrates how to get the topic status

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.topic_status()
topics(retry_limit=0)

Fetching the available topics on the device

Parameters:retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:List of topics in the device (list(string)
Raises: DeviceNotFountException: If the device is not found.
Raises:APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrates how to get the topic list

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.topics()
unsubscribe_metric(metric, retry_limit=0)

Unsubscribe to given metric

Parameters:
  • metric (SystemMetric) – metric to be unsubscribed
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failure occurs during API invocation
Returns:

boolean indicates the status of the operation

Raises:

DeviceNotFoundException: If the device is not found

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrate how to unsubscribe to a metric
>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.device import SystemMetric
>>> client = Client(auth_token='token', project='project_id')
>>> device = client.get_device('device_id')
>>> device.unsubscribe_metric(SystemMetric.CPU)
unsubscribe_topic(topic, kind=<TopicKind.METRIC: 'METRIC'>, retry_limit=0)

To unsubscribe a topic

Parameters:
  • topic (string) – topic name to unsubscribe
  • kind (enum TopicKind) – unsubscribe the topic as a metric or log
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

list containing unsubscription status.

Raises:

DeviceNotFountException: If the device is not found.

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrates how to unsubscribe a topic

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> device.unsubscribe_topic('test_topic', TopicKind.METRIC)
update_config_variable(config)

Update device configuration variable of a device.

Parameters:config (instance of DeviceConfig class) – Configuration variable
Returns:instance of DeviceConfig class.
Raises:ParameterMissingException: If any parameters are missing in the request.
Raises: DeviceNotFoundException: If the device is not found.
Raises:APIError: If the API call returns an error, the status code is anything other than 200/201.

Following example demonstrates how to update a device configuration variable.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> config_var = device.get_config_variables()[0]
>>> config_var.value = 'new_config_value'
>>> device.update_config_variable(config_var)
update_label(label, retry_limit=0)

Update device label

Parameters:
  • label (Label) – instance of class Label to update
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failures occurs during the API call.
Returns:

updated instance of the class Label.

Raises:

LabelNotFoundException: If the label is not found.

Raises:

APIError: If the API call returns an error, the status code is anything other than 200/201.

Following example demonstrates how to update a device label

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.model import Label
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> device = client.get_device('test_device_id')
>>> label = device.get_labels()[0]
>>> label.value = 'new label value'
>>> device.update_label(label)
upload_log_file(upload_request, retry_limit=0)

Uploads the specified logfile in request to the cloud storage

Parameters:
  • upload_request (LogsUploadRequest) – upload specific details
  • retry_limit (int) – Optional parameter to specify the number of retry attempts to be carried out if any failure occurs during API invocation
Returns:

UUID of the upload request using which user can query the status/download the file from cloud

Raises:

APIError: If the api returns an error, the status code is anything other than 200/201

Following example demonstrate how to upload the log file from device
>>> from rapyuta_io import Client
>>> from rapyuta_io.clients import LogsUploadRequest
>>> client = Client(auth_token='token', project='project_id')
>>> device = client.get_device('device_id')
>>> upload_request = LogsUploadRequest('/path/to/file.log', file_name='new-file-name.log', override=False,
>>>                    purge_after=False, metadata={'key': 'value'})
>>> request_uuid = device.upload_log_file(upload_request)
class DeviceStatus

DeviceStatus enumeration represents the supported device status. Device status can be any of the below types

DeviceStatus.ONLINE

DeviceStatus.REJECTED

DeviceStatus.ACCEPTED

DeviceStatus.OFFLINE

DeviceStatus.REGISTERED

DeviceStatus.INITIALIZING

DeviceStatus.FAILED

DeviceStatus.NEW

DeviceStatus.DELETED

class QoS

Enumeration variables for QoS for topic/metric subscription.

QoS.LOW

QoS.MEDIUM

QoS.HIGH

class SystemMetric

Metrics options that are currently supported by device. User can subscribe any of metrics options given below

SystemMetric.CPU

SystemMetric.MEMORY

SystemMetric.DISK

SystemMetric.DISKIO

SystemMetric.NETWORK

SystemMetric.WIRELESS

class TopicKind

Enumeration variables for the Topic kind. Topic kind may be ‘Metric’ or ‘Log’

TopicKind.METRIC

TopicKind.LOG

class TopicQOS

Deprecated since version 0.7.0: Use QoS instead.

Enumeration variables for the Topic qos. Topic qos may be 0, 1 or 2

TopicQOS.ZERO

TopicQOS.ONE

TopicQOS.TWO

class DeviceArch

DeviceArch enumeration represents supported device architectures. Device architecture can be any of the below types

DeviceArch.ARM32V7

DeviceArch.ARM64V8

DeviceArch.AMD64

class Command(cmd, shell=None, env=None, bg=False, runas=None, pwd=None)

Command class represent command that is executed on a device.

Variables:
  • shell – Represents the shell where it is going to execute
  • env – List of environment variables.
  • bg – Boolean value specifying whether the execution runs on the background or not
  • runas – Run the command as a specific user
  • cmd – Command to execute on the device
  • pwd – Present working directory
class DeviceConfig(*args, **kwargs)

DeviceConfig class represents configuration of a device. Member variables of the class represent the properties of device.

Variables:
  • id – Id of the configuration.
  • key – Configuration key.
  • value – Value of the configuration key.
class Label(*args, **kwargs)

Label class represents labels associated with a device.

Variables:
  • id – Integer represents the id of the label
  • key – Key or label name
  • value – Value of the label
class LogUploadStatus(*args, **kwargs)

This class instance represent current status of the upload request

Variables:
  • status – Represents the current file upload status
  • error_message – Any error message during file upload
  • creator – User guid who initiated the upload operation
  • created_at – Timestamp at which logs upload initiated
  • request_uuid – An uniquely identifier associated with current upload
  • filename – Name of the file which is to be uploaded
  • updated_at – Timestamp at which file is updated
class LogUploads(*args, **kwargs)

This class represents the status and other attributes associated with upload files.

Variables:
  • status – Represents the current upload status
  • content_length – Length in bytes
  • creator – User guid who initiated the upload operation
  • created_at – Timestamp at which logs upload initiated
  • request_uuid – UUID associated with the request
  • creation_time – Timestamp at which file upload is completed
  • updated_at – Timestamp at which last file updated happened
  • filename – Name of the file which is to be uploaded
  • last_modified – represents the time at which last modification done to the file on cloud
  • metadata – key/value pair associated with upload request
class LogsUploadRequest(device_path, file_name='', max_upload_rate=1048576, override=False, purge_after=False, metadata=None)

Request class for log upload API

Variables:
  • device_path – absolute path of file on device
  • file_name – Name of the file in cloud storage. If not provided, file name is derived from the device_path
  • max_upload_rate – network bandwidth to be used for upload
  • override – If true overrides the destination file
  • purge_after – If true purges the log file after upload
  • metadata – Key/value to be associated with log file
class Metric(*args, **kwargs)

Class represents current status of subscription of the metric

Variables:
  • name – Name of the metric
  • kind – metric
  • config – Metric collection configuration
class TopicsStatus(*args, **kwargs)

Topic class represents the status - subscribed and unsubscribed - for logs and metrics

Variables:
  • master_up – Boolean represents whether the master is running or not
  • subscribed – List of subscribed topics
  • unsubscribed – List of unsubscribed topics

Indices and tables