From 3dc25d3b04f353a9292e811ce9b8956337776a80 Mon Sep 17 00:00:00 2001 From: Matthew Yarmolinsky Date: Fri, 22 May 2026 11:36:03 -0400 Subject: [PATCH] TEST SDK LINK CLEANUP, DO NOT MERGE Change-type: patch --- .../includes/balena-example-projects.md | 172 +- .../.gitbook/includes/balena-labs-projects.md | 50 +- pages/external-docs/sdk/python-sdk/latest.md | 2688 ++++---- pages/external-docs/sdk/python-sdk/v10.2.0.md | 5799 +++++++++++------ pages/external-docs/sdk/python-sdk/v14.5.0.md | 2920 ++++----- pages/external-docs/sdk/python-sdk/v15.1.5.md | 2817 ++++---- pages/external-docs/sdk/python-sdk/v16.0.0.md | 2719 ++++---- tools/sync-external.js | 8 +- 8 files changed, 9435 insertions(+), 7738 deletions(-) diff --git a/pages/.gitbook/includes/balena-example-projects.md b/pages/.gitbook/includes/balena-example-projects.md index 84c3e12fa3..85bae34e38 100644 --- a/pages/.gitbook/includes/balena-example-projects.md +++ b/pages/.gitbook/includes/balena-example-projects.md @@ -1,88 +1,84 @@ ---- -title: balena-example-projects ---- - -| Name | Description | -| -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [balena-nodejs-hello-world](https://github.com/balena-io-examples/balena-nodejs-hello-world) | Example of how to deploy Node code on a balena supported device. | -| [balena-plant-saver](https://github.com/balena-io-examples/balena-plant-saver) | We're building a plant monitor (and saver) - this is the early stage | -| [multicontainer-getting-started](https://github.com/balena-io-examples/multicontainer-getting-started) | Get up and running quickly with a multicontainer setup on balena | -| [internetspeedtest](https://github.com/balena-io-examples/internetspeedtest) | Log your internet download, upload and ping metrics ti influxDB, and Grafana it. Grafana all the things! | -| [balena-python-hello-world](https://github.com/balena-io-examples/balena-python-hello-world) | Example of how to deploy Python code on a balena supported device. | -| [x11-window-manager](https://github.com/balena-io-examples/x11-window-manager) | Example project showing how to run a desktop manager with balenaCloud in order to run GUI applications. | -| [staged-releases](https://github.com/balena-io-examples/staged-releases) | demonstration scripts on how to use the resin.io API to do staged releases to a fleet of devices. | -| [coral-streaming-object-detector](https://github.com/balena-io-examples/coral-streaming-object-detector) | This example will help you deploy a streaming camera feed with realtime people detection using the Coral Edge TPU for on-device ML inferencing. | -| [balena-aws-lambda](https://github.com/balena-io-examples/balena-aws-lambda) | Associate balena devices with AWS IoT when they ping a lambda endpoint | -| [balena-storage](https://github.com/balena-io-examples/balena-storage) | Sample project to showcase storage mounting on balenaOS. | -| [jetson-examples](https://github.com/balena-io-examples/jetson-examples) | Sample container applications for Jetson devices | -| [balena-rust-hello-world](https://github.com/balena-io-examples/balena-rust-hello-world) | Example of how to deploy Rust code on a balena supported device. | -| [wifi-connect-api](https://github.com/balena-io-examples/wifi-connect-api) | Example Python web application that uses WiFi Connect's JSON API | -| [balena-aws-device](https://github.com/balena-io-examples/balena-aws-device) | Device portion of balena/AWS integration | -| [balena-go-hello-world](https://github.com/balena-io-examples/balena-go-hello-world) | Example of how to deploy Go code on a balena supported device. | -| [google-iot](https://github.com/balena-io-examples/google-iot) | Google Cloud IoT integration | -| [proxy-tunnel](https://github.com/balena-io-examples/proxy-tunnel) | Connecting your device(s) to balenaCloud from behind a compatible proxy. | -| [balena-timezone](https://github.com/balena-io-examples/balena-timezone) | Example of how to set the timezone within a container | -| [aws-iot-provision](https://github.com/balena-io-examples/aws-iot-provision) | Lambda function to provision a device with AWS IoT | -| [jetson-nano-sample-app](https://github.com/balena-io-examples/jetson-nano-sample-app) | Sample App with instructions for Jetson Nano | -| [device-cloud-logging](https://github.com/balena-io-examples/device-cloud-logging) | An example of using the journald log streaming endpoint on balena-supervisor | -| [balena-device-node-exporter](https://github.com/balena-io-examples/balena-device-node-exporter) | On-device node\_exporter | -| [balena-multiapp-project](https://github.com/balena-io-examples/balena-multiapp-project) | Sample project to demonstrate how to integrate several existing balena projects in one | -| [balena-electron](https://github.com/balena-io-examples/balena-electron) | A simple example of how to get an Electron application running on Balena | -| [community-cli-action](https://github.com/balena-io-examples/community-cli-action) | A community built GitHub action that allows you to use the balena CLI | -| [device-tags](https://github.com/balena-io-examples/device-tags) | Examples on how to use the balena API & SDK to set device tags from within your app. | -| [baletheus](https://github.com/balena-io-examples/baletheus) | Balena Service Discovery for Prometheus | -| [nginx-reverse-proxy](https://github.com/balena-io-examples/nginx-reverse-proxy) | Access multiple ports over public URL using nginx reverse proxy. | -| [balena-java-hello-world](https://github.com/balena-io-examples/balena-java-hello-world) | Hello Java in balena | -| [balena-datadog](https://github.com/balena-io-examples/balena-datadog) | Balena + Datadog Example Project | -| [balenalib-systemd-example](https://github.com/balena-io-examples/balenalib-systemd-example) | Example project using systemd with balenalib images | -| [balena-aws-iot-mqtt-example](https://github.com/balena-io-examples/balena-aws-iot-mqtt-example) | Sample project showing how to connect your Balena device to a AWS IoT MQTT broker | -| [balena-google-apps-script-sheet-skeleton](https://github.com/balena-io-examples/balena-google-apps-script-sheet-skeleton) | Skeleton template for google sheets projects. | -| [balena-ros2-CUDA-trt-pose-estimation](https://github.com/balena-io-examples/balena-ros2-CUDA-trt-pose-estimation) | An installation of ROS2 Eloquent in a container, with a full desktop environment, CUDA, PyTorch, OpenCV, and TensorRT ready to deploy computer vision ROS applications on balena devices. | -| [cloud-relay](https://github.com/balena-io-examples/cloud-relay) | Relay data to an IoT cloud provider via MQTT | -| [balena-cpp-hello-world](https://github.com/balena-io-examples/balena-cpp-hello-world) | Example of how to deploy C++ code on a balena supported device. | -| [example-build-secrets-and-variables](https://github.com/balena-io-examples/example-build-secrets-and-variables) | Example of build time secrets and variables on balenaCloud | -| [wifi-connect-custom-ui-example](https://github.com/balena-io-examples/wifi-connect-custom-ui-example) | An example on how to customize the captive portal of WiFi Connect | -| [balena-netdata](https://github.com/balena-io-examples/balena-netdata) | Netdata configuration for internal on-device monitoring | -| [balena-ros2-foxy-base](https://github.com/balena-io-examples/balena-ros2-foxy-base) | A basic installation of ROS2 Foxy in a container, ready to deploy on balena devices. | -| [hostapd-enterprise](https://github.com/balena-io-examples/hostapd-enterprise) | Resin multicontainer hostapd-powered access point with WPA-EAP (Enterprise) authentication | -| [nvidia-x86](https://github.com/balena-io-examples/nvidia-x86) | Example of using CUDA on an Nvidia GPU in an x86 device. | -| [balena-updates-lock](https://github.com/balena-io-examples/balena-updates-lock) | Example project of simple updates locking | -| [balena-idling](https://github.com/balena-io-examples/balena-idling) | Likely the most minimalist project to deploy on a balena device | -| [healthcheck-publicurl](https://github.com/balena-io-examples/healthcheck-publicurl) | Demo of Docker healthcheck functionality for a balena service (through public device URL) | -| [balena-aspnet-core](https://github.com/balena-io-examples/balena-aspnet-core) | A simple multi-container-ready project demonstrating the use of the Microsoft ASP.Net Core 2.2 framework | -| [coral-getting-started](https://github.com/balena-io-examples/coral-getting-started) | A getting started example project for Coral.ai on balenaCloud | -| [balena-nginx-hello-world](https://github.com/balena-io-examples/balena-nginx-hello-world) | Simple nginx example on balena | -| [ROS-AutonomousVehicle](https://github.com/balena-io-examples/ROS-AutonomousVehicle) | Sample project to show ROS autonomous vehicle running in a balena container. | -| [balena-ros2-foxy-desktop](https://github.com/balena-io-examples/balena-ros2-foxy-desktop) | An installation of ROS2 Foxy in a container, with a full desktop environment, ready to deploy on balena devices. | -| [balena-avahi](https://github.com/balena-io-examples/balena-avahi) | mDNS/.local resolution with Avahi within a container | -| [system-metrics](https://github.com/balena-io-examples/system-metrics) | Collect metrics on device performance and forward to MQTT | -| [network-metrics-logger](https://github.com/balena-io-examples/network-metrics-logger) | Log metrics on network I/O | -| [setup-balena-action](https://github.com/balena-io-examples/setup-balena-action) | Install the balena CLI in your GitHub Actions workflow | -| [balena-haskell-hello-world](https://github.com/balena-io-examples/balena-haskell-hello-world) | Example of how to deploy haskell code on a balena supported device. | -| [hostapd-minimal](https://github.com/balena-io-examples/hostapd-minimal) | Minimal hostapd access point example for resin.io | -| [meta-exporter](https://github.com/balena-io-examples/meta-exporter) | The People's Exporter | -| [sample-gcr-registry-secrets](https://github.com/balena-io-examples/sample-gcr-registry-secrets) | Sample balena push/deploy with Google Container Registry (GCR) private images | -| [google-coral-dev-sample](https://github.com/balena-io-examples/google-coral-dev-sample) | Sample Application running in container on BalenaOS, for the Google Coral Dev Board | -| [tx2-container-contracts-sample](https://github.com/balena-io-examples/tx2-container-contracts-sample) | Sample TX2 application with optional containers tied to device L4T version | -| [remote-local-logging](https://github.com/balena-io-examples/remote-local-logging) | Receiver of logs | -| [balena-cloudflare-tunnel](https://github.com/balena-io-examples/balena-cloudflare-tunnel) | A simple balenaBlock to route your application through Cloudflare Tunnel | -| [balena-zerotier-gateway](https://github.com/balena-io-examples/balena-zerotier-gateway) | Fully working ZeroTier container with IP forwarding an masquerading to the LAN. | -| [tx2-sample-app](https://github.com/balena-io-examples/tx2-sample-app) | Jetson TX2 Sample Application | -| [balena-c-hello-world](https://github.com/balena-io-examples/balena-c-hello-world) | Getting started with C on balena | -| [ruuvitag](https://github.com/balena-io-examples/ruuvitag) | Collect data from a ruuvitag BLE sensor and chart it in a dashboard | -| [balena-ts-node-hello-world](https://github.com/balena-io-examples/balena-ts-node-hello-world) | A simple TypeScript Node.js Express server | -| [balena-OpenVino](https://github.com/balena-io-examples/balena-OpenVino) | | -| [balena-hello-world-skeleton](https://github.com/balena-io-examples/balena-hello-world-skeleton) | A skeleton to use for your next balena hello world repostiory | -| [cb-gcp-iot-provision](https://github.com/balena-io-examples/cb-gcp-iot-provision) | Cloud function to provision a device with ClearBlade IoT on GCP | -| [test-bluetooth](https://github.com/balena-io-examples/test-bluetooth) | Test case for internal bluetooth on various boards (artik5, artik710 etc.) | -| [rpi3-alsa-test](https://github.com/balena-io-examples/rpi3-alsa-test) | Test case for 3.5 audio jack on the rpi3 | -| [alwaysai-starter-apps](https://github.com/balena-io-examples/alwaysai-starter-apps) | Sample project to showcase how to run alwaysAI starter apps in balenaOS. | -| [balena-poll-publicurl](https://github.com/balena-io-examples/balena-poll-publicurl) | Poll a device publicURL forever. | -| [jetson-nano-x11](https://github.com/balena-io-examples/jetson-nano-x11) | Jetson Nano X11 Example | -| [gcp-iot-provision](https://github.com/balena-io-examples/gcp-iot-provision) | Cloud function to provision a device with Google Cloud IoT | -| [azure-iot-provision](https://github.com/balena-io-examples/azure-iot-provision) | Azure function to provision a device with Azure IoT | -| [cloud-relay-starter](https://github.com/balena-io-examples/cloud-relay-starter) | Create a fleet to experiment with cloud IoT integrations using Cloud Relay block | -| [balena-hyperpixel4-square](https://github.com/balena-io-examples/balena-hyperpixel4-square) | Minimal example of using Hyperpixel4 Square w/touch on balena | -| [balena-multistage-dockerfile-example](https://github.com/balena-io-examples/balena-multistage-dockerfile-example) | How to leverage _multi-stage Dockerfile_ with _docker-compose.dev.yml_ to improve DX with balena. | -| [moby-balena-compare](https://github.com/balena-io-examples/moby-balena-compare) | Finds commits specific to Balena Engine inside Balena Engine repository | -| [release-assets-hello-world](https://github.com/balena-io-examples/release-assets-hello-world) | | +Name|Description +---|--- +[balena-nodejs-hello-world](https://github.com/balena-io-examples/balena-nodejs-hello-world)|Example of how to deploy Node code on a balena supported device. +[balena-plant-saver](https://github.com/balena-io-examples/balena-plant-saver)|We're building a plant monitor (and saver) - this is the early stage +[multicontainer-getting-started](https://github.com/balena-io-examples/multicontainer-getting-started)|Get up and running quickly with a multicontainer setup on balena +[internetspeedtest](https://github.com/balena-io-examples/internetspeedtest)|Log your internet download, upload and ping metrics ti influxDB, and Grafana it. Grafana all the things! +[balena-python-hello-world](https://github.com/balena-io-examples/balena-python-hello-world)|Example of how to deploy Python code on a balena supported device. +[x11-window-manager](https://github.com/balena-io-examples/x11-window-manager)|Example project showing how to run a desktop manager with balenaCloud in order to run GUI applications. +[staged-releases](https://github.com/balena-io-examples/staged-releases)|demonstration scripts on how to use the resin.io API to do staged releases to a fleet of devices. +[coral-streaming-object-detector](https://github.com/balena-io-examples/coral-streaming-object-detector)|This example will help you deploy a streaming camera feed with realtime people detection using the Coral Edge TPU for on-device ML inferencing. +[balena-aws-lambda](https://github.com/balena-io-examples/balena-aws-lambda)|Associate balena devices with AWS IoT when they ping a lambda endpoint +[balena-storage](https://github.com/balena-io-examples/balena-storage)|Sample project to showcase storage mounting on balenaOS. +[jetson-examples](https://github.com/balena-io-examples/jetson-examples)|Sample container applications for Jetson devices +[balena-rust-hello-world](https://github.com/balena-io-examples/balena-rust-hello-world)|Example of how to deploy Rust code on a balena supported device. +[wifi-connect-api](https://github.com/balena-io-examples/wifi-connect-api)|Example Python web application that uses WiFi Connect's JSON API +[balena-aws-device](https://github.com/balena-io-examples/balena-aws-device)|Device portion of balena/AWS integration +[balena-go-hello-world](https://github.com/balena-io-examples/balena-go-hello-world)|Example of how to deploy Go code on a balena supported device. +[google-iot](https://github.com/balena-io-examples/google-iot)|Google Cloud IoT integration +[proxy-tunnel](https://github.com/balena-io-examples/proxy-tunnel)|Connecting your device(s) to balenaCloud from behind a compatible proxy. +[balena-timezone](https://github.com/balena-io-examples/balena-timezone)|Example of how to set the timezone within a container +[aws-iot-provision](https://github.com/balena-io-examples/aws-iot-provision)|Lambda function to provision a device with AWS IoT +[jetson-nano-sample-app](https://github.com/balena-io-examples/jetson-nano-sample-app)|Sample App with instructions for Jetson Nano +[device-cloud-logging](https://github.com/balena-io-examples/device-cloud-logging)|An example of using the journald log streaming endpoint on balena-supervisor +[balena-device-node-exporter](https://github.com/balena-io-examples/balena-device-node-exporter)|On-device node_exporter +[balena-multiapp-project](https://github.com/balena-io-examples/balena-multiapp-project)|Sample project to demonstrate how to integrate several existing balena projects in one +[balena-electron](https://github.com/balena-io-examples/balena-electron)|A simple example of how to get an Electron application running on Balena +[community-cli-action](https://github.com/balena-io-examples/community-cli-action)|A community built GitHub action that allows you to use the balena CLI +[device-tags](https://github.com/balena-io-examples/device-tags)|Examples on how to use the balena API & SDK to set device tags from within your app. +[baletheus](https://github.com/balena-io-examples/baletheus)|Balena Service Discovery for Prometheus +[nginx-reverse-proxy](https://github.com/balena-io-examples/nginx-reverse-proxy)|Access multiple ports over public URL using nginx reverse proxy. +[balena-java-hello-world](https://github.com/balena-io-examples/balena-java-hello-world)|Hello Java in balena +[balena-datadog](https://github.com/balena-io-examples/balena-datadog)|Balena + Datadog Example Project +[balenalib-systemd-example](https://github.com/balena-io-examples/balenalib-systemd-example)|Example project using systemd with balenalib images +[balena-aws-iot-mqtt-example](https://github.com/balena-io-examples/balena-aws-iot-mqtt-example)|Sample project showing how to connect your Balena device to a AWS IoT MQTT broker +[balena-google-apps-script-sheet-skeleton](https://github.com/balena-io-examples/balena-google-apps-script-sheet-skeleton)|Skeleton template for google sheets projects. +[balena-ros2-CUDA-trt-pose-estimation](https://github.com/balena-io-examples/balena-ros2-CUDA-trt-pose-estimation)|An installation of ROS2 Eloquent in a container, with a full desktop environment, CUDA, PyTorch, OpenCV, and TensorRT ready to deploy computer vision ROS applications on balena devices. +[cloud-relay](https://github.com/balena-io-examples/cloud-relay)|Relay data to an IoT cloud provider via MQTT +[balena-cpp-hello-world](https://github.com/balena-io-examples/balena-cpp-hello-world)|Example of how to deploy C++ code on a balena supported device. +[example-build-secrets-and-variables](https://github.com/balena-io-examples/example-build-secrets-and-variables)|Example of build time secrets and variables on balenaCloud +[wifi-connect-custom-ui-example](https://github.com/balena-io-examples/wifi-connect-custom-ui-example)|An example on how to customize the captive portal of WiFi Connect +[balena-netdata](https://github.com/balena-io-examples/balena-netdata)|Netdata configuration for internal on-device monitoring +[balena-ros2-foxy-base](https://github.com/balena-io-examples/balena-ros2-foxy-base)|A basic installation of ROS2 Foxy in a container, ready to deploy on balena devices. +[hostapd-enterprise](https://github.com/balena-io-examples/hostapd-enterprise)|Resin multicontainer hostapd-powered access point with WPA-EAP (Enterprise) authentication +[nvidia-x86](https://github.com/balena-io-examples/nvidia-x86)|Example of using CUDA on an Nvidia GPU in an x86 device. +[balena-updates-lock](https://github.com/balena-io-examples/balena-updates-lock)|Example project of simple updates locking +[balena-idling](https://github.com/balena-io-examples/balena-idling)|Likely the most minimalist project to deploy on a balena device +[healthcheck-publicurl](https://github.com/balena-io-examples/healthcheck-publicurl)|Demo of Docker healthcheck functionality for a balena service (through public device URL) +[balena-aspnet-core](https://github.com/balena-io-examples/balena-aspnet-core)|A simple multi-container-ready project demonstrating the use of the Microsoft ASP.Net Core 2.2 framework +[coral-getting-started](https://github.com/balena-io-examples/coral-getting-started)|A getting started example project for Coral.ai on balenaCloud +[balena-nginx-hello-world](https://github.com/balena-io-examples/balena-nginx-hello-world)|Simple nginx example on balena +[ROS-AutonomousVehicle](https://github.com/balena-io-examples/ROS-AutonomousVehicle)|Sample project to show ROS autonomous vehicle running in a balena container. +[balena-ros2-foxy-desktop](https://github.com/balena-io-examples/balena-ros2-foxy-desktop)|An installation of ROS2 Foxy in a container, with a full desktop environment, ready to deploy on balena devices. +[balena-avahi](https://github.com/balena-io-examples/balena-avahi)|mDNS/.local resolution with Avahi within a container +[system-metrics](https://github.com/balena-io-examples/system-metrics)|Collect metrics on device performance and forward to MQTT +[network-metrics-logger](https://github.com/balena-io-examples/network-metrics-logger)|Log metrics on network I/O +[setup-balena-action](https://github.com/balena-io-examples/setup-balena-action)|Install the balena CLI in your GitHub Actions workflow +[balena-haskell-hello-world](https://github.com/balena-io-examples/balena-haskell-hello-world)|Example of how to deploy haskell code on a balena supported device. +[hostapd-minimal](https://github.com/balena-io-examples/hostapd-minimal)|Minimal hostapd access point example for resin.io +[meta-exporter](https://github.com/balena-io-examples/meta-exporter)|The People's Exporter +[sample-gcr-registry-secrets](https://github.com/balena-io-examples/sample-gcr-registry-secrets)|Sample balena push/deploy with Google Container Registry (GCR) private images +[google-coral-dev-sample](https://github.com/balena-io-examples/google-coral-dev-sample)|Sample Application running in container on BalenaOS, for the Google Coral Dev Board +[tx2-container-contracts-sample](https://github.com/balena-io-examples/tx2-container-contracts-sample)|Sample TX2 application with optional containers tied to device L4T version +[remote-local-logging](https://github.com/balena-io-examples/remote-local-logging)|Receiver of logs +[balena-cloudflare-tunnel](https://github.com/balena-io-examples/balena-cloudflare-tunnel)|A simple balenaBlock to route your application through Cloudflare Tunnel +[balena-zerotier-gateway](https://github.com/balena-io-examples/balena-zerotier-gateway)|Fully working ZeroTier container with IP forwarding an masquerading to the LAN. +[tx2-sample-app](https://github.com/balena-io-examples/tx2-sample-app)|Jetson TX2 Sample Application +[balena-c-hello-world](https://github.com/balena-io-examples/balena-c-hello-world)|Getting started with C on balena +[ruuvitag](https://github.com/balena-io-examples/ruuvitag)|Collect data from a ruuvitag BLE sensor and chart it in a dashboard +[balena-ts-node-hello-world](https://github.com/balena-io-examples/balena-ts-node-hello-world)|A simple TypeScript Node.js Express server +[balena-OpenVino](https://github.com/balena-io-examples/balena-OpenVino)| +[balena-hello-world-skeleton](https://github.com/balena-io-examples/balena-hello-world-skeleton)|A skeleton to use for your next balena hello world repostiory +[cb-gcp-iot-provision](https://github.com/balena-io-examples/cb-gcp-iot-provision)|Cloud function to provision a device with ClearBlade IoT on GCP +[test-bluetooth](https://github.com/balena-io-examples/test-bluetooth)|Test case for internal bluetooth on various boards (artik5, artik710 etc.) +[rpi3-alsa-test](https://github.com/balena-io-examples/rpi3-alsa-test)|Test case for 3.5 audio jack on the rpi3 +[alwaysai-starter-apps](https://github.com/balena-io-examples/alwaysai-starter-apps)|Sample project to showcase how to run alwaysAI starter apps in balenaOS. +[balena-poll-publicurl](https://github.com/balena-io-examples/balena-poll-publicurl)|Poll a device publicURL forever. +[jetson-nano-x11](https://github.com/balena-io-examples/jetson-nano-x11)|Jetson Nano X11 Example +[gcp-iot-provision](https://github.com/balena-io-examples/gcp-iot-provision)|Cloud function to provision a device with Google Cloud IoT +[azure-iot-provision](https://github.com/balena-io-examples/azure-iot-provision)|Azure function to provision a device with Azure IoT +[cloud-relay-starter](https://github.com/balena-io-examples/cloud-relay-starter)|Create a fleet to experiment with cloud IoT integrations using Cloud Relay block +[balena-hyperpixel4-square](https://github.com/balena-io-examples/balena-hyperpixel4-square)|Minimal example of using Hyperpixel4 Square w/touch on balena +[balena-multistage-dockerfile-example](https://github.com/balena-io-examples/balena-multistage-dockerfile-example)|How to leverage _multi-stage Dockerfile_ with _docker-compose.dev.yml_ to improve DX with balena. +[moby-balena-compare](https://github.com/balena-io-examples/moby-balena-compare)|Finds commits specific to Balena Engine inside Balena Engine repository +[release-assets-hello-world](https://github.com/balena-io-examples/release-assets-hello-world)| diff --git a/pages/.gitbook/includes/balena-labs-projects.md b/pages/.gitbook/includes/balena-labs-projects.md index 6320e928be..a99604cf4c 100644 --- a/pages/.gitbook/includes/balena-labs-projects.md +++ b/pages/.gitbook/includes/balena-labs-projects.md @@ -1,27 +1,23 @@ ---- -title: balena-labs-projects ---- - -| Name | Description | -| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | -| [balena-dash](https://github.com/balena-labs-projects/balena-dash) | Build a Raspberry Pi based desktop dashboard for stats, photos, videos and more! | -| [balena-sense](https://github.com/balena-labs-projects/balena-sense) | Take readings from a BME680 or similar sensor on a Raspberry Pi, store with InfluxDB and view with Grafana | -| [wifi-repeater](https://github.com/balena-labs-projects/wifi-repeater) | Easily create a WiFi Access Point or WiFi repeater with balenaOS | -| [balena-cam](https://github.com/balena-labs-projects/balena-cam) | Network Camera with Raspberry Pi and WebRTC. Tutorial: | -| [rosetta-at-home](https://github.com/balena-labs-projects/rosetta-at-home) | | -| [balena-node-red](https://github.com/balena-labs-projects/balena-node-red) | a node-red application with balena-supervisor support, can be managed remotely via balena publicURL | -| [bluetooth](https://github.com/balena-labs-projects/bluetooth) | Optimized bluetooth agent for balenaOS. Based on BlueZ 5.0. | -| [dashboard](https://github.com/balena-labs-projects/dashboard) | Grafana dashboard block with auto-visualization of InfluxDB databases to get your data visualized instantly! | -| [xserver](https://github.com/balena-labs-projects/xserver) | A simple X11 server block | -| [connector](https://github.com/balena-labs-projects/connector) | Auto-configured data connector block based on Telegraf | -| [sensor](https://github.com/balena-labs-projects/sensor) | Auto-detects connected i2c sensors and published data on HTTP or MQTT. | -| [fbcp](https://github.com/balena-labs-projects/fbcp) | fbcp driver for SPI based displays for Raspberry Pis via fbcp-ili9341 | -| [project-template](https://github.com/balena-labs-projects/project-template) | Project template for new Balena projects | -| [multiroom](https://github.com/balena-labs-projects/multiroom) | Set up multiroom audio for your fleet of devices. Uses the Snapcast audio player. | -| [log2screen](https://github.com/balena-labs-projects/log2screen) | | -| [dbus](https://github.com/balena-labs-projects/dbus) | | -| [pulse](https://github.com/balena-labs-projects/pulse) | A block for counting pulses on a Raspberry Pi GPIO pin. | -| [browsercontrol](https://github.com/balena-labs-projects/browsercontrol) | | -| [video-capture](https://github.com/balena-labs-projects/video-capture) | Provide an RTSP stream for a connected video source. | -| [logwatcher](https://github.com/balena-labs-projects/logwatcher) | | -| [lockr-block](https://github.com/balena-labs-projects/lockr-block) | Create or remove application update locks with the return code of any command. | +Name|Description +---|--- +[balena-dash](https://github.com/balena-labs-projects/balena-dash)|Build a Raspberry Pi based desktop dashboard for stats, photos, videos and more! +[balena-sense](https://github.com/balena-labs-projects/balena-sense)|Take readings from a BME680 or similar sensor on a Raspberry Pi, store with InfluxDB and view with Grafana +[wifi-repeater](https://github.com/balena-labs-projects/wifi-repeater)|Easily create a WiFi Access Point or WiFi repeater with balenaOS +[balena-cam](https://github.com/balena-labs-projects/balena-cam)|Network Camera with Raspberry Pi and WebRTC. Tutorial: +[rosetta-at-home](https://github.com/balena-labs-projects/rosetta-at-home)| +[balena-node-red](https://github.com/balena-labs-projects/balena-node-red)|a node-red application with balena-supervisor support, can be managed remotely via balena publicURL +[bluetooth](https://github.com/balena-labs-projects/bluetooth)|Optimized bluetooth agent for balenaOS. Based on BlueZ 5.0. +[dashboard](https://github.com/balena-labs-projects/dashboard)|Grafana dashboard block with auto-visualization of InfluxDB databases to get your data visualized instantly! +[xserver](https://github.com/balena-labs-projects/xserver)|A simple X11 server block +[connector](https://github.com/balena-labs-projects/connector)|Auto-configured data connector block based on Telegraf +[sensor](https://github.com/balena-labs-projects/sensor)|Auto-detects connected i2c sensors and published data on HTTP or MQTT. +[fbcp](https://github.com/balena-labs-projects/fbcp)|fbcp driver for SPI based displays for Raspberry Pis via fbcp-ili9341 +[project-template](https://github.com/balena-labs-projects/project-template)|Project template for new Balena projects +[multiroom](https://github.com/balena-labs-projects/multiroom)|Set up multiroom audio for your fleet of devices. Uses the Snapcast audio player. +[log2screen](https://github.com/balena-labs-projects/log2screen)| +[dbus](https://github.com/balena-labs-projects/dbus)| +[pulse](https://github.com/balena-labs-projects/pulse)|A block for counting pulses on a Raspberry Pi GPIO pin. +[browsercontrol](https://github.com/balena-labs-projects/browsercontrol)| +[video-capture](https://github.com/balena-labs-projects/video-capture)|Provide an RTSP stream for a connected video source. +[logwatcher](https://github.com/balena-labs-projects/logwatcher)| +[lockr-block](https://github.com/balena-labs-projects/lockr-block)|Create or remove application update locks with the return code of any command. diff --git a/pages/external-docs/sdk/python-sdk/latest.md b/pages/external-docs/sdk/python-sdk/latest.md index 8ee6b4e1c4..08a691bc6b 100644 --- a/pages/external-docs/sdk/python-sdk/latest.md +++ b/pages/external-docs/sdk/python-sdk/latest.md @@ -77,1079 +77,863 @@ balena = Balena({"retry_rate_limited_request": True}) If you feel something is missing, not clear or could be improved, [please don't hesitate to open an issue in GitHub](https://github.com/balena-io/balena-sdk-python/issues), we'll be happy to help. -## Table of Contents -- [balena](#balena) - - [.models](#models) - - [.application](#application) - - [create(name, device_type, organization, application_class)](#application.create) ⇒ [TypeApplication](#typeapplication) - - [disable_device_urls(slug_or_uuid_or_id)](#application.disable_device_urls) ⇒ None - - [enable_device_urls(slug_or_uuid_or_id)](#application.enable_device_urls) ⇒ None - - [generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date)](#application.generate_provisioning_key) ⇒ str - - [get(slug_or_uuid_or_id, options, context)](#application.get) ⇒ [TypeApplication](#typeapplication) - - [get_all(options, context)](#application.get_all) ⇒ [List[TypeApplication]](#typeapplication) - - [get_all_by_organization(org_handle_or_id, options)](#application.get_all_by_organization) ⇒ [List[TypeApplication]](#typeapplication) - - [get_all_directly_accessible(options)](#application.get_all_directly_accessible) ⇒ [List[TypeApplication]](#typeapplication) - - [get_by_name(app_name, options, context)](#application.get_by_name) ⇒ [TypeApplication](#typeapplication) - - [get_dashboard_url(app_id)](#application.get_dashboard_url) ⇒ str - - [get_directly_accessible(slug_or_uuid_or_id, options)](#application.get_directly_accessible) ⇒ [TypeApplication](#typeapplication) - - [get_id(slug_or_uuid_or_id)](#application.get_id) ⇒ int - - [get_target_release_hash(slug_or_uuid_or_id)](#application.get_target_release_hash) ⇒ Optional[str] - - [get_with_device_service_details(slug_or_uuid_or_id, options)](#application.get_with_device_service_details) ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) - - [grant_support_access(slug_or_uuid_or_id, expiry_timestamp)](#application.grant_support_access) ⇒ None - - [has(slug_or_uuid_or_id)](#application.has) ⇒ bool - - [has_any()](#application.has_any) ⇒ bool - - [is_tracking_latest_release(slug_or_uuid_or_id)](#application.is_tracking_latest_release) ⇒ bool - - [pin_to_release(slug_or_uuid_or_id, full_release_hash)](#application.pin_to_release) ⇒ None - - [purge(app_id)](#application.purge) ⇒ None - - [reboot(app_id, options)](#application.reboot) ⇒ None - - [remove(slug_or_uuid_or_id)](#application.remove) ⇒ None - - [rename(slug_or_uuid_or_id, new_name)](#application.rename) ⇒ None - - [restart(slug_or_uuid_or_id)](#application.restart) ⇒ None - - [revoke_support_access(slug_or_uuid_or_id)](#application.revoke_support_access) ⇒ None - - [shutdown(app_id, options)](#application.shutdown) ⇒ None - - [track_latest_release(slug_or_uuid_or_id)](#application.track_latest_release) ⇒ None - - [will_track_new_releases(slug_or_uuid_or_id)](#application.will_track_new_releases) ⇒ bool - - [.tags](#applicationtag) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationtag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(slug_or_uuid_or_id, tag_key)](#applicationtag.remove) ⇒ None - - [set(slug_or_uuid_or_id, tag_key, value)](#applicationtag.set) ⇒ None - - [.config_var](#applicationconfigvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#applicationconfigvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationconfigvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#applicationconfigvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#applicationconfigvariable.set) ⇒ None - - [.env_var](#applicationenvvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#applicationenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#applicationenvvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#applicationenvvariable.set) ⇒ None - - [.build_var](#buildenvvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#buildenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#buildenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#buildenvvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#buildenvvariable.set) ⇒ None - - [.membership](#applicationmembership) - - [change_role(membership_id, role_name)](#applicationmembership.change_role) ⇒ None - - [create(slug_or_uuid_or_id, username, role_name)](#applicationmembership.create) ⇒ [ApplicationMembershipType](#applicationmembershiptype) - - [get(membership_id, options)](#applicationmembership.get) ⇒ [ApplicationMembershipType](#applicationmembershiptype) - - [get_all(options)](#applicationmembership.get_all) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationmembership.get_all_by_application) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) - - [remove(membership_id)](#applicationmembership.remove) ⇒ None - - [.invite](#applicationinvite) - - [accept(invite_token)](#applicationinvite.accept) ⇒ None - - [create(slug_or_uuid_or_id, options)](#applicationinvite.create) ⇒ [ApplicationInviteType](#applicationinvitetype) - - [get_all(options)](#applicationinvite.get_all) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationinvite.get_all_by_application) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) - - [revoke(invite_id)](#applicationinvite.revoke) ⇒ None - - [.device](#device) - - [deactivate(uuid_or_id_or_ids)](#device.deactivate) ⇒ None - - [disable_device_url(uuid_or_id_or_ids)](#device.disable_device_url) ⇒ None - - [disable_local_mode(uuid_or_id)](#device.disable_local_mode) ⇒ None - - [disable_lock_override(uuid_or_id)](#device.disable_lock_override) ⇒ None - - [enable_device_url(uuid_or_id_or_ids)](#device.enable_device_url) ⇒ None - - [enable_local_mode(uuid_or_id)](#device.enable_local_mode) ⇒ None - - [enable_lock_override(uuid_or_id)](#device.enable_lock_override) ⇒ None - - [generate_device_key(uuid_or_id, name, description, expiry_date)](#device.generate_device_key) ⇒ str - - [generate_uuid()](#device.generate_uuid) ⇒ str - - [get(uuid_or_id, options)](#device.get) ⇒ [TypeDevice](#typedevice) - - [get_all(options)](#device.get_all) ⇒ [List[TypeDevice]](#typedevice) - - [get_all_by_application(slug_or_uuid_or_id, options)](#device.get_all_by_application) ⇒ [List[TypeDevice]](#typedevice) - - [get_all_by_organization(handle_or_id, options)](#device.get_all_by_organization) ⇒ [List[TypeDevice]](#typedevice) - - [get_application_info(uuid_or_id)](#device.get_application_info) ⇒ Any - - [get_application_name(uuid_or_id)](#device.get_application_name) ⇒ str - - [get_by_name(name, options)](#device.get_by_name) ⇒ [List[TypeDevice]](#typedevice) - - [get_dashboard_url(uuid)](#device.get_dashboard_url) ⇒ None - - [get_device_url(uuid_or_id)](#device.get_device_url) ⇒ str - - [get_local_ip_address(uuid_or_id)](#device.get_local_ip_address) ⇒ List[str] - - [get_local_mode_support(uuid_or_id)](#device.get_local_mode_support) ⇒ LocalModeResponse - - [get_mac_address(uuid_or_id)](#device.get_mac_address) ⇒ List[str] - - [get_metrics(uuid_or_id)](#device.get_metrics) ⇒ [DeviceMetricsType](#devicemetricstype) - - [get_name(uuid_or_id)](#device.get_name) ⇒ str - - [get_os_update_status(uuid_or_id)](#device.get_os_update_status) ⇒ HUPStatusResponse - - [get_status(uuid_or_id)](#device.get_status) ⇒ str - - [get_supervisor_state(uuid_or_id)](#device.get_supervisor_state) ⇒ SupervisorStateType - - [get_supervisor_target_state(uuid_or_id)](#device.get_supervisor_target_state) ⇒ Any - - [get_supervisor_target_state_for_app(slug_or_uuid_or_id, release)](#device.get_supervisor_target_state_for_app) ⇒ Any - - [get_with_service_details(uuid_or_id, options)](#device.get_with_service_details) ⇒ [TypeDeviceWithServices](#typedevicewithservices) - - [grant_support_access(uuid_or_id_or_ids, expiry_timestamp)](#device.grant_support_access) ⇒ None - - [has(uuid_or_id)](#device.has) ⇒ bool - - [has_device_url(uuid_or_id)](#device.has_device_url) ⇒ bool - - [has_lock_override(uuid_or_id)](#device.has_lock_override) ⇒ bool - - [identify(uuid_or_id)](#device.identify) ⇒ None - - [is_in_local_mode(uuid_or_id)](#device.is_in_local_mode) ⇒ bool - - [is_online(uuid_or_id)](#device.is_online) ⇒ bool - - [is_tracking_application_release(uuid_or_id)](#device.is_tracking_application_release) ⇒ bool - - [move(uuid_or_id, app_slug_or_uuid_or_id)](#device.move) ⇒ None - - [pin_to_os_release(uuid_or_id, target_os_version)](#device.pin_to_os_release) ⇒ None - - [pin_to_release(uuid_or_id, full_release_hash_or_id)](#device.pin_to_release) ⇒ None - - [pin_to_supervisor_release(uuid_or_id, supervisor_version_or_id)](#device.pin_to_supervisor_release) ⇒ None - - [ping(uuid_or_id)](#device.ping) ⇒ None - - [purge(uuid_or_id)](#device.purge) ⇒ None - - [reboot(uuid_or_id, force)](#device.reboot) ⇒ None - - [register(application_slug_or_uuid_or_id, uuid, device_type_slug)](#device.register) ⇒ RegisterResponse - - [remove(uuid_or_id_or_ids)](#device.remove) ⇒ None - - [rename(uuid_or_id, new_name)](#device.rename) ⇒ None - - [restart_application(uuid_or_id)](#device.restart_application) ⇒ None - - [restart_service(uuid_or_id, image_id)](#device.restart_service) ⇒ None - - [revoke_support_access(uuid_or_id_or_ids)](#device.revoke_support_access) ⇒ None - - [set_custom_location(uuid_or_id_or_ids, location)](#device.set_custom_location) ⇒ None - - [set_note(uuid_or_id_or_ids, note)](#device.set_note) ⇒ None - - [shutdown(uuid_or_id, force)](#device.shutdown) ⇒ None - - [start_application(uuid_or_id)](#device.start_application) ⇒ None - - [start_os_update(uuid_or_id, target_os_version)](#device.start_os_update) ⇒ HUPStatusResponse - - [start_service(uuid_or_id, image_id)](#device.start_service) ⇒ None - - [stop_application(uuid_or_id)](#device.stop_application) ⇒ None - - [stop_service(uuid_or_id, image_id)](#device.stop_service) ⇒ None - - [track_application_release(uuid_or_id_or_ids)](#device.track_application_release) ⇒ None - - [unset_custom_location(uuid_or_id_or_ids)](#device.unset_custom_location) ⇒ None - - [update(uuid_or_id, force)](#device.update) ⇒ None - - [.tags](#devicetag) - - [get(uuid_or_id, tag_key)](#devicetag.get) ⇒ Optional[str] - - [get_all(options)](#devicetag.get_all) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#devicetag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_device(uuid_or_id, options)](#devicetag.get_all_by_device) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(uuid_or_id, tag_key)](#devicetag.remove) ⇒ None - - [set(uuid_or_id, tag_key, value)](#devicetag.set) ⇒ None - - [.config_var](#deviceconfigvariable) - - [get(uuid_or_id, env_var_name)](#deviceconfigvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceconfigvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceconfigvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, key)](#deviceconfigvariable.remove) ⇒ None - - [set(uuid_or_id, env_var_name, value)](#deviceconfigvariable.set) ⇒ None - - [.env_var](#deviceenvvariable) - - [get(uuid_or_id, env_var_name)](#deviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceenvvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, key)](#deviceenvvariable.remove) ⇒ None - - [set(uuid_or_id, env_var_name, value)](#deviceenvvariable.set) ⇒ None - - [.service_var](#deviceserviceenvvariable) - - [get(uuid_or_id, service_name_or_id, key)](#deviceserviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceserviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceserviceenvvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, service_name_or_id, key)](#deviceserviceenvvariable.remove) ⇒ None - - [set(uuid_or_id, service_name_or_id, key, value)](#deviceserviceenvvariable.set) ⇒ None - - [.history](#devicehistory) - - [get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options)](#devicehistory.get_all_by_application) ⇒ [List[DeviceHistoryType]](#devicehistorytype) - - [get_all_by_device(uuid_or_id, from_date, to_date, options)](#devicehistory.get_all_by_device) ⇒ [List[DeviceHistoryType]](#devicehistorytype) - - [.device_type](#devicetype) - - [get(id_or_slug, options)](#devicetype.get) ⇒ [DeviceTypeType](#devicetypetype) - - [get_all(options)](#devicetype.get_all) ⇒ [List[DeviceTypeType]](#devicetypetype) - - [get_all_supported(options)](#devicetype.get_all_supported) ⇒ None - - [get_by_slug_or_name(slug_or_name, options)](#devicetype.get_by_slug_or_name) ⇒ [DeviceTypeType](#devicetypetype) - - [get_name(slug)](#devicetype.get_name) ⇒ str - - [get_slug_by_name(name)](#devicetype.get_slug_by_name) ⇒ str - - [.api_key](#apikey) - - [create(name, description, expiry_date)](#apikey.create) ⇒ str - - [get_all(options)](#apikey.get_all) ⇒ [List[APIKeyType]](#apikeytype) - - [get_all_named_user_api_keys(options)](#apikey.get_all_named_user_api_keys) ⇒ [List[APIKeyType]](#apikeytype) - - [get_device_api_keys_by_device(uuid_or_id, options)](#apikey.get_device_api_keys_by_device) ⇒ [List[APIKeyType]](#apikeytype) - - [get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options)](#apikey.get_provisioning_api_keys_by_application) ⇒ [List[APIKeyType]](#apikeytype) - - [revoke(id)](#apikey.revoke) ⇒ None - - [update(id, api_key_info)](#apikey.update) ⇒ None - - [.key](#key) - - [create(title, key)](#key.create) ⇒ [SSHKeyType](#sshkeytype) - - [get(id)](#key.get) ⇒ [SSHKeyType](#sshkeytype) - - [get_all(options)](#key.get_all) ⇒ [List[SSHKeyType]](#sshkeytype) - - [remove(id)](#key.remove) ⇒ None - - [.organization](#organization) - - [create(name, handle, logo_image)](#organization.create) ⇒ [OrganizationType](#organizationtype) - - [get(handle_or_id, options)](#organization.get) ⇒ [OrganizationType](#organizationtype) - - [get_all(options)](#organization.get_all) ⇒ [List[OrganizationType]](#organizationtype) - - [remove(handle_or_id)](#organization.remove) ⇒ None - - [.membership](#organizationmembership) - - [get(membership_id, options)](#organizationmembership.get) ⇒ [OrganizationMembershipType](#organizationmembershiptype) - - [get_all(options)](#organizationmembership.get_all) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) - - [get_all_by_organization(handle_or_id, options)](#organizationmembership.get_all_by_organization) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) - - [.tags](#organizationmembershiptag) - - [get(membership_id, tag_key)](#organizationmembershiptag.get) ⇒ Optional[str] - - [get_all(options)](#organizationmembershiptag.get_all) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [get_all_by_organization(handle_or_id, options)](#organizationmembershiptag.get_all_by_organization) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [get_all_by_organization_membership(membership_id, options)](#organizationmembershiptag.get_all_by_organization_membership) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [remove(membership_id, tag_key)](#organizationmembershiptag.remove) ⇒ None - - [set(membership_id, tag_key, value)](#organizationmembershiptag.set) ⇒ None - - [.invite](#organizationinvite) - - [accept(invite_token)](#organizationinvite.accept) ⇒ None - - [create(handle_or_id, invitee, role_name, message)](#organizationinvite.create) ⇒ [OrganizationInviteType](#organizationinvitetype) - - [get_all(options)](#organizationinvite.get_all) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) - - [get_all_by_organization(handle_or_id, options)](#organizationinvite.get_all_by_organization) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) - - [revoke(invite_id)](#organizationinvite.revoke) ⇒ None - - [.os](#deviceos) - - [download(device_type, version, options)](#deviceos.download) ⇒ None - - [get_all_os_versions(device_type, options)](#deviceos.get_all_os_versions) ⇒ None - - [get_available_os_versions(device_type)](#deviceos.get_available_os_versions) ⇒ None - - [get_config(slug_or_uuid_or_id, options)](#deviceos.get_config) ⇒ None - - [get_download_size(device_type, version)](#deviceos.get_download_size) ⇒ float - - [get_max_satisfying_version(device_type, version_or_range, os_type)](#deviceos.get_max_satisfying_version) ⇒ Optional[str] - - [get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options)](#deviceos.get_supervisor_releases_for_cpu_architecture) ⇒ [List[ReleaseType]](#releasetype) - - [get_supported_os_update_versions(device_type, current_version)](#deviceos.get_supported_os_update_versions) ⇒ None - - [is_architecture_compatible_with(os_architecture, application_architecture)](#deviceos.is_architecture_compatible_with) ⇒ None - - [is_supported_os_update(device_type, current_version, target_version)](#deviceos.is_supported_os_update) ⇒ bool - - [.config](#config) - - [get_all()](#config.get_all) ⇒ ConfigType - - [.release](#release) - - [create_from_url(slug_or_uuid_or_id, url, flatten_tarball)](#release.create_from_url) ⇒ int - - [finalize(commit_or_id_or_raw_version)](#release.finalize) ⇒ None - - [get(commit_or_id_or_raw_version, options)](#release.get) ⇒ [ReleaseType](#releasetype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#release.get_all_by_application) ⇒ [List[ReleaseType]](#releasetype) - - [get_latest_by_application(slug_or_uuid_or_id, options)](#release.get_latest_by_application) ⇒ [Optional[ReleaseType]](#releasetype) - - [get_with_image_details(commit_or_id_or_raw_version, image_options, release_options)](#release.get_with_image_details) ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) - - [set_is_invalidated(commit_or_id_or_raw_version, is_invalidated)](#release.set_is_invalidated) ⇒ None - - [set_known_issue_list(commit_or_id_or_raw_version, known_issue_list)](#release.set_known_issue_list) ⇒ None - - [set_note(commit_or_id_or_raw_version, note)](#release.set_note) ⇒ None - - [set_release_version(commit_or_id, semver)](#release.set_release_version) ⇒ None - - [.tags](#releasetag) - - [get(commit_or_id_or_raw_version, tag_key)](#releasetag.get) ⇒ Optional[str] - - [get_all(options)](#releasetag.get_all) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#releasetag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_release(commit_or_id_or_raw_version, options)](#releasetag.get_all_by_release) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(commit_or_id_or_raw_version, tag_key)](#releasetag.remove) ⇒ None - - [set(commit_or_id_or_raw_version, tag_key, value)](#releasetag.set) ⇒ None - - [.service](#service) - - [get_all_by_application(slug_or_uuid_or_id, options)](#service.get_all_by_application) ⇒ [List[ServiceType]](#servicetype) - - [.var](#serviceenvvariable) - - [get(service_id_or_natural_key, key)](#serviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#serviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_service(service_id_or_natural_key, options)](#serviceenvvariable.get_all_by_service) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(service_id_or_natural_key, key)](#serviceenvvariable.remove) ⇒ None - - [set(service_id_or_natural_key, key, value)](#serviceenvvariable.set) ⇒ None - - [.image](#image) - - [get(id, options)](#image.get) ⇒ [ImageType](#imagetype) - - [get_logs(id)](#image.get_logs) ⇒ str - - [.auth](#auth) - - [authenticate()](#auth.authenticate) ⇒ str - - [get_actor_id()](#auth.get_actor_id) ⇒ int - - [get_token()](#auth.get_token) ⇒ Optional[str] - - [get_user_info()](#auth.get_user_info) ⇒ UserInfo - - [is_logged_in()](#auth.is_logged_in) ⇒ bool - - [login()](#auth.login) ⇒ None - - [login_with_token(token)](#auth.login_with_token) ⇒ None - - [logout()](#auth.logout) ⇒ None - - [register()](#auth.register) ⇒ str - - [whoami()](#auth.whoami) ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] - - [.two_factor](#twofactorauth) - - [challenge(code)](#twofactorauth.challenge) ⇒ None - - [disable(password)](#twofactorauth.disable) ⇒ str - - [enable(code)](#twofactorauth.enable) ⇒ str - - [get_setup_key()](#twofactorauth.get_setup_key) ⇒ str - - [is_enabled()](#twofactorauth.is_enabled) ⇒ bool - - [is_passed()](#twofactorauth.is_passed) ⇒ bool - - [verify(code)](#twofactorauth.verify) ⇒ str - - [.logs](#logs) - - [history(uuid_or_id, count)](#logs.history) ⇒ List[Log] - - [stop()](#logs.stop) ⇒ None - - [subscribe(uuid_or_id, callback, error, count)](#logs.subscribe) ⇒ None - - [unsubscribe(uuid_or_id)](#logs.unsubscribe) ⇒ None - - [unsubscribe_all()](#logs.unsubscribe_all) ⇒ None - - [.settings](#module) - - [.types](#types) - -## Models +# Models This module implements all models for balena python SDK. -## Application +# Application This class implements application model for balena python SDK. - - -### Function: create(name, device_type, organization, application_class) ⇒ [TypeApplication](#typeapplication) +## create Create an application. -#### Args: +**Signature:** `balena.models.application.create(name, device_type, organization, application_class)` ⇒ [TypeApplication](#typeapplication) + +**Args:** name (str): application name. device_type (str): device type (slug). organization (Union[str, int]): handle or id of the organization that the application will belong to. application_class (Optional[Literal["app", "fleet", "block"]]): application class. -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.create('foo', 'raspberry-pi', 12345) >>> balena.models.application.create('foo', 'raspberry-pi', 12345, 'block') ``` - -### Function: disable_device_urls(slug_or_uuid_or_id) ⇒ None +## disable_device_urls Disable device urls for all devices that belong to an application. -#### Args: +**Signature:** `balena.models.application.disable_device_urls(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.disable_device_urls(5685) ``` - -### Function: enable_device_urls(slug_or_uuid_or_id) ⇒ None +## enable_device_urls Enable device urls for all devices that belong to an application -#### Args: +**Signature:** `balena.models.application.enable_device_urls(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.enable_device_urls(5685) ``` - -### Function: generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date) ⇒ str +## generate_provisioning_key Generate a device provisioning key for a specific application. -#### Args: +**Signature:** `balena.models.application.generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date)` ⇒ str + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) key_name (Optional[str]): provisioning key name. description (Optional[str]): description for provisioning key. expiry_date (Optional[str]): expiry date for provisioning key, for example: `2030-01-01T00:00:00Z`. -#### Returns: +**Returns:** str: device provisioning key. -#### Examples: +**Examples:** ```python >>> balena.models.application.generate_provisioning_key(5685) ``` - -### Function: get(slug_or_uuid_or_id, options, context) ⇒ [TypeApplication](#typeapplication) +## get Get a single application. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, options, context)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get("myorganization/myapp") >>> balena.models.application.get(123) ``` - -### Function: get_all(options, context) ⇒ [List[TypeApplication]](#typeapplication) +## get_all Get all applications -#### Args: +**Signature:** `balena.models.application.get_all(options, context)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all() ``` - -### Function: get_all_by_organization(org_handle_or_id, options) ⇒ [List[TypeApplication]](#typeapplication) +## get_all_by_organization Get all applications of an organization. -#### Args: +**Signature:** `balena.models.application.get_all_by_organization(org_handle_or_id, options)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** org_handle_or_id (Union[str, int]): handle or id of the organization. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all_by_organization('myorg') ``` - -### Function: get_all_directly_accessible(options) ⇒ [List[TypeApplication]](#typeapplication) +## get_all_directly_accessible Get all applications directly accessible by the user -#### Args: +**Signature:** `balena.models.application.get_all_directly_accessible(options)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[APIKeyType]: user API key -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all_directly_accessible() ``` - -### Function: get_by_name(app_name, options, context) ⇒ [TypeApplication](#typeapplication) +## get_by_name Get a single application using the appname. -#### Args: +**Signature:** `balena.models.application.get_by_name(app_name, options, context)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get("myapp") ``` - -### Function: get_dashboard_url(app_id) ⇒ str +## get_dashboard_url Get Dashboard URL for a specific application. -#### Args: +**Signature:** `balena.models.application.get_dashboard_url(app_id)` ⇒ str + +**Args:** app_id (int): application id. -#### Returns: +**Returns:** str: Dashboard URL for the specific application. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_dashboard_url(1476418) ``` - -### Function: get_directly_accessible(slug_or_uuid_or_id, options) ⇒ [TypeApplication](#typeapplication) +## get_directly_accessible Get a single application directly accessible by the user -#### Args: +**Signature:** `balena.models.application.get_directly_accessible(slug_or_uuid_or_id, options)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_directly_accessible("myorganization/myapp") >>> balena.models.application.get_directly_accessible(123) ``` - -### Function: get_id(slug_or_uuid_or_id) ⇒ int +## get_id Given an application slug or uuid or id, returns it numeric id. -#### Args: +**Signature:** `balena.models.application.get_id(slug_or_uuid_or_id)` ⇒ int + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** int: The id. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_dashboard_url(1476418) ``` - -### Function: get_target_release_hash(slug_or_uuid_or_id) ⇒ Optional[str] +## get_target_release_hash Get the hash of the current release for a specific application. -#### Args: +**Signature:** `balena.models.application.get_target_release_hash(slug_or_uuid_or_id)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** Optional[str]: The release hash of the current release or None. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_target_release_hash(5685) ``` - -### Function: get_with_device_service_details(slug_or_uuid_or_id, options) ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) +## get_with_device_service_details This method does not map exactly to the underlying model: it runs a larger prebuilt query, and reformats it into an easy to use and understand format. If you want more control, or to see the raw model directly, use `application.get(uuidOrId, options)` instead. -#### Args: +**Signature:** `balena.models.application.get_with_device_service_details(slug_or_uuid_or_id, options)` ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_with_device_service_details('my_org_handle/my_app_name') ``` - -### Function: grant_support_access(slug_or_uuid_or_id, expiry_timestamp) ⇒ None +## grant_support_access Grant support access to an application until a specified time. -#### Args: +**Signature:** `balena.models.application.grant_support_access(slug_or_uuid_or_id, expiry_timestamp)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Examples: +**Examples:** ```python >>> balena.models.application.grant_support_access(5685, 1511974999000) ``` - -### Function: has(slug_or_uuid_or_id) ⇒ bool +## has Check if an application exists. -#### Args: +**Signature:** `balena.models.application.has(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** bool: True if application exists, False otherwise. -#### Examples: +**Examples:** ```python >>> balena.models.application.has('my_org/foo') ``` - -### Function: has_any() ⇒ bool +## has_any Check if the user has any applications. -#### Returns: +**Signature:** `balena.models.application.has_any()` ⇒ bool + +**Returns:** bool: True if user has any applications, False otherwise. -#### Examples: +**Examples:** ```python >>> balena.models.application.has_any() ``` - -### Function: is_tracking_latest_release(slug_or_uuid_or_id) ⇒ bool +## is_tracking_latest_release Get whether the application is up to date and is tracking the latest finalized release for updates -#### Args: +**Signature:** `balena.models.application.is_tracking_latest_release(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Returns: +**Returns:** bool: is tracking the latest release. -#### Examples: +**Examples:** ```python >>> balena.models.application.is_tracking_latest_release(5685) ``` - -### Function: pin_to_release(slug_or_uuid_or_id, full_release_hash) ⇒ None +## pin_to_release Configures the application to run a particular release and not get updated when the latest release changes. -#### Args: +**Signature:** `balena.models.application.pin_to_release(slug_or_uuid_or_id, full_release_hash)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). full_release_hash (str) : the hash of a successful release (string) -#### Examples: +**Examples:** ```python >>> balena.models.application.set_to_release(5685, '7dba4e0c461215374edad74a5b78f470b894b5b7') ``` - -### Function: purge(app_id) ⇒ None +## purge Purge devices by application id -#### Args: +**Signature:** `balena.models.application.purge(app_id)` ⇒ None + +**Args:** app_id (int): application id (number) -#### Examples: +**Examples:** ```python >>> balena.models.application.purge(5685) ``` - -### Function: reboot(app_id, options) ⇒ None +## reboot Reboots devices by application id -#### Args: +**Signature:** `balena.models.application.reboot(app_id, options)` ⇒ None + +**Args:** app_id (int): application id (number) options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python >>> balena.models.application.reboot(5685) >>> balena.models.application.reboot(5685, {"force": True}) ``` - -### Function: remove(slug_or_uuid_or_id) ⇒ None +## remove Remove application. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.remove('my_org/my_app') >>> balena.models.application.remove('c184556293854781aea71b0bdae10e45') >>> balena.models.application.remove(123) ``` - -### Function: rename(slug_or_uuid_or_id, new_name) ⇒ None +## rename Rename application. -#### Args: +**Signature:** `balena.models.application.rename(slug_or_uuid_or_id, new_name)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). new_name (str): new application name. -#### Examples: +**Examples:** ```python >>> balena.models.application.rename(1681618, 'py-test-app') ``` - -### Function: restart(slug_or_uuid_or_id) ⇒ None +## restart Restart application. -#### Args: +**Signature:** `balena.models.application.restart(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.restart('myorg/RPI1') ``` - -### Function: revoke_support_access(slug_or_uuid_or_id) ⇒ None +## revoke_support_access Revoke support access to an application. -#### Args: +**Signature:** `balena.models.application.revoke_support_access(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.revoke_support_access(5685) ``` - -### Function: shutdown(app_id, options) ⇒ None +## shutdown Shutdown devices by application id -#### Args: +**Signature:** `balena.models.application.shutdown(app_id, options)` ⇒ None + +**Args:** app_id (int): application id (number) options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python >>> balena.models.application.shutdown(5685) >>> balena.models.application.shutdown(5685, {"force": True}) ``` - -### Function: track_latest_release(slug_or_uuid_or_id) ⇒ None +## track_latest_release Configure a specific application to track the latest available release. -#### Args: +**Signature:** `balena.models.application.track_latest_release(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Examples: +**Examples:** ```python >>> balena.models.application.track_latest_release(5685) ``` - -### Function: will_track_new_releases(slug_or_uuid_or_id) ⇒ bool +## will_track_new_releases Get whether the application is configured to receive updates whenever a new release is available. -#### Args: +**Signature:** `balena.models.application.will_track_new_releases(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Returns: +**Returns:** bool: is tracking the latest release. -#### Examples: +**Examples:** ```python >>> balena.models.application.will_track_new_releases(5685) ``` -## ApplicationTag -This class implements application tag model for balena python SDK. +# ApplicationTag - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +This class implements application tag model for balena python SDK. +## get_all_by_application Get all application tags for an application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.get_all_by_application(1005160) ``` - -### Function: remove(slug_or_uuid_or_id, tag_key) ⇒ None +## remove Remove an application tag. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, tag_key)` ⇒ None + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.remove(1005767, 'tag1') ``` - -### Function: set(slug_or_uuid_or_id, tag_key, value) ⇒ None +## set Set an application tag (update tag value if it exists). -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, tag_key, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) tag_key (str): tag key. value (str): tag value. -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.set(1005767, 'tag1', 'Python SDK') ``` -## ApplicationConfigVariable -This class implements application config variable model for balena python SDK. +# ApplicationConfigVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements application config variable model for balena python SDK. +## get Get application config variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all application config variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application config variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.get_all_by_application(9020) ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an application config variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.remove(2184, 'test_env') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific application config variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env', 'testing1') ``` -## ApplicationEnvVariable -This class implements application environment variable model for balena python SDK. +# ApplicationEnvVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements application environment variable model for balena python SDK. +## get Get application environment variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all application environment variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.get_all_by_application(9020) >>> balena.models.application.env_var.get_all_by_application("myorg/myslug") ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an application environment variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.remove(2184,'test_env4') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific application environment variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') ``` -## BuildEnvVariable -This class implements build environment variable model for balena python SDK. +# BuildEnvVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements build environment variable model for balena python SDK. +## get Get build environment variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all build environment variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: build environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.get_all_by_application(9020) >>> balena.models.application.build_var.get_all_by_application("myorg/myslug") ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an build environment variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.remove(2184, 'test_env4') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific build environment variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') ``` -## ApplicationMembership -This class implements application membership model for balena python SDK. +# ApplicationMembership - -### Function: change_role(membership_id, role_name) ⇒ None +This class implements application membership model for balena python SDK. +## change_role Changes the role of an application member. -#### Args: +**Signature:** `balena.models.application.change_role(membership_id, role_name)` ⇒ None + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` numeric pair of the membership role_name (str): the role name to be granted to the membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.change_role(55074, 'observer') ``` - -### Function: create(slug_or_uuid_or_id, username, role_name) ⇒ [ApplicationMembershipType](#applicationmembershiptype) +## create Creates a new membership for an application. -#### Args: +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, username, role_name)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). username (str): the username of the balena user that will become a member. role_name (Optional[str]): the role name to be granted to the membership. -#### Returns: +**Returns:** ApplicationMembershipType: application membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.create(1681618, 'testuser') ``` - -### Function: get(membership_id, options) ⇒ [ApplicationMembershipType](#applicationmembershiptype) +## get Get a single application membership. -#### Args: +**Signature:** `balena.models.application.get(membership_id, options)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` numeric pair of the membership options (AnyObject): extra pine options to use -#### Returns: +**Returns:** ApplicationMembershipType: application membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get(55074) >>> balena.models.application.membership.get({"user": 123, "is_member_of__application": 125}) ``` - -### Function: get_all(options) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) +## get_all Get all application memberships. -#### Args: +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationMembershipType]: list contains info of application memberships. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) +## get_all_by_application Get all memberships by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: list contains info of application memberships. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get_all_by_application(1681618) ``` - -### Function: remove(membership_id) ⇒ None +## remove Remove a membership. -#### Args: +**Signature:** `balena.models.application.remove(membership_id)` ⇒ None + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` -## ApplicationInvite -This class implements application invite model for balena python SDK. +# ApplicationInvite - -### Function: accept(invite_token) ⇒ None +This class implements application invite model for balena python SDK. +## accept Accepts an invite. -#### Args: +**Signature:** `balena.models.application.accept(invite_token)` ⇒ None + +**Args:** invite_token (str): invitationToken - invite token. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.accept("qwerty-invitation-token") ``` - -### Function: create(slug_or_uuid_or_id, options) ⇒ [ApplicationInviteType](#applicationinvitetype) +## create Creates a new invite for an application. -#### Args: +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, options)` ⇒ [ApplicationInviteType](#applicationinvitetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (ApplicationInviteOptions): Application Invite options dict to use. invitee (str): the email/balena_username of the invitee. @@ -1157,200 +941,212 @@ Creates a new invite for an application. One of "observer", "developer", "operator". Defaults to "developer" message (Optional[str]): the message to send along with the invite. -#### Returns: +**Returns:** dict: application invite. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.create(1681618, 'invitee@example.org', 'developer', 'Test invite') ``` - -### Function: get_all(options) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) +## get_all Get all invites. -#### Args: +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) +## get_all_by_application Get all invites by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.get_all_by_application(1681618) ``` - -### Function: revoke(invite_id) ⇒ None +## revoke Revoke an invite. -#### Args: +**Signature:** `balena.models.application.revoke(invite_id)` ⇒ None + +**Args:** invite_id (int): application invite id. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.revoke(5860) ``` -## Device -This class implements device model for balena python SDK. +# Device - -### Function: deactivate(uuid_or_id_or_ids) ⇒ None +This class implements device model for balena python SDK. +## deactivate Deactivates a device. -#### Args: +**Signature:** `balena.models.device.deactivate(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.deactivate('44cc9d1861b9f992808c506276e5d31c') >>> balena.models.device.deactivate([123, 234]) ``` - -### Function: disable_device_url(uuid_or_id_or_ids) ⇒ None +## disable_device_url Disable device url for a device. -#### Args: +**Signature:** `balena.models.device.disable_device_url(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Examples: +**Examples:** ```python >>> balena.models.device.disable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.disable_device_url([123, 345]) ``` - -### Function: disable_local_mode(uuid_or_id) ⇒ None +## disable_local_mode Disable local mode. -#### Args: +**Signature:** `balena.models.device.disable_local_mode(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** None. -#### Examples: +**Examples:** ```python >>> balena.models.device.disable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: disable_lock_override(uuid_or_id) ⇒ None +## disable_lock_override Disable lock override. -#### Args: +**Signature:** `balena.models.device.disable_lock_override(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: enable_device_url(uuid_or_id_or_ids) ⇒ None +## enable_device_url Enable device url for a device. -#### Args: +**Signature:** `balena.models.device.enable_device_url(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Examples: +**Examples:** ```python >>> balena.models.device.enable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.enable_device_url([123, 345]) ``` - -### Function: enable_local_mode(uuid_or_id) ⇒ None +## enable_local_mode Enable local mode. -#### Args: +**Signature:** `balena.models.device.enable_local_mode(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python >>> balena.models.device.enable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: enable_lock_override(uuid_or_id) ⇒ None +## enable_lock_override Enable lock override. -#### Args: +**Signature:** `balena.models.device.enable_lock_override(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: generate_device_key(uuid_or_id, name, description, expiry_date) ⇒ str +## generate_device_key Generate a device key. -#### Args: +**Signature:** `balena.models.device.generate_device_key(uuid_or_id, name, description, expiry_date)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) name (Optional[str]): device key name. description (Optional[str]): description for device key. expiry_date (Optional[str]): expiry date for device key, for example: `2030-01-01T00:00:00Z`. -#### Examples: +**Examples:** ```python >>> balena.models.device.generate_device_key('df0926d8a5cf4293a1b3742c98a500a1') ``` - -### Function: generate_uuid() ⇒ str +## generate_uuid Generate a random device UUID. -#### Returns: +**Signature:** `balena.models.device.generate_uuid()` ⇒ str + +**Returns:** str: a generated UUID. -#### Examples: +**Examples:** ```python >>> balena.models.device.generate_uuid() ``` - -### Function: get(uuid_or_id, options) ⇒ [TypeDevice](#typedevice) +## get This method returns a single device by id or uuid. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, options)` ⇒ [TypeDevice](#typedevice) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeDevice: device info. -#### Examples: +**Examples:** ```python >>> balena.models.device.get('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') >>> balena.models.device.get('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.get(12345) ``` - -### Function: get_all(options) ⇒ [List[TypeDevice]](#typedevice) +## get_all This method returns all devices that the current user can access. In order to have the following computed properties in the result @@ -1359,640 +1155,686 @@ you have to explicitly define them in a `$select` in the extra options: - overall_progress - is_frozen -#### Args: +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[TypeDevice]](#typedevice) + +** Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[TypeDevice]](#typedevice) +## get_all_by_application Get devices by application slug, uuid or id. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all_by_application('my_org/RPI1') ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[TypeDevice]](#typedevice) +## get_all_by_organization Get devices by organization slug, uuid or id. -#### Args: +**Signature:** `balena.models.device.get_all_by_organization(handle_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all_by_organization('my_org') >>> balena.models.device.get_all_by_organization(123) ``` - -### Function: get_application_info(uuid_or_id) ⇒ Any +## get_application_info ***Deprecated*** Return information about the application running on the device. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.get_application_info(uuid_or_id)` ⇒ Any + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains application information. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_application_info('7f66ec3c5da146c3b6a84aaed1c07581') ``` - -### Function: get_application_name(uuid_or_id) ⇒ str +## get_application_name Get application name by device uuid. -#### Args: +**Signature:** `balena.models.device.get_application_name(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: application name. - -### Function: get_by_name(name, options) ⇒ [List[TypeDevice]](#typedevice) +## get_by_name Get devices by device name. -#### Args: +**Signature:** `balena.models.device.get_by_name(name, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** name (str): device name. -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_by_name('floral-mountain') ``` - -### Function: get_dashboard_url(uuid) ⇒ None +## get_dashboard_url Get balena Dashboard URL for a specific device. -#### Args: +**Signature:** `balena.models.device.get_dashboard_url(uuid)` ⇒ None + +**Args:** uuid (str): device uuid. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_dashboard_url('19619a6317072b65a240b451f45f855d') ``` - -### Function: get_device_url(uuid_or_id) ⇒ str +## get_device_url Get a device url for a device. -#### Args: +**Signature:** `balena.models.device.get_device_url(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python >>> balena.models.device.get_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: get_local_ip_address(uuid_or_id) ⇒ List[str] +## get_local_ip_address Get the local IP addresses of a device. -#### Args: +**Signature:** `balena.models.device.get_local_ip_address(uuid_or_id)` ⇒ List[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** List[str]: IP addresses of a device. - -### Function: get_local_mode_support(uuid_or_id) ⇒ LocalModeResponse +## get_local_mode_support Returns whether local mode is supported and a message describing the reason why local mode is not supported. -#### Args: +**Signature:** `balena.models.device.get_local_mode_support(uuid_or_id)` ⇒ LocalModeResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** dict: local mode support information ({'supported': True/False, 'message': '...'}). -#### Examples: +**Examples:** ```python >>> balena.models.device.get_local_mode_support('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_mac_address(uuid_or_id) ⇒ List[str] +## get_mac_address Get the MAC addresses of a device. -#### Args: +**Signature:** `balena.models.device.get_mac_address(uuid_or_id)` ⇒ List[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** List[str]: MAC addresses of a device. - -### Function: get_metrics(uuid_or_id) ⇒ [DeviceMetricsType](#devicemetricstype) +## get_metrics Gets the metrics related information for a device. -#### Args: +**Signature:** `balena.models.device.get_metrics(uuid_or_id)` ⇒ [DeviceMetricsType](#devicemetricstype) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** dict: metrics of the device. - -### Function: get_name(uuid_or_id) ⇒ str +## get_name Get device name by device uuid. -#### Args: +**Signature:** `balena.models.device.get_name(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: device name. - -### Function: get_os_update_status(uuid_or_id) ⇒ HUPStatusResponse +## get_os_update_status ***Deprecated*** Get the OS update status of a device. -#### Args: +**Signature:** `balena.models.device.get_os_update_status(uuid_or_id)` ⇒ HUPStatusResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** HUPStatusResponse: action response. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_os_update_status('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_status(uuid_or_id) ⇒ str +## get_status Get the status of a device. -#### Args: +**Signature:** `balena.models.device.get_status(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: status of a device. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_status('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: get_supervisor_state(uuid_or_id) ⇒ SupervisorStateType +## get_supervisor_state Get the supervisor state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_state(uuid_or_id)` ⇒ SupervisorStateType + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Returns: +**Returns:** dict: supervisor state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_state('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_supervisor_target_state(uuid_or_id) ⇒ Any +## get_supervisor_target_state Get the supervisor target state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_target_state(uuid_or_id)` ⇒ Any + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int). -#### Returns: +**Returns:** DeviceStateType: supervisor target state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_target_state('b6070f4fea5edf808b576123157fe5ec') ``` - -### Function: get_supervisor_target_state_for_app(slug_or_uuid_or_id, release) ⇒ Any +## get_supervisor_target_state_for_app Get the supervisor target state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_target_state_for_app(slug_or_uuid_or_id, release)` ⇒ Any + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) release (Optional[Union[str, int]]): (optional) release uuid (default tracked) -#### Returns: +**Returns:** DeviceStateType: supervisor target state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_target_state_for_app('myorg/myapp') ``` - -### Function: get_with_service_details(uuid_or_id, options) ⇒ [TypeDeviceWithServices](#typedevicewithservices) +## get_with_service_details This method does not map exactly to the underlying model: it runs a larger prebuilt query, and reformats it into an easy to use and understand format. If you want more control, or to see the raw model directly, use `device.get(uuidOrId, options)` instead. -#### Args: +**Signature:** `balena.models.device.get_with_service_details(uuid_or_id, options)` ⇒ [TypeDeviceWithServices](#typedevicewithservices) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** dict: device info with associated services details. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_with_service_details('0fcd753af396247e035de53b4e43eec3') ``` - -### Function: grant_support_access(uuid_or_id_or_ids, expiry_timestamp) ⇒ None +## grant_support_access Grant support access to a device until a specified time. -#### Args: +**Signature:** `balena.models.device.grant_support_access(uuid_or_id_or_ids, expiry_timestamp)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Examples: +**Examples:** ```python >>> balena.models.device.grant_support_access('49b2a76e8a8d4a2b918c08a23b423580', 1511974999000) ``` - -### Function: has(uuid_or_id) ⇒ bool +## has Check if a device exists. -#### Args: +**Signature:** `balena.models.device.has(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if device exists, False otherwise. - -### Function: has_device_url(uuid_or_id) ⇒ bool +## has_device_url Check if a device is web accessible with device urls -#### Args: +**Signature:** `balena.models.device.has_device_url(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python >>> balena.models.device.has_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: has_lock_override(uuid_or_id) ⇒ bool +## has_lock_override Check if a device has the lock override enabled. -#### Args: +**Signature:** `balena.models.device.has_lock_override(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: lock override status. - -### Function: identify(uuid_or_id) ⇒ None +## identify Identify device. -#### Args: +**Signature:** `balena.models.device.identify(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python >>> balena.models.device.identify('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: is_in_local_mode(uuid_or_id) ⇒ bool +## is_in_local_mode Check if local mode is enabled on the device. -#### Args: +**Signature:** `balena.models.device.is_in_local_mode(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if local mode enabled, otherwise False. -#### Examples: +**Examples:** ```python >>> balena.models.device.is_in_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: is_online(uuid_or_id) ⇒ bool +## is_online Check if a device is online. -#### Args: +**Signature:** `balena.models.device.is_online(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if the device is online, False otherwise. - -### Function: is_tracking_application_release(uuid_or_id) ⇒ bool +## is_tracking_application_release Get whether the device is configured to track the current application release. -#### Args: +**Signature:** `balena.models.device.is_tracking_application_release(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: is tracking the current application release. - -### Function: move(uuid_or_id, app_slug_or_uuid_or_id) ⇒ None +## move Move a device to another application. -#### Args: +**Signature:** `balena.models.device.move(uuid_or_id, app_slug_or_uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int). app_slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.device.move(123, 'RPI1Test') ``` - -### Function: pin_to_os_release(uuid_or_id, target_os_version) ⇒ None +## pin_to_os_release Mark a specific device to be updated to a particular OS release -#### Args: +**Signature:** `balena.models.device.pin_to_os_release(uuid_or_id, target_os_version)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). target_os_version (str): semver-compatible version for the target device. Unsupported (unpublished) version will result in rejection. The version **must** be the exact version number, a "prod" variant and greater or equal to the one running on the device. -#### Examples: +**Examples:** ```python >>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') >>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') ``` - -### Function: pin_to_release(uuid_or_id, full_release_hash_or_id) ⇒ None +## pin_to_release Configures the device to run a particular release and not get updated when the current application release changes. -#### Args: +**Signature:** `balena.models.device.pin_to_release(uuid_or_id, full_release_hash_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) full_release_hash_or_id (Union[str, int]) : the hash of a successful release (string) or id (number) -#### Examples: +**Examples:** ```python >>> balena.models.device.pin_to_release('49b2a', '45c90004de73557ded7274d4896a6db90ea61e36') ``` - -### Function: pin_to_supervisor_release(uuid_or_id, supervisor_version_or_id) ⇒ None +## pin_to_supervisor_release Set a specific device to run a particular supervisor release. -#### Args: +**Signature:** `balena.models.device.pin_to_supervisor_release(uuid_or_id, supervisor_version_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) supervisor_version_or_id (Union[str, int]): the version of a released supervisor (string) or id (number) -#### Examples: +**Examples:** ```python >>> balena.models.device.pin_to_supervisor_release('f55dcdd9ada04b11b4d05c1f1c3b4e72', 'v13.0.0') ``` - -### Function: ping(uuid_or_id) ⇒ None +## ping Ping a device. This is useful to signal that the supervisor is alive and responding. -#### Args: +**Signature:** `balena.models.device.ping(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python >>> balena.models.device.ping('8f66ec7335dd4a97b7661faa131b1502') >>> balena.models.device.ping(1234) ``` - -### Function: purge(uuid_or_id) ⇒ None +## purge Purge device. This function clears the user application's `/data` directory. -#### Args: +**Signature:** `balena.models.device.purge(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python >>> balena.models.device.purge('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: reboot(uuid_or_id, force) ⇒ None +## reboot Reboot the device. -#### Args: +**Signature:** `balena.models.device.reboot(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python >>> balena.models.device.reboot('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: register(application_slug_or_uuid_or_id, uuid, device_type_slug) ⇒ RegisterResponse +## register Register a new device with a balena application. -#### Args: +**Signature:** `balena.models.device.register(application_slug_or_uuid_or_id, uuid, device_type_slug)` ⇒ RegisterResponse + +**Args:** application_slug_or_uuid_or_id (Union[int, str]): application slug (string), uuid (string) or id (number). uuid (str): device uuid. device_type_slug (Optional[str]): device type slug or alias. -#### Returns: +**Returns:** dict: dictionary contains device info. -#### Examples: +**Examples:** ```python >>> device_uuid = balena.models.device.generate_uuid() >>> balena.models.device.register('RPI1',device_uuid) ``` - -### Function: remove(uuid_or_id_or_ids) ⇒ None +## remove Remove device(s). -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) - -### Function: rename(uuid_or_id, new_name) ⇒ None +## rename Renames a device. -#### Args: +**Signature:** `balena.models.device.rename(uuid_or_id, new_name)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int) new_name (str): device new name. -#### Examples: +**Examples:** ```python >>> balena.models.device.rename(123, 'python-sdk-test-device') ``` - -### Function: restart_application(uuid_or_id) ⇒ None +## restart_application This function restarts the Docker container running the application on the device, but doesn't reboot the device itself. -#### Args: +**Signature:** `balena.models.device.restart_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python >>> balena.models.device.restart_application('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.restart_application(1234) ``` - -### Function: restart_service(uuid_or_id, image_id) ⇒ None +## restart_service Restart a service on device. -#### Args: +**Signature:** `balena.models.device.restart_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to restart -#### Examples: +**Examples:** ```python >>> balena.models.device.restart_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) >>> balena.models.device.restart_service(None, 392229) # if running on the device ``` - -### Function: revoke_support_access(uuid_or_id_or_ids) ⇒ None +## revoke_support_access Revoke support access to a device. -#### Args: +**Signature:** `balena.models.device.revoke_support_access(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.revoke_support_access('49b2a76e8a8d4a2b918c08a23b423580') ``` - -### Function: set_custom_location(uuid_or_id_or_ids, location) ⇒ None +## set_custom_location Set a custom location for a device. -#### Args: +**Signature:** `balena.models.device.set_custom_location(uuid_or_id_or_ids, location)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) location (dict): device custom location { 'latitude': Union[int,, str], 'longitude': Union[int, str]}. -#### Examples: +**Examples:** ```python >>> balena.models.device.set_custom_location(123, {'latitude': '21.032777','longitude': '105.831586'}) ``` - -### Function: set_note(uuid_or_id_or_ids, note) ⇒ None +## set_note Note a device. -#### Args: +**Signature:** `balena.models.device.set_note(uuid_or_id_or_ids, note)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) note (str): device note. -#### Examples: +**Examples:** ```python >>> balena.models.device.note(123, 'test note') ``` - -### Function: shutdown(uuid_or_id, force) ⇒ None +## shutdown Shutdown the device. -#### Args: +**Signature:** `balena.models.device.shutdown(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python >>> balena.models.device.shutdown('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: start_application(uuid_or_id) ⇒ None +## start_application ***Deprecated*** Starts a user application container, usually after it has been stopped with `stop_application()`. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.start_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains started application container id. -#### Examples: +**Examples:** ```python >>> balena.models.device.start_application('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: start_os_update(uuid_or_id, target_os_version) ⇒ HUPStatusResponse +## start_os_update Start an OS update on a device. If using run_detached option, monitor progress with device.get() -- status, provisioning_state and provisioning_progress entries. -#### Args: +**Signature:** `balena.models.device.start_os_update(uuid_or_id, target_os_version)` ⇒ HUPStatusResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). target_os_version (str): semver-compatible version for the target device. Unsupported (unpublished) version will result in rejection. @@ -2001,32 +1843,32 @@ status, provisioning_state and provisioning_progress entries. run_detached (Optional[bool]): run the update in detached mode. Default behaviour is run_detached=True for more reliable updates. -#### Returns: +**Returns:** HUPStatusResponse: action response. -#### Examples: +**Examples:** ```python >>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') >>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') ``` - -### Function: start_service(uuid_or_id, image_id) ⇒ None +## start_service Start a service on device. -#### Args: +**Signature:** `balena.models.device.start_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to start -#### Examples: +**Examples:** ```python >>> balena.models.device.start_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 1234) >>> balena.models.device.start_service(None, 1234) # if running on the device ``` - -### Function: stop_application(uuid_or_id) ⇒ None +## stop_application ***Deprecated*** Temporarily stops a user application container. @@ -2034,438 +1876,466 @@ Application container will not be removed after invoking this function and a reboot or supervisor restart will cause the container to start again. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.stop_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains stopped application container id. -#### Examples: +**Examples:** ```python >>> balena.models.device.stop_application('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: stop_service(uuid_or_id, image_id) ⇒ None +## stop_service Stop a service on device. -#### Args: +**Signature:** `balena.models.device.stop_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to stop -#### Examples: +**Examples:** ```python >>> balena.models.device.stop_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) >>> balena.models.device.stop_service(None, 392229) # if running on the device ``` - -### Function: track_application_release(uuid_or_id_or_ids) ⇒ None +## track_application_release Configure a specific device to track the current application release. -#### Args: +**Signature:** `balena.models.device.track_application_release(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) - -### Function: unset_custom_location(uuid_or_id_or_ids) ⇒ None +## unset_custom_location Clear the custom location of a device. -#### Args: +**Signature:** `balena.models.device.unset_custom_location(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.unset_custom_location(123) ``` - -### Function: update(uuid_or_id, force) ⇒ None +## update update the device. -#### Args: +**Signature:** `balena.models.device.update(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python >>> balena.models.device.update('8f66ec7335dd4a97b7661faa131b1502') ``` -## DeviceTag -This class implements device tag model for balena python SDK. +# DeviceTag - -### Function: get(uuid_or_id, tag_key) ⇒ Optional[str] +This class implements device tag model for balena python SDK. +## get Get a device tag (update tag value if it exists). ___Note___: Notice that when using the device ID rather than UUID, it will avoid one extra API roundtrip. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, tag_key)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. -#### Returns: +**Returns:** Optional[str]: tag value -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get('f5213eac0d63ac4', 'testtag') ``` - -### Function: get_all(options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all Get all device tags. -#### Args: +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_application Get all device tags for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all_by_application(1005160) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_device Get all device tags for a device. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all_by_device('a03ab646ca5a4f11b4d05c1f1c3b4e72') ``` - -### Function: remove(uuid_or_id, tag_key) ⇒ None +## remove Remove a device tag. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, tag_key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.remove('f5213eac0d63ac477', 'testtag') ``` - -### Function: set(uuid_or_id, tag_key, value) ⇒ None +## set Set a device tag (update tag value if it exists). ___Note___: Notice that when using the device ID rather than UUID, it will avoid one extra API roundtrip. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, tag_key, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test1') >>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test2') ``` -## DeviceConfigVariable -This class implements device config variable model for balena python SDK. +# DeviceConfigVariable - -### Function: get(uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements device config variable model for balena python SDK. +## get Get a device config variable. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device config variables for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: list of device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.get_all_by_application(5780) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device config variables belong to a device. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device config variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.get_all_by_device('f5213eac574a4fba8b9e32ab3a9cba12') ``` - -### Function: remove(uuid_or_id, key) ⇒ None +## remove Remove a device environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.remove(2184, 'test_env4') ``` - -### Function: set(uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a device config variable. Note that config variables must start with BALENA_ and RESIN_ prefixes. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','BALENA_test_env4', 'testing1') ``` -## DeviceEnvVariable -This class implements device environment variable model for balena python SDK. +# DeviceEnvVariable - -### Function: get(uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements device environment variable model for balena python SDK. +## get Get device environment variable. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device environment variables for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: list of device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.get_all_by_application(5780) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device environment variables. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.get_all_by_device('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: remove(uuid_or_id, key) ⇒ None +## remove Remove a device environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.remove(2184, 'test_env4') ``` - -### Function: set(uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific environment variable. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4', 'testing1') ``` -## DeviceServiceEnvVariable -This class implements device service variable model for balena python SDK. +# DeviceServiceEnvVariable - -### Function: get(uuid_or_id, service_name_or_id, key) ⇒ Optional[str] +This class implements device service variable model for balena python SDK. +## get Get the overriden value of a service variable on a device -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, service_name_or_id, key)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name -#### Returns: +**Returns:** Optional[str]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'myservice', 'VAR') >>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 1234', 'VAR') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device service environment variables belong to an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get_all_by_application(1043050) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device environment variables. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get_all_by_device(8deb12a) ``` - -### Function: remove(uuid_or_id, service_name_or_id, key) ⇒ None +## remove Remove a device service environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, service_name_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR') >>> balena.models.device.service_var.remove('7cf02a6a016a4b3c9e3b7a8d5f46e127', 28970, 'VAR') ``` - -### Function: set(uuid_or_id, service_name_or_id, key, value) ⇒ None +## set Set the overriden value of a service variable on a device. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, service_name_or_id, key, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name value (str): variable value -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR', 'override') >>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 123, 'VAR', 'override') ``` -## DeviceHistory -This class implements device history model for balena python SDK. +# DeviceHistory - -### Function: get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options) ⇒ [List[DeviceHistoryType]](#devicehistorytype) +This class implements device history model for balena python SDK. +## get_all_by_application Get all device history entries for an application. -#### Args: +**Signature:** `balena.models.history.get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago to_date (datetime): history entries younger or equal to this date. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[DeviceHistoryType]: device history entries. -#### Examples: +**Examples:** ```python >>> balena.models.device.history.get_all_by_application('myorg/myapp') >>> balena.models.device.history.get_all_by_application(11196426) @@ -2479,21 +2349,22 @@ Get all device history entries for an application. ... ) ``` - -### Function: get_all_by_device(uuid_or_id, from_date, to_date, options) ⇒ [List[DeviceHistoryType]](#devicehistorytype) +## get_all_by_device Get all device history entries for a device. -#### Args: +**Signature:** `balena.models.history.get_all_by_device(uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** uuid_or_id (str): device uuid (32 / 62 digits string) or id (number) __note__: No short IDs supported from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago to_date (datetime): history entries younger or equal to this date. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[DeviceHistoryType]: device history entries. -#### Examples: +**Examples:** ```python >>> balena.models.device.history.get_all_by_device('6046335305c8142883a4466d30abe211') >>> balena.models.device.history.get_all_by_device(11196426) @@ -2506,538 +2377,574 @@ Get all device history entries for a device. ... to_date=from_date = datetime.utcnow() + timedelta(days=-5)) ... ) ``` -## DeviceType -This class implements user API key model for balena python SDK. +# DeviceType - -### Function: get(id_or_slug, options) ⇒ [DeviceTypeType](#devicetypetype) +This class implements user API key model for balena python SDK. +## get Get a single device type. -#### Args: +**Signature:** `balena.models.device_type.get(id_or_slug, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** id_or_slug (Union[str, int]): device type slug or alias (string) or id (int). options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** DeviceTypeType: Returns the device type - -### Function: get_all(options) ⇒ [List[DeviceTypeType]](#devicetypetype) +## get_all Get all device types. -#### Args: +**Signature:** `balena.models.device_type.get_all(options)` ⇒ [List[DeviceTypeType]](#devicetypetype) + +**Args:** options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[DeviceTypeType]: list contains info of device types. - -### Function: get_all_supported(options) ⇒ None +## get_all_supported Get all supported device types. -#### Args: +**Signature:** `balena.models.device_type.get_all_supported(options)` ⇒ None + +**Args:** options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[DeviceTypeType]: list contains info of all supported device types. - -### Function: get_by_slug_or_name(slug_or_name, options) ⇒ [DeviceTypeType](#devicetypetype) +## get_by_slug_or_name Get a single device type by slug or name. -#### Args: +**Signature:** `balena.models.device_type.get_by_slug_or_name(slug_or_name, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** slug_or_name (str): device type slug or name. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** DeviceTypeType: Returns the device type - -### Function: get_name(slug) ⇒ str +## get_name Get display name for a device. -#### Args: +**Signature:** `balena.models.device_type.get_name(slug)` ⇒ str + +**Args:** slug (str): device type slug. - -### Function: get_slug_by_name(name) ⇒ str +## get_slug_by_name Get device slug. -#### Args: +**Signature:** `balena.models.device_type.get_slug_by_name(name)` ⇒ str + +**Args:** name (str): device type name. -## ApiKey -This class implements user API key model for balena python SDK. +# ApiKey - -### Function: create(name, description, expiry_date) ⇒ str +This class implements user API key model for balena python SDK. +## create This method registers a new api key for the current user with the name given. -#### Args: +**Signature:** `balena.models.api_key.create(name, description, expiry_date)` ⇒ str + +**Args:** name (str): the API key name description (Optional[str]): the API key description expiry_date (Optional[str]): the API key expiring date -#### Returns: +**Returns:** str: API key -#### Examples: +**Examples:** ```python >>> balena.models.api_key.create_api_key("myApiKey") >>> balena.models.api_key.create_api_key("myApiKey", "my api key description") >>> balena.models.api_key.create_api_key("myApiKey", "my descr", datetime.datetime.utcnow().isoformat()) ``` - -### Function: get_all(options) ⇒ [List[APIKeyType]](#apikeytype) +## get_all This function gets all API keys. -#### Args: +**Signature:** `balena.models.api_key.get_all(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[APIKeyType]: user API key -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_all() ``` - -### Function: get_all_named_user_api_keys(options) ⇒ [List[APIKeyType]](#apikeytype) +## get_all_named_user_api_keys Get all named user API keys of the current user. -#### Args: +**Signature:** `balena.models.api_key.get_all_named_user_api_keys(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_all_named_user_api_keys() ``` - -### Function: get_device_api_keys_by_device(uuid_or_id, options) ⇒ [List[APIKeyType]](#apikeytype) +## get_device_api_keys_by_device Get all API keys for a device. -#### Args: +**Signature:** `balena.models.api_key.get_device_api_keys_by_device(uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** device_uuid (Union[str, int]): device, uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_device_api_keys_by_device("44cc9d186") >>> balena.models.api_key.get_device_api_keys_by_device(1111386) ``` - -### Function: get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options) ⇒ [List[APIKeyType]](#apikeytype) +## get_provisioning_api_keys_by_application Get all provisioning API keys for an application. -#### Args: +**Signature:** `balena.models.api_key.get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_provisioning_api_keys_by_application(1296047) >>> balena.models.api_key.get_provisioning_api_keys_by_application("myorg/myapp") ``` - -### Function: revoke(id) ⇒ None +## revoke This function revokes an API key. -#### Args: +**Signature:** `balena.models.api_key.revoke(id)` ⇒ None + +**Args:** id (int): API key id. -#### Examples: +**Examples:** ```python >>> balena.models.api_key.revoke(1296047) ``` - -### Function: update(id, api_key_info) ⇒ None +## update This function updates details of an API key. -#### Args: +**Signature:** `balena.models.api_key.update(id, api_key_info)` ⇒ None + +**Args:** id (str): API key id. api_key_info (APIKeyInfoType): new API key info. -#### Examples: +**Examples:** ```python >>> balena.models.api_key.update(1296047, {"name":"new name"}) ``` -## Key -This class implements ssh key model for balena python SDK. +# Key - -### Function: create(title, key) ⇒ [SSHKeyType](#sshkeytype) +This class implements ssh key model for balena python SDK. +## create Create a ssh key. -#### Args: +**Signature:** `balena.models.key.create(title, key)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** title (str): key title. key (str): the public ssh key. -#### Returns: +**Returns:** SSHKeyType: new ssh key id. - -### Function: get(id) ⇒ [SSHKeyType](#sshkeytype) +## get Get a single ssh key. -#### Args: +**Signature:** `balena.models.key.get(id)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** id (int): key id. -#### Returns: +**Returns:** SSHKeyType: ssh key info. - -### Function: get_all(options) ⇒ [List[SSHKeyType]](#sshkeytype) +## get_all Get all ssh keys. -#### Args: +**Signature:** `balena.models.key.get_all(options)` ⇒ [List[SSHKeyType]](#sshkeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[SSHKeyType]: list of ssh keys. - -### Function: remove(id) ⇒ None +## remove Remove a ssh key. -#### Args: +**Signature:** `balena.models.key.remove(id)` ⇒ None + +**Args:** id (int): key id. -## Organization -This class implements organization model for balena python SDK. +# Organization - -### Function: create(name, handle, logo_image) ⇒ [OrganizationType](#organizationtype) +This class implements organization model for balena python SDK. +## create Creates a new organization. -#### Args: +**Signature:** `balena.models.organization.create(name, handle, logo_image)` ⇒ [OrganizationType](#organizationtype) + +**Args:** name (str): the name of the organization that will be created. handle (Optional[str]): The handle of the organization that will be created. logo_image (Optional[io.BufferedReader]): The organization logo to be used. -#### Returns: +**Returns:** dict: organization info. -#### Examples: +**Examples:** ```python >>> balena.models.organization.create('My Org', 'test_org') >>> with open('mypath/myfile.png', 'rb') as f: >>> org = sdk.models.organization.create("my-name", None, f) ``` - -### Function: get(handle_or_id, options) ⇒ [OrganizationType](#organizationtype) +## get Get a single organization. -#### Args: +**Signature:** `balena.models.organization.get(handle_or_id, options)` ⇒ [OrganizationType](#organizationtype) + +**Args:** handle_or_id (str): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** dict: organization info. -#### Raises: +**Raises:** OrganizationNotFound: if organization couldn't be found. -#### Examples: +**Examples:** ```python >>> balena.models.organization.get(26474) >>> balena.models.organization.get('myorg') ``` - -### Function: get_all(options) ⇒ [List[OrganizationType]](#organizationtype) +## get_all Get all organizations. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationType]](#organizationtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationType]: list contains information of organizations. -#### Examples: +**Examples:** ```python >>> balena.models.organization.get_all() ``` - -### Function: remove(handle_or_id) ⇒ None +## remove Remove an organization. -#### Args: +**Signature:** `balena.models.organization.remove(handle_or_id)` ⇒ None + +**Args:** handle_or_id (str): organization handle (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.organization.remove(148003) ``` -## OrganizationMembership -This class implements organization membership model for balena python SDK. +# OrganizationMembership - -### Function: get(membership_id, options) ⇒ [OrganizationMembershipType](#organizationmembershiptype) +This class implements organization membership model for balena python SDK. +## get Get a single organization membership. -#### Args: +**Signature:** `balena.models.organization.get(membership_id, options)` ⇒ [OrganizationMembershipType](#organizationmembershiptype) + +**Args:** membership_id (ResourceKey): the id (int) or an object with the unique `user` & `is_member_of__organization` numeric pair of the membership options (AnyObject): extra pine options to use -#### Returns: +**Returns:** Organization membership. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.get(17608) ``` - -### Function: get_all(options) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) +## get_all Get all organization memberships. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipType]: organization memberships. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) +## get_all_by_organization Get all memberships by organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipType]: organization memberships. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.get_all_by_organization(3014) ``` -## OrganizationMembershipTag -This class implements organization membership tag model for balena python SDK. +# OrganizationMembershipTag - -### Function: get(membership_id, tag_key) ⇒ Optional[str] +This class implements organization membership tag model for balena python SDK. +## get Get an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.get(membership_id, tag_key)` ⇒ Optional[str] + +**Args:** membership_id: organization membership id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get(17608, 'mTag1') ``` - -### Function: get_all(options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all Get all organization membership tags. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all_by_organization Get all organization membership tags for an organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipTagType]: organization membership tags. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all_by_organization(3014) ``` - -### Function: get_all_by_organization_membership(membership_id, options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all_by_organization_membership Get all organization membership tags for a memberships of an organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization_membership(membership_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** membership_id (int): organization membership id. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: organization membership tags. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all_by_organization_membership(17608) ``` - -### Function: remove(membership_id, tag_key) ⇒ None +## remove Remove an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.remove(membership_id, tag_key)` ⇒ None + +**Args:** membership_id: organization membership id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.remove(17608, 'mTag1') ``` - -### Function: set(membership_id, tag_key, value) ⇒ None +## set Set an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.set(membership_id, tag_key, value)` ⇒ None + +**Args:** membership_id: organization membership id. tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.set(17608, 'mTag1', 'Python SDK') ``` -## OrganizationInvite -This class implements organization invite model for balena python SDK. +# OrganizationInvite - -### Function: accept(invite_token) ⇒ None +This class implements organization invite model for balena python SDK. +## accept Accepts an invite. -#### Args: +**Signature:** `balena.models.organization.accept(invite_token)` ⇒ None + +**Args:** invite_token (str): invitation Token - invite token. - -### Function: create(handle_or_id, invitee, role_name, message) ⇒ [OrganizationInviteType](#organizationinvitetype) +## create Creates a new invite for an organization. -#### Args: +**Signature:** `balena.models.organization.create(handle_or_id, invitee, role_name, message)` ⇒ [OrganizationInviteType](#organizationinvitetype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string), or id (number). invitee (str): the email/balena_username of the invitee. role_name (Optional[str]): the role name to be granted to the invitee. message (Optional[str]): the message to send along with the invite. -#### Returns: +**Returns:** OrganizationInviteType: organization invite. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.create(26474, 'invitee@example.org', 'member', 'Test invite') ``` - -### Function: get_all(options) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) +## get_all Get all invites. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) +## get_all_by_organization Get all invites by organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string), or id (number). options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[OrganizationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.get_all_by_organization(26474) ``` - -### Function: revoke(invite_id) ⇒ None +## revoke Revoke an invite. -#### Args: +**Signature:** `balena.models.organization.revoke(invite_id)` ⇒ None + +**Args:** invite_id (int): organization invite id. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.revoke(2862) ``` -## DeviceOs -This class implements device os model for balena python SDK. +# DeviceOs - -### Function: download(device_type, version, options) ⇒ None +This class implements device os model for balena python SDK. +## download Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.download(device_type, version, options)` ⇒ None + +**Args:** device_type (str): device type slug. version (str): semver-compatible version or 'latest', defaults to 'latest'. * The version **must** be the exact version number. options (DownloadConfig): OS configuration options to use. -#### Returns: +**Returns:** float: OS image download size, in bytes. Example: @@ -3049,35 +2956,38 @@ Example: ... f.write(chunk) ``` - -### Function: get_all_os_versions(device_type, options) ⇒ None +## get_all_os_versions Get all OS versions for the provided device type(s), inlcuding invalidated ones -#### Args: +**Signature:** `balena.models.os.get_all_os_versions(device_type, options)` ⇒ None + +**Args:** device_type (Union[str, List[str]]): device type slug. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: balenaOS versions. - -### Function: get_available_os_versions(device_type) ⇒ None +## get_available_os_versions Get the supported OS versions for the provided device type(s) -#### Args: +**Signature:** `balena.models.os.get_available_os_versions(device_type)` ⇒ None + +**Args:** device_type (Union[str, List[str]]): device type slug. -#### Returns: +**Returns:** list: balenaOS versions. - -### Function: get_config(slug_or_uuid_or_id, options) ⇒ None +## get_config Download application config.json. -#### Args: +**Signature:** `balena.models.os.get_config(slug_or_uuid_or_id, options)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (ImgConfigOptions): OS configuration dict to use. The available options are listed below: @@ -3095,31 +3005,33 @@ Download application config.json. version (str): Required: the OS version of the image. developmentMode (Optional[bool]): If the device should be in development mode. -#### Returns: +**Returns:** dict: application config.json content. -#### Raises: +**Raises:** ApplicationNotFound: if application couldn't be found. - -### Function: get_download_size(device_type, version) ⇒ float +## get_download_size Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.get_download_size(device_type, version)` ⇒ float + +**Args:** device_type (str): device type slug. version (str): semver-compatible version or 'latest', defaults to 'latest'. * The version **must** be the exact version number. -#### Returns: +**Returns:** float: OS image download size, in bytes. - -### Function: get_max_satisfying_version(device_type, version_or_range, os_type) ⇒ Optional[str] +## get_max_satisfying_version Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.get_max_satisfying_version(device_type, version_or_range, os_type)` ⇒ Optional[str] + +**Args:** device_type (str): device type slug. version_or_range (str): can be one of the exact version number, in which case it is returned if the version is supported, @@ -3136,19 +3048,20 @@ Get OS download size estimate. Currently only the raw (uncompressed) size is rep Defaults to `'latest'` os_type (Optional[Literal["default", "esr"]]): The used OS type. -#### Returns: +**Returns:** float: OS image download size, in bytes. - -### Function: get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options) ⇒ [List[ReleaseType]](#releasetype) +## get_supervisor_releases_for_cpu_architecture Returns the Releases of the supervisor for the CPU Architecture -#### Args: +**Signature:** `balena.models.os.get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** cpu_architecture_slug_or_id (Union[str, int]): The slug (string) or id (number) for the CPU Architecture. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** ReleaseType: release info. @@ -3159,463 +3072,496 @@ Example: { $filter: { raw_version: '12.11.0' } }, ); - -### Function: get_supported_os_update_versions(device_type, current_version) ⇒ None +## get_supported_os_update_versions Get OS supported versions. -#### Args: +**Signature:** `balena.models.os.get_supported_os_update_versions(device_type, current_version)` ⇒ None + +**Args:** device_type (str): device type slug. current_version (str): device type slug. - -### Function: is_architecture_compatible_with(os_architecture, application_architecture) ⇒ None +## is_architecture_compatible_with Returns whether the specified OS architecture is compatible with the target architecture. -#### Args: +**Signature:** `balena.models.os.is_architecture_compatible_with(os_architecture, application_architecture)` ⇒ None + +**Args:** os_architecture (str): The OS's architecture as specified in its device type. application_architecture (str): The application's architecture as specified in its device type. -#### Returns: +**Returns:** bool: Whether the specified OS architecture is capable of running applications build for the target architecture. - -### Function: is_supported_os_update(device_type, current_version, target_version) ⇒ bool +## is_supported_os_update Returns the supported OS update targets for the provided device type. -#### Args: +**Signature:** `balena.models.os.is_supported_os_update(device_type, current_version, target_version)` ⇒ bool + +**Args:** device_type (str): device type slug. current_version (str): emver-compatible version for the starting OS version target_version (str): semver-compatible version for the target OS version -## Config -This class implements configuration model for balena python SDK. +# Config - -### Function: get_all() ⇒ ConfigType +This class implements configuration model for balena python SDK. +## get_all Get all configuration. -#### Returns: +**Signature:** `balena.models.config.get_all()` ⇒ ConfigType + +**Returns:** ConfigType: configuration information. -#### Examples: +**Examples:** ```python >>> balena.models.config.get_all() ``` -## Release -This class implements release model for balena python SDK. +# Release - -### Function: create_from_url(slug_or_uuid_or_id, url, flatten_tarball) ⇒ int +This class implements release model for balena python SDK. +## create_from_url Create a new release built from the source in the provided url. -#### Args: +**Signature:** `balena.models.release.create_from_url(slug_or_uuid_or_id, url, flatten_tarball)` ⇒ int + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). url (str): a url with a tarball of the project to build. flatten_tarball (bool): Should be true when the tarball includes an extra root folder with all the content. -#### Returns: +**Returns:** int: release Id. - -### Function: finalize(commit_or_id_or_raw_version) ⇒ None +## finalize Finalizes a draft release. -#### Args: +**Signature:** `balena.models.release.finalize(commit_or_id_or_raw_version)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) - -### Function: get(commit_or_id_or_raw_version, options) ⇒ [ReleaseType](#releasetype) +## get Get a specific release. -#### Args: +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, options)` ⇒ [ReleaseType](#releasetype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or id (number) or an object with the unique `application` (number or string) & `rawVersion` (string) pair of the release options options(AnyObject): extra pine options to use -#### Returns: +**Returns:** ReleaseType: release info. - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ReleaseType]](#releasetype) +## get_all_by_application Get all releases from an application. -#### Args: +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ReleaseType]: release info. - -### Function: get_latest_by_application(slug_or_uuid_or_id, options) ⇒ [Optional[ReleaseType]](#releasetype) +## get_latest_by_application Get the latest successful release for an application. -#### Args: +**Signature:** `balena.models.release.get_latest_by_application(slug_or_uuid_or_id, options)` ⇒ [Optional[ReleaseType]](#releasetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** Optional[ReleaseType]: release info. - -### Function: get_with_image_details(commit_or_id_or_raw_version, image_options, release_options) ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) +## get_with_image_details Get a specific release with the details of the images built. -#### Args: +**Signature:** `balena.models.release.get_with_image_details(commit_or_id_or_raw_version, image_options, release_options)` ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) image_options (AnyObject): extra pine options to use on image expand release_options (AnyObject): extra pine options to use on release expand -#### Returns: +**Returns:** dict: release info. -#### Raises: +**Raises:** ReleaseNotFound: if release couldn't be found. - -### Function: set_is_invalidated(commit_or_id_or_raw_version, is_invalidated) ⇒ None +## set_is_invalidated Set the is_invalidated property of a release to True or False. -#### Args: +**Signature:** `balena.models.release.set_is_invalidated(commit_or_id_or_raw_version, is_invalidated)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) is_invalidated (bool): True for invalidated, False for validated. - -### Function: set_known_issue_list(commit_or_id_or_raw_version, known_issue_list) ⇒ None +## set_known_issue_list Set a known issue list for a release. -#### Args: +**Signature:** `balena.models.release.set_known_issue_list(commit_or_id_or_raw_version, known_issue_list)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) known_issue_list (Optional[str]): the known issue list. - -### Function: set_note(commit_or_id_or_raw_version, note) ⇒ None +## set_note Set a note for a release. -#### Args: +**Signature:** `balena.models.release.set_note(commit_or_id_or_raw_version, note)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) note (Optional[str]): the note. - -### Function: set_release_version(commit_or_id, semver) ⇒ None +## set_release_version Set a direct semver for a given release. -#### Args: +**Signature:** `balena.models.release.set_release_version(commit_or_id, semver)` ⇒ None + +**Args:** commit_or_id(Union[str, int]): release commit (string) or id (int) semver (str): the version to be released, must be a valid semver -## ReleaseTag -This class implements release tag model for balena python SDK. +# ReleaseTag - -### Function: get(commit_or_id_or_raw_version, tag_key) ⇒ Optional[str] +This class implements release tag model for balena python SDK. +## get Get a single release tag. -#### Args: +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, tag_key)` ⇒ Optional[str] + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get(465307, 'releaseTag1') ``` - -### Function: get_all(options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all Get all release tags. -#### Args: +**Signature:** `balena.models.release.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_application Get all device tags for an application. -#### Args: +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all_by_application(1005160) ``` - -### Function: get_all_by_release(commit_or_id_or_raw_version, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_release Get all release tags for a release. -#### Args: +**Signature:** `balena.models.release.get_all_by_release(commit_or_id_or_raw_version, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all_by_release(135) ``` - -### Function: remove(commit_or_id_or_raw_version, tag_key) ⇒ None +## remove Remove a release tag. -#### Args: +**Signature:** `balena.models.release.remove(commit_or_id_or_raw_version, tag_key)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.remove(135, 'releaseTag1') ``` - -### Function: set(commit_or_id_or_raw_version, tag_key, value) ⇒ None +## set Set a release tag (update tag value if it exists). -#### Args: +**Signature:** `balena.models.release.set(commit_or_id_or_raw_version, tag_key, value)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.set(465307, 'releaseTag1', 'Python SDK') ``` -## Service -This class implements service model for balena python SDK. +# Service - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ServiceType]](#servicetype) +This class implements service model for balena python SDK. +## get_all_by_application Get all services from an application. -#### Args: +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ServiceType]](#servicetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ServiceType]: service info. -## ServiceEnvVariable -This class implements Service environment variable model for balena python SDK. +# ServiceEnvVariable - -### Function: get(service_id_or_natural_key, key) ⇒ Optional[str] +This class implements Service environment variable model for balena python SDK. +## get Get the value of a specific service variable -#### Args: +**Signature:** `balena.models.service.get(service_id_or_natural_key, key)` ⇒ Optional[str] + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get(1234,'test_env4') >>> balena.models.service.var.get({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all service variables by application. -#### Args: +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get_all_by_application(9020) >>> balena.models.service.var.get_all_by_application("myorg/myslug") ``` - -### Function: get_all_by_service(service_id_or_natural_key, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_service Get all variables for a service. -#### Args: +**Signature:** `balena.models.service.get_all_by_service(service_id_or_natural_key, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get_all_by_service(1234) >>> balena.models.service.var.get_all_by_service({'application': 'myorg/myapp', 'service_name': 'service'}) ``` - -### Function: remove(service_id_or_natural_key, key) ⇒ None +## remove Clear the value of a specific service variable -#### Args: +**Signature:** `balena.models.service.remove(service_id_or_natural_key, key)` ⇒ None + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.service.var.remove({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') >>> balena.models.service.var.remove(1234,'test_env4') ``` - -### Function: set(service_id_or_natural_key, key, value) ⇒ None +## set Set the value of a specific application environment variable. -#### Args: +**Signature:** `balena.models.service.set(service_id_or_natural_key, key, value)` ⇒ None + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.set({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR', 'value') >>> balena.models.service.var.set(1234,'test_env4', 'value') ``` -## Image -This class implements image model for balena python SDK. +# Image - -### Function: get(id, options) ⇒ [ImageType](#imagetype) +This class implements image model for balena python SDK. +## get Get a specific image. -#### Args: +**Signature:** `balena.models.image.get(id, options)` ⇒ [ImageType](#imagetype) + +**Args:** id (int): image id. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** ImageType: image info. - -### Function: get_logs(id) ⇒ str +## get_logs Get the build log from an image. -#### Args: +**Signature:** `balena.models.image.get_logs(id)` ⇒ str + +**Args:** id (str): image id. -#### Returns: +**Returns:** str: build log. -## Auth -This class implements all authentication functions for balena python SDK. +# Auth - -### Function: authenticate() ⇒ str +This class implements all authentication functions for balena python SDK. +## authenticate This function authenticates provided credentials information. You should use Auth.login when possible, as it takes care of saving the Auth Token and username as well. -#### Args: +**Signature:** `balena.auth.authenticate()` ⇒ str + +**Args:** **credentials: credentials keyword arguments. username (str): Balena username. password (str): Password. -#### Returns: +**Returns:** str: Auth Token, -#### Examples: +**Examples:** ```python >>> balena.auth.authenticate(username='', password='') ``` - -### Function: get_actor_id() ⇒ int +## get_actor_id Get current logged in actor id. -#### Returns: +**Signature:** `balena.auth.get_actor_id()` ⇒ int + +**Returns:** int: actor id -#### Examples: +**Examples:** ```python # If you are logged in. >>> balena.auth.get_actor_id() ``` - -### Function: get_token() ⇒ Optional[str] +## get_token This function retrieves Auth Token. -#### Returns: +**Signature:** `balena.auth.get_token()` ⇒ Optional[str] + +**Returns:** str: Auth Token. -#### Examples: +**Examples:** ```python >>> balena.auth.get_token() ``` - -### Function: get_user_info() ⇒ UserInfo +## get_user_info Get current logged in user's info -#### Returns: +**Signature:** `balena.auth.get_user_info()` ⇒ UserInfo + +**Returns:** UserInfo: user info. -#### Examples: +**Examples:** ```python # If you are logged in as a user. >>> balena.auth.get_user_info() ``` - -### Function: is_logged_in() ⇒ bool +## is_logged_in This function checks if you're logged in -#### Returns: +**Signature:** `balena.auth.is_logged_in()` ⇒ bool + +**Returns:** bool: True if logged in, False otherwise. -#### Examples: +**Examples:** ```python # Check if user logged in. >>> if balena.auth.is_logged_in(): @@ -3624,17 +3570,18 @@ This function checks if you're logged in ... print('You are not logged in!') ``` - -### Function: login() ⇒ None +## login This function is used for logging into balena using email and password. -#### Args: +**Signature:** `balena.auth.login()` ⇒ None + +**Args:** **credentials: credentials keyword arguments. username (str): Balena email. password (str): Password. -#### Examples: +**Examples:** ```python >>> from balena import Balena ... balena = Balena() @@ -3644,19 +3591,20 @@ This function is used for logging into balena using email and password. ... balena.auth.login(username='', password='') ``` - -### Function: login_with_token(token) ⇒ None +## login_with_token This function is used for logging into balena using Auth Token. Auth Token can be found in Preferences section on balena Dashboard. -#### Args: +**Signature:** `balena.auth.login_with_token(token)` ⇒ None + +**Args:** token (str): Auth Token. -#### Returns: +**Returns:** This functions saves Auth Token to Settings and returns nothing. -#### Examples: +**Examples:** ```python >>> from balena import Balena >>> balena = Balena() @@ -3664,63 +3612,67 @@ Auth Token can be found in Preferences section on balena Dashboard. >>> balena.auth.login_with_token(auth_token) ``` - -### Function: logout() ⇒ None +## logout This function is used for logging out from balena. -#### Examples: +**Signature:** `balena.auth.logout()` ⇒ None + +**Examples:** ```python # If you are logged in. >>> balena.auth.logout() ``` - -### Function: register() ⇒ str +## register This function is used for registering to balena. -#### Args: +**Signature:** `balena.auth.register()` ⇒ str + +**Args:** **credentials: credentials keyword arguments. email (str): email to register. password (str): Password. -#### Returns: +**Returns:** str: Auth Token for new account. -#### Examples: +**Examples:** ```python >>> credentials = {'email': '', 'password': ''} >>> balena.auth.register(**credentials) ``` - -### Function: whoami() ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] +## whoami Return current logged in username. -#### Returns: +**Signature:** `balena.auth.whoami()` ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] + +**Returns:** Optional[WhoamiResult]: current logged in information -#### Examples: +**Examples:** ```python >>> balena.auth.whoami() ``` -## TwoFactorAuth -This class implements basic 2FA functionalities for balena python SDK. +# TwoFactorAuth - -### Function: challenge(code) ⇒ None +This class implements basic 2FA functionalities for balena python SDK. +## challenge Challenge two-factor authentication. If your account has two-factor authentication enabled and logging in using credentials, you need to pass two-factor authentication before being allowed to use other functions. -#### Args: +**Signature:** `balena.twofactor_auth.challenge(code)` ⇒ None + +**Args:** code (str): two-factor authentication code. -#### Examples: +**Examples:** ```python # You need to enable two-factor authentication on dashboard first. # Check if two-factor authentication is passed for current session. @@ -3732,146 +3684,158 @@ False True ``` - -### Function: disable(password) ⇒ str +## disable Disable two factor authentication. __Note__: Disable will only work when using a token that has 2FA enabled. -#### Args: +**Signature:** `balena.twofactor_auth.disable(password)` ⇒ str + +**Args:** password (str): password. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.disable('your_password') ``` - -### Function: enable(code) ⇒ str +## enable Enable two factor authentication. -#### Args: +**Signature:** `balena.twofactor_auth.enable(code)` ⇒ str + +**Args:** code (str): two-factor authentication code. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.enable('123456') ``` - -### Function: get_setup_key() ⇒ str +## get_setup_key Retrieves a setup key for enabling two factor authentication. This value should be provided to your 2FA app in order to get a token. This function only works if you disable two-factor authentication or log in using Auth Token from dashboard. -#### Returns: +**Signature:** `balena.twofactor_auth.get_setup_key()` ⇒ str + +**Returns:** str: setup key. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.get_setup_key() ``` - -### Function: is_enabled() ⇒ bool +## is_enabled Check if two-factor authentication is enabled. -#### Returns: +**Signature:** `balena.twofactor_auth.is_enabled()` ⇒ bool + +**Returns:** bool: True if enabled. Otherwise False. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.is_enabled() ``` - -### Function: is_passed() ⇒ bool +## is_passed Check if two-factor authentication challenge was passed. If the user does not have 2FA enabled, this will be True. -#### Returns: +**Signature:** `balena.twofactor_auth.is_passed()` ⇒ bool + +**Returns:** bool: True if passed. Otherwise False. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.is_passed() ``` - -### Function: verify(code) ⇒ str +## verify Verifies two factor authentication. Note that this method not update the token automatically. You should use balena.twofactor_auth.challenge() when possible, as it takes care of that as well. -#### Args: +**Signature:** `balena.twofactor_auth.verify(code)` ⇒ str + +**Args:** code (str): two-factor authentication code. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.verify('123456') ``` -## Logs -This class implements functions that allow processing logs from device. +# Logs - -### Function: history(uuid_or_id, count) ⇒ List[Log] +This class implements functions that allow processing logs from device. +## history Get device logs history. -#### Args: +**Signature:** `balena.logs.history(uuid_or_id, count)` ⇒ List[Log] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. - -### Function: stop() ⇒ None +## stop Will grecefully unsubscribe from all devices and stop the consumer thread. +**Signature:** `balena.logs.stop()` ⇒ None + - -### Function: subscribe(uuid_or_id, callback, error, count) ⇒ None +## subscribe Subscribe to device logs. -#### Args: +**Signature:** `balena.logs.subscribe(uuid_or_id, callback, error, count)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) callback (Callable[[Log], None]): this callback is called on receiving a message. error (Optional[Callable[[Any], None]]): this callback is called on an error event. count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. - -### Function: unsubscribe(uuid_or_id) ⇒ None +## unsubscribe Unsubscribe from device logs for a specific device. -#### Args: +**Signature:** `balena.logs.unsubscribe(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: unsubscribe_all() ⇒ None +## unsubscribe_all Unsubscribe all subscribed devices. -## Settings +**Signature:** `balena.logs.unsubscribe_all()` ⇒ None + + +# Settings Create a module object. The name must be a string; the optional doc argument can have any type. -## Types -### APIKeyInfoType +# Types +## APIKeyInfoType ```python @@ -3883,7 +3847,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### APIKeyType +## APIKeyType ```python @@ -3898,7 +3862,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ActorType +## ActorType ```python @@ -3913,7 +3877,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationHostedOnApplication +## ApplicationHostedOnApplication ```python @@ -3924,7 +3888,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationInviteType +## ApplicationInviteType ```python @@ -3940,7 +3904,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationMembershipRoleType +## ApplicationMembershipRoleType ```python @@ -3951,7 +3915,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationMembershipType +## ApplicationMembershipType ```python @@ -3964,7 +3928,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationType +## ApplicationType ```python @@ -3983,7 +3947,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### BaseTagType +## BaseTagType ```python @@ -3995,7 +3959,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### BasicUserInfoType +## BasicUserInfoType ```python @@ -4006,7 +3970,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### CpuArchitectureType +## CpuArchitectureType ```python @@ -4018,7 +3982,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### CreditBundleType +## CreditBundleType ```python @@ -4038,7 +4002,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceFamilyType +## DeviceFamilyType ```python @@ -4053,7 +4017,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceHistoryType +## DeviceHistoryType ```python @@ -4079,7 +4043,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceManufacturerType +## DeviceManufacturerType ```python @@ -4093,7 +4057,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceMetricsType +## DeviceMetricsType ```python @@ -4111,7 +4075,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceTypeAliasType +## DeviceTypeAliasType ```python @@ -4123,7 +4087,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceTypeType +## DeviceTypeType ```python @@ -4144,7 +4108,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### EnvironmentVariableBase +## EnvironmentVariableBase ```python @@ -4156,7 +4120,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageBasicInfoType +## ImageBasicInfoType ```python @@ -4167,7 +4131,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageInstallType +## ImageInstallType ```python @@ -4183,7 +4147,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageType +## ImageType ```python @@ -4208,7 +4172,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### InviteeType +## InviteeType ```python @@ -4220,7 +4184,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationInviteType +## OrganizationInviteType ```python @@ -4236,7 +4200,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipRoleType +## OrganizationMembershipRoleType ```python @@ -4247,7 +4211,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipTagType +## OrganizationMembershipTagType ```python @@ -4257,7 +4221,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipType +## OrganizationMembershipType ```python @@ -4273,7 +4237,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationPrivateDeviceTypeAccess +## OrganizationPrivateDeviceTypeAccess ```python @@ -4285,7 +4249,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationType +## OrganizationType ```python @@ -4304,7 +4268,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PineDeferred +## PineDeferred ```python @@ -4314,7 +4278,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PublicDeviceType +## PublicDeviceType ```python @@ -4328,7 +4292,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PublicOrganizationType +## PublicOrganizationType ```python @@ -4340,7 +4304,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseImageType +## ReleaseImageType ```python @@ -4353,7 +4317,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseType +## ReleaseType ```python @@ -4399,7 +4363,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseVersion +## ReleaseVersion ```python @@ -4415,7 +4379,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseWithImageDetailsType +## ReleaseWithImageDetailsType ```python @@ -4463,7 +4427,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### SSHKeyType +## SSHKeyType ```python @@ -4477,7 +4441,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ServiceInstanceType +## ServiceInstanceType ```python @@ -4491,7 +4455,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ServiceType +## ServiceType ```python @@ -4507,7 +4471,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamApplicationAccessType +## TeamApplicationAccessType ```python @@ -4520,7 +4484,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamMembershipType +## TeamMembershipType ```python @@ -4533,7 +4497,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamType +## TeamType ```python @@ -4548,7 +4512,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeApplication +## TypeApplication ```python @@ -4590,7 +4554,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeApplicationWithDeviceServiceDetails +## TypeApplicationWithDeviceServiceDetails ```python @@ -4632,7 +4596,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeCurrentService +## TypeCurrentService ```python @@ -4647,7 +4611,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeDevice +## TypeDevice ```python @@ -4713,7 +4677,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeDeviceWithServices +## TypeDeviceWithServices ```python @@ -4780,7 +4744,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeVar +## TypeVar ```python @@ -4790,7 +4754,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypedDict +## TypedDict ```python @@ -4800,7 +4764,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### UserType +## UserType ```python @@ -4817,7 +4781,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### WebResource +## WebResource ```python diff --git a/pages/external-docs/sdk/python-sdk/v10.2.0.md b/pages/external-docs/sdk/python-sdk/v10.2.0.md index 2aa516614e..08a691bc6b 100644 --- a/pages/external-docs/sdk/python-sdk/v10.2.0.md +++ b/pages/external-docs/sdk/python-sdk/v10.2.0.md @@ -25,2962 +25,4773 @@ Getting started: ... ``` +The Balena object can be configured with a dict of type Settings + +```python +balena = Balena({ + "balena_host": "balena-cloud.com", + "api_version": "v7", + "device_actions_endpoint_version": "v1", + "data_directory": "/home/example/.balena", + "image_cache_time": str(1 * 1000 * 60 * 60 * 24 * 7), # 1 week + "token_refresh_interval": str(1 * 1000 * 60 * 60), # 1 hour + "timeout": str(30 * 1000), # request timeout, 30s + "request_limit": str(300), # the number of requests per request_limit_interval that the SDK should respect, defaults to unlimited. + "request_limit_interval": str(60), # the timespan that the request_limit should apply to in seconds, defaults to 60s (1 minute). + "retry_rate_limited_request": False, # awaits and retry once a request is rate limited (429) +}) +``` + +Notice that if you want to change for the staging environment, you could simply do: +balena = Balena({"balena_host": "balena-staging.com"}) + +However, this will overwrite your balena-cloud settings (stored api keys etc). So we recommend using +a different data_directory for each balena-sdk instance, e.g: + +```python +balena_prod = Balena() +balena_staging = Balena({ + "balena_host": "balena-staging.com", + "data_directory": "/home/balena-staging-sdk/.balena", +}) +``` + +In adition, you can also run balena-python-sdk completely in memory, without writing anything to the file system like: + +```python +balena_prod = Balena({"data_directory": False}) +balena_staging = Balena({ + "balena_host": "balena-staging.com", + "data_directory": False +}) +``` + +By default the SDK will throw once a request is Rate limited by the API (with a 429 status code). +A 429 request will contain a header called "retry-after" which informs how long the client should wait before trying a new request. +If you would like the SDK to use this header and wait and automatically retry the request, just do: + +```python +balena = Balena({"retry_rate_limited_request": True}) +``` + If you feel something is missing, not clear or could be improved, [please don't hesitate to open an issue in GitHub](https://github.com/balena-io/balena-sdk-python/issues), we'll be happy to help. -## Table of Contents -- [Balena](#balena) - - [Models](#models) - - [Application](#application) - - [ApiKey](#apikey) - - [Config](#config) - - [ConfigVariable](#configvariable) - - [ApplicationConfigVariable](#applicationconfigvariable) - - [DeviceConfigVariable](#deviceconfigvariable) - - [Device](#device) - - [DeviceOs](#deviceos) - - [EnvironmentVariable](#environmentvariable) - - [ApplicationEnvVariable](#applicationenvvariable) - - [ServiceEnvVariable](#serviceenvvariable) - - [DeviceEnvVariable](#deviceenvvariable) - - [DeviceServiceEnvVariable](#deviceserviceenvvariable) - - [Image](#image) - - [Organization](#organization) - - [Release](#release) - - [Service](#service) - - [Tag](#tag) - - [ApplicationTag](#applicationtag) - - [DeviceTag](#devicetag) - - [ReleaseTag](#releasetag) - - [Key](#key) - - [Supervisor](#supervisor) - - [Auth](#auth) - - [Logs](#logs) - - [Settings](#settings) - - [TwoFactorAuth](#twofactorauth) - -## Models +# Models This module implements all models for balena python SDK. -## Application +# Application This class implements application model for balena python SDK. +## create -The returned objects properties are `__metadata, actor, app_name, application_type, commit, depends_on__application, device_type, id, is_accessible_by_support_until__date, should_track_latest_release, slug, user`. -### Function: create(name, device_type, organization, app_type) +Create an application. -Create an application. This function only works if you log in using credentials or Auth Token. +**Signature:** `balena.models.application.create(name, device_type, organization, application_class)` ⇒ [TypeApplication](#typeapplication) -#### Args: +**Args:** name (str): application name. - device_type (str): device type (display form). - organization (str): handle or id of the organization that the application will belong to. - app_type (Optional[str]): application type. - -#### Returns: - dict: application info. + device_type (str): device type (slug). + organization (Union[str, int]): handle or id of the organization that the application will belong to. + application_class (Optional[Literal["app", "fleet", "block"]]): application class. -#### Raises: - InvalidDeviceType: if device type is not supported. - InvalidApplicationType: if app type is not supported. - InvalidParameter: if organization is missing. - OrganizationNotFound: if organization couldn't be found. +**Returns:** + TypeApplication: application info. -#### Examples: +**Examples:** ```python ->>> balena.models.application.create('foo', 'Raspberry Pi 3', 12345, 'microservices-starter') -'{u'depends_on__application': None, u'should_track_latest_release': True, u'app_name': u'foo', u'application_type': {u'__deferred': {u'uri': u'/resin/application_type(5)'}, u'__id': 5}, u'__metadata': {u'type': u'', u'uri': u'/resin/application(12345)'}, u'is_accessible_by_support_until__date': None, u'actor': 12345, u'id': 12345, u'user': {u'__deferred': {u'uri': u'/resin/user(12345)'}, u'__id': 12345}, u'device_type': u'raspberrypi3', u'commit': None, u'slug': u'my_user/foo'}' +>>> balena.models.application.create('foo', 'raspberry-pi', 12345) +>>> balena.models.application.create('foo', 'raspberry-pi', 12345, 'block') ``` -### Function: disable_device_urls(app_id) + +## disable_device_urls Disable device urls for all devices that belong to an application. -#### Args: - app_id (str): application id. +**Signature:** `balena.models.application.disable_device_urls(slug_or_uuid_or_id)` ⇒ None -#### Returns: - OK/error. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: - >> > balena.models.application.disable_device_urls('5685') - 'OK' -### Function: disable_rolling_updates(app_id) +**Examples:** +```python +>>> balena.models.application.disable_device_urls(5685) +``` -Disable Rolling update on application. +## enable_device_urls -#### Args: - name (str): application id. +Enable device urls for all devices that belong to an application -#### Returns: - OK/error. +**Signature:** `balena.models.application.enable_device_urls(slug_or_uuid_or_id)` ⇒ None -#### Raises: - ApplicationNotFound: if application couldn't be found. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: - >> > balena.models.application.disable_rolling_updates('106640') - 'OK' -### Function: enable_device_urls(app_id) +**Examples:** +```python +>>> balena.models.application.enable_device_urls(5685) +``` -Enable device urls for all devices that belong to an application +## generate_provisioning_key -#### Args: - app_id (str): application id. +Generate a device provisioning key for a specific application. -#### Returns: - OK/error. +**Signature:** `balena.models.application.generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date)` ⇒ str -#### Examples: - >> > balena.models.application.enable_device_urls('5685') - 'OK' -### Function: enable_rolling_updates(app_id) +**Args:** + slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) + key_name (Optional[str]): provisioning key name. + description (Optional[str]): description for provisioning key. + expiry_date (Optional[str]): expiry date for provisioning key, for example: `2030-01-01T00:00:00Z`. -Enable Rolling update on application. +**Returns:** + str: device provisioning key. -#### Args: - app_id (str): application id. +**Examples:** +```python +>>> balena.models.application.generate_provisioning_key(5685) +``` -#### Returns: - OK/error. +## get -#### Raises: - ApplicationNotFound: if application couldn't be found. +Get a single application. -#### Examples: - >> > balena.models.application.enable_rolling_updates('106640') - 'OK' -### Function: generate_provisioning_key(app_id) +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, options, context)` ⇒ [TypeApplication](#typeapplication) -Generate a device provisioning key for a specific application. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use + context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Args: - app_id (str): application id. +**Returns:** + TypeApplication: application info. -#### Returns: - str: device provisioning key. +**Examples:** +```python +>>> balena.models.application.get("myorganization/myapp") +>>> balena.models.application.get(123) +``` -#### Examples: - >> > balena.models.application.generate_provisioning_key('5685') - 'GThZJps91PoJCdzfYqF7glHXzBDGrkr9' -### Function: get(name) +## get_all -Get a single application. +Get all applications -#### Args: - name (str): application name. +**Signature:** `balena.models.application.get_all(options, context)` ⇒ [List[TypeApplication]](#typeapplication) -#### Returns: - dict: application info. +**Args:** + options (AnyObject): extra pine options to use + context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Raises: - ApplicationNotFound: if application couldn't be found. - AmbiguousApplication: when more than one application is returned. +**Returns:** + List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python ->>> balena.models.application.get('foo') -'{u'depends_on__application': None, u'should_track_latest_release': True, u'app_name': u'foo', u'application_type': {u'__deferred': {u'uri': u'/resin/application_type(5)'}, u'__id': 5}, u'__metadata': {u'type': u'', u'uri': u'/resin/application(12345)'}, u'is_accessible_by_support_until__date': None, u'actor': 12345, u'id': 12345, u'user': {u'__deferred': {u'uri': u'/resin/user(12345)'}, u'__id': 12345}, u'device_type': u'raspberrypi3', u'commit': None, u'slug': u'my_user/foo'}' +>>> balena.models.application.get_all() ``` -### Function: get_all() -Get all applications (including collaborator applications). +## get_all_by_organization + +Get all applications of an organization. + +**Signature:** `balena.models.application.get_all_by_organization(org_handle_or_id, options)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** + org_handle_or_id (Union[str, int]): handle or id of the organization. + options (AnyObject): extra pine options to use. -#### Returns: - list: list contains info of applications. +**Returns:** + List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python ->>> balena.models.application.get_all() -'[{u'depends_on__application': None, u'should_track_latest_release': True, u'app_name': u'foo', u'application_type': {u'__deferred': {u'uri': u'/resin/application_type(5)'}, u'__id': 5}, u'__metadata': {u'type': u'', u'uri': u'/resin/application(12345)'}, u'is_accessible_by_support_until__date': None, u'actor': 12345, u'id': 12345, u'user': {u'__deferred': {u'uri': u'/resin/user(12345)'}, u'__id': 12345}, u'device_type': u'raspberrypi3', u'commit': None, u'slug': u'my_user/foo'}, {u'depends_on__application': None, u'should_track_latest_release': True, u'app_name': u'bar', u'application_type': {u'__deferred': {u'uri': u'/resin/application_type(5)'}, u'__id': 5}, u'__metadata': {u'type': u'', u'uri': u'/resin/application(12346)'}, u'is_accessible_by_support_until__date': None, u'actor': 12345, u'id': 12346, u'user': {u'__deferred': {u'uri': u'/resin/user(12345)'}, u'__id': 12345}, u'device_type': u'raspberrypi3', u'commit': None, u'slug': u'my_user/bar'}]' +>>> balena.models.application.get_all_by_organization('myorg') ``` -### Function: get_all_with_device_service_details(expand_release) -Get all applications (including collaborator applications) along with associated services' essential details. +## get_all_directly_accessible -#### Args: - expand_release (Optional[bool]): Set this parameter to True then the commit of service details will be included. +Get all applications directly accessible by the user -#### Returns: - list: list contains info of applications. -### Function: get_by_id(app_id) +**Signature:** `balena.models.application.get_all_directly_accessible(options)` ⇒ [List[TypeApplication]](#typeapplication) -Get a single application by application id. +**Args:** + options (AnyObject): extra pine options to use -#### Args: - app_id (str): application id. +**Returns:** + List[APIKeyType]: user API key -#### Returns: - dict: application info. +**Examples:** +```python +>>> balena.models.application.get_all_directly_accessible() +``` -#### Raises: - ApplicationNotFound: if application couldn't be found. +## get_by_name -#### Examples: + Get a single application using the appname. + +**Signature:** `balena.models.application.get_by_name(app_name, options, context)` ⇒ [TypeApplication](#typeapplication) + +**Args:** + slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use + context (Optional[str]): extra access filters, None or 'directly_accessible' + +**Returns:** + TypeApplication: application info. + +**Examples:** ```python ->>> balena.models.application.get_by_id(12345) -'{u'depends_on__application': None, u'should_track_latest_release': True, u'app_name': u'foo', u'application_type': {u'__deferred': {u'uri': u'/resin/application_type(5)'}, u'__id': 5}, u'__metadata': {u'type': u'', u'uri': u'/resin/application(12345)'}, u'is_accessible_by_support_until__date': None, u'actor': 12345, u'id': 12345, u'user': {u'__deferred': {u'uri': u'/resin/user(12345)'}, u'__id': 12345}, u'device_type': u'raspberrypi3', u'commit': None, u'slug': u'my_user/foo'}' +>>> balena.models.application.get("myapp") ``` -### Function: get_by_owner(name, owner) -Get a single application using the appname and the handle of the owning organization. +## get_dashboard_url -#### Args: - name (str): application name. - owner (str): The handle of the owning organization. +Get Dashboard URL for a specific application. -#### Returns: - dict: application info. +**Signature:** `balena.models.application.get_dashboard_url(app_id)` ⇒ str -#### Raises: - ApplicationNotFound: if application couldn't be found. - AmbiguousApplication: when more than one application is returned. +**Args:** + app_id (int): application id. -#### Examples: +**Returns:** + str: Dashboard URL for the specific application. + +**Examples:** ```python ->>> balena.models.application.get_by_owner('foo', 'my_org') -'{u'depends_on__application': None, u'should_track_latest_release': True, u'app_name': u'foo', u'application_type': {u'__deferred': {u'uri': u'/resin/application_type(5)'}, u'__id': 5}, u'__metadata': {u'type': u'', u'uri': u'/resin/application(12345)'}, u'is_accessible_by_support_until__date': None, u'actor': 12345, u'id': 12345, u'user': {u'__deferred': {u'uri': u'/resin/user(12345)'}, u'__id': 12345}, u'device_type': u'raspberrypi3', u'commit': None, u'slug': u'my_user/foo'}' +>>> balena.models.application.get_dashboard_url(1476418) ``` -### Function: get_config(app_id, version) -Download application config.json. +## get_directly_accessible -#### Args: - app_id (str): application id. - version (str): the OS version of the image. - **options (dict): OS configuration keyword arguments to use. The available options are listed below: - network (Optional[str]): the network type that the device will use, one of 'ethernet' or 'wifi' and defaults to 'ethernet' if not specified. - appUpdatePollInterval (Optional[str]): how often the OS checks for updates, in minutes. - wifiKey (Optional[str]): the key for the wifi network the device will connect to. - wifiSsid (Optional[str]): the ssid for the wifi network the device will connect to. - ip (Optional[str]): static ip address. - gateway (Optional[str]): static ip gateway. - netmask (Optional[str]): static ip netmask. +Get a single application directly accessible by the user -#### Returns: - dict: application config.json content. +**Signature:** `balena.models.application.get_directly_accessible(slug_or_uuid_or_id, options)` ⇒ [TypeApplication](#typeapplication) -#### Raises: - ApplicationNotFound: if application couldn't be found. -### Function: get_dashboard_url(app_id) +**Args:** + slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use -Get Dashboard URL for a specific application. +**Returns:** + TypeApplication: application info. -#### Args: - app_id (str): application id. +**Examples:** +```python +>>> balena.models.application.get_directly_accessible("myorganization/myapp") +>>> balena.models.application.get_directly_accessible(123) +``` -#### Raises: - InvalidParameter: if the app_id is not a finite number. +## get_id -#### Returns: - str: Dashboard URL for the specific application. +Given an application slug or uuid or id, returns it numeric id. + +**Signature:** `balena.models.application.get_id(slug_or_uuid_or_id)` ⇒ int -#### Examples: +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + +**Returns:** + int: The id. + +**Examples:** ```python ->>> balena.models.application.get_dashboard_url('1476418') -https://dashboard.balena-cloud.com/apps/1476418 +>>> balena.models.application.get_dashboard_url(1476418) ``` -### Function: get_target_release_hash(app_id) + +## get_target_release_hash Get the hash of the current release for a specific application. -#### Args: - app_id (str): application id. +**Signature:** `balena.models.application.get_target_release_hash(slug_or_uuid_or_id)` ⇒ Optional[str] + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: - str: The release hash of the current release. +**Returns:** + Optional[str]: The release hash of the current release or None. -#### Examples: +**Examples:** ```python ->>> balena.models.application.get_target_release_hash('5685') +>>> balena.models.application.get_target_release_hash(5685) ``` -### Function: get_with_device_service_details(name, expand_release) -Get a single application along with its associated services' essential details. +## get_with_device_service_details -#### Args: - name (str): application name. - expand_release (Optional[bool]): Set this parameter to True then the commit of service details will be included. +This method does not map exactly to the underlying model: it runs a +larger prebuilt query, and reformats it into an easy to use and +understand format. If you want more control, or to see the raw model +directly, use `application.get(uuidOrId, options)` instead. -#### Returns: - dict: application info. +**Signature:** `balena.models.application.get_with_device_service_details(slug_or_uuid_or_id, options)` ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) -#### Raises: - ApplicationNotFound: if application couldn't be found. - AmbiguousApplication: when more than one application is returned. +**Args:** + slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use -#### Examples: +**Returns:** + TypeApplication: application info. + +**Examples:** ```python ->>> balena.models.application.get('test-app') -'{u'depends_on__application': None, u'should_track_latest_release': True, u'app_name': u'test-app', u'application_type': {u'__deferred': {u'uri': u'/resin/application_type(5)'}, u'__id': 5}, u'__metadata': {u'type': u'', u'uri': u'/resin/application(1252573)'}, u'is_accessible_by_support_until__date': None, u'actor': 3259381, u'slug': u'nghiant27101/test-app', u'owns__device': [{u'os_variant': u'prod', u'__metadata': {u'type': u'', u'uri': u'/resin/device(1460194)'}, u'is_managed_by__service_instance': {u'__deferred': {u'uri': u'/resin/service_instance(117953)'}, u'__id': 117953}, u'should_be_running__release': None, u'belongs_to__user': {u'__deferred': {u'uri': u'/resin/user(5227)'}, u'__id': 5227}, u'is_web_accessible': False, u'device_type': u'raspberrypi3', u'belongs_to__application': {u'__deferred': {u'uri': u'/resin/application(1252573)'}, u'__id': 1252573}, u'id': 1460194, u'is_locked_until__date': None, u'logs_channel': None, u'uuid': u'b6070f4fea5edf808b576123157fe5ec', u'is_managed_by__device': None, u'should_be_managed_by__supervisor_release': None, u'actor': 3505229, u'note': None, u'os_version': u'balenaOS 2.29.2+rev2', u'longitude': u'105.8516', u'last_connectivity_event': u'2019-05-06T07:30:20.230Z', u'is_on__commit': u'ddf95bef72a981f826bf5303df11f318dbdbff23', u'gateway_download': [], u'location': u'Hanoi, Hanoi, Vietnam', u'status': u'Idle', u'public_address': u'14.162.159.155', u'is_connected_to_vpn': False, u'custom_latitude': u'', u'is_active': True, u'provisioning_state': u'', u'latitude': u'21.0313', u'custom_longitude': u'', u'is_online': False, u'supervisor_version': u'9.0.1', u'ip_address': u'192.168.100.20', u'provisioning_progress': None, u'is_accessible_by_support_until__date': None, u'created_at': u'2019-01-09T11:41:19.336Z', u'download_progress': None, u'last_vpn_event': u'2019-05-06T07:30:20.230Z', u'device_name': u'spring-morning', u'image_install': [{u'status': u'Running', u'__metadata': {u'type': u'', u'uri': u'/resin/image_install(34691843)'}, u'image': [{u'is_a_build_of__service': [{u'service_name': u'main', u'__metadata': {u'type': u'', u'uri': u'/resin/service(92238)'}, u'id': 92238}], u'__metadata': {u'type': u'', u'uri': u'/resin/image(1117181)'}, u'id': 1117181}], u'download_progress': None, u'install_date': u'2019-04-29T10:24:23.476Z', u'id': 34691843}], u'local_id': None, u'vpn_address': None}, {u'os_variant': u'prod', u'__metadata': {u'type': u'', u'uri': u'/resin/device(1308755)'}, u'is_managed_by__service_instance': {u'__deferred': {u'uri': u'/resin/service_instance(2205)'}, u'__id': 2205}, u'should_be_running__release': None, u'belongs_to__user': {u'__deferred': {u'uri': u'/resin/user(5227)'}, u'__id': 5227}, u'is_web_accessible': False, u'device_type': u'raspberrypi3', u'belongs_to__application': {u'__deferred': {u'uri': u'/resin/application(1252573)'}, u'__id': 1252573}, u'id': 1308755, u'is_locked_until__date': None, u'logs_channel': None, u'uuid': u'531e5cc893b7df1e1118121059d93eee', u'is_managed_by__device': None, u'should_be_managed_by__supervisor_release': None, u'actor': 3259425, u'note': None, u'os_version': u'Resin OS 2.15.1+rev1', u'longitude': u'105.85', u'last_connectivity_event': u'2018-09-27T14:48:53.034Z', u'is_on__commit': u'19ab64483292f0a52989d0ce15ee3d21348dbfce', u'gateway_download': [], u'location': u'Hanoi, Hanoi, Vietnam', u'status': u'Idle', u'public_address': u'14.231.247.155', u'is_connected_to_vpn': False, u'custom_latitude': u'', u'is_active': True, u'provisioning_state': u'', u'latitude': u'21.0333', u'custom_longitude': u'', u'is_online': False, u'supervisor_version': u'7.16.6', u'ip_address': u'192.168.0.102', u'provisioning_progress': None, u'is_accessible_by_support_until__date': None, u'created_at': u'2018-09-12T04:30:13.549Z', u'download_progress': None, u'last_vpn_event': u'2018-09-27T14:48:53.034Z', u'device_name': u'nameless-resonance', u'image_install': [{u'status': u'Running', u'__metadata': {u'type': u'', u'uri': u'/resin/image_install(33844685)'}, u'image': [{u'is_a_build_of__service': [{u'service_name': u'main', u'__metadata': {u'type': u'', u'uri': u'/resin/service(92238)'}, u'id': 92238}], u'__metadata': {u'type': u'', u'uri': u'/resin/image(513014)'}, u'id': 513014}], u'download_progress': None, u'install_date': u'2018-09-27T13:53:04.748Z', u'id': 33844685}], u'local_id': None, u'vpn_address': None}], u'user': {u'__deferred': {u'uri': u'/resin/user(5227)'}, u'__id': 5227}, u'device_type': u'raspberrypi3', u'commit': u'ddf95bef72a981f826bf5303df11f318dbdbff23', u'id': 1252573}' +>>> balena.models.application.get_with_device_service_details('my_org_handle/my_app_name') ``` -### Function: grant_support_access(app_id, expiry_timestamp) + +## grant_support_access Grant support access to an application until a specified time. -#### Args: - app_id (str): application id. +**Signature:** `balena.models.application.grant_support_access(slug_or_uuid_or_id, expiry_timestamp)` ⇒ None + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Returns: - OK/error. +**Examples:** +```python +>>> balena.models.application.grant_support_access(5685, 1511974999000) +``` -#### Examples: - >> > balena.models.application.grant_support_access('5685', 1511974999000) - 'OK' -### Function: has(name) +## has Check if an application exists. -#### Args: - name (str): application name. +**Signature:** `balena.models.application.has(slug_or_uuid_or_id)` ⇒ bool -#### Returns: +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + +**Returns:** bool: True if application exists, False otherwise. -#### Examples: +**Examples:** ```python ->>> balena.models.application.has('foo') -True +>>> balena.models.application.has('my_org/foo') ``` -### Function: has_any() + +## has_any Check if the user has any applications. -#### Returns: +**Signature:** `balena.models.application.has_any()` ⇒ bool + +**Returns:** bool: True if user has any applications, False otherwise. -#### Examples: +**Examples:** ```python >>> balena.models.application.has_any() -True ``` -### Function: is_tracking_latest_release(app_id) - -Get whether the application is up to date and is tracking the latest release for updates. -#### Args: - app_id (str): application id. +## is_tracking_latest_release -#### Returns: - bool: is tracking the latest release. +Get whether the application is up to date and is tracking the latest finalized release for updates -#### Examples: - >> > balena.models.application.is_tracking_latest_release('5685') - True -### Function: remove(name) +**Signature:** `balena.models.application.is_tracking_latest_release(slug_or_uuid_or_id)` ⇒ bool -Remove application. This function only works if you log in using credentials or Auth Token. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Args: - name (str): application name. +**Returns:** + bool: is tracking the latest release. -#### Examples: +**Examples:** ```python ->>> balena.models.application.remove('Edison') -'OK' +>>> balena.models.application.is_tracking_latest_release(5685) ``` -### Function: restart(name) -Restart application. This function only works if you log in using credentials or Auth Token. +## pin_to_release -#### Args: - name (str): application name. +Configures the application to run a particular release +and not get updated when the latest release changes. -#### Raises: - ApplicationNotFound: if application couldn't be found. +**Signature:** `balena.models.application.pin_to_release(slug_or_uuid_or_id, full_release_hash)` ⇒ None + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + full_release_hash (str) : the hash of a successful release (string) -#### Examples: +**Examples:** ```python ->>> balena.models.application.restart('RPI1') -'OK' +>>> balena.models.application.set_to_release(5685, '7dba4e0c461215374edad74a5b78f470b894b5b7') ``` -### Function: revoke_support_access(app_id) -Revoke support access to an application. - -#### Args: - app_id (str): application id. +## purge -#### Returns: - OK/error. +Purge devices by application id -#### Examples: - >> > balena.models.application.revoke_support_access('5685') - 'OK' -### Function: set_to_release(app_id, full_release_hash) +**Signature:** `balena.models.application.purge(app_id)` ⇒ None -Set an application to a specific commit. +**Args:** + app_id (int): application id (number) -#### Args: - app_id (str): application id. - full_release_hash (str) : full_release_hash. +**Examples:** +```python +>>> balena.models.application.purge(5685) +``` -#### Returns: - OK/error. +## reboot -#### Examples: - >> > balena.models.application.set_to_release('5685', '7dba4e0c461215374edad74a5b78f470b894b5b7') - 'OK' -### Function: track_latest_release(app_id) +Reboots devices by application id -Configure a specific application to track the latest available release. +**Signature:** `balena.models.application.reboot(app_id, options)` ⇒ None -#### Args: - app_id (str): application id. +**Args:** + app_id (int): application id (number) + options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python ->>> balena.models.application.track_latest_release('5685') +>>> balena.models.application.reboot(5685) +>>> balena.models.application.reboot(5685, {"force": True}) ``` -### Function: will_track_new_releases(app_id) -Get whether the application is configured to receive updates whenever a new release is available. +## remove -#### Args: - app_id (str): application id. +Remove application. -#### Returns: - bool: is tracking the latest release. +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id)` ⇒ None -#### Examples: - >> > balena.models.application.will_track_new_releases('5685') - True -## ApiKey +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -This class implements user API key model for balena python SDK. -### Function: create_api_key(name, description) +**Examples:** +```python +>>> balena.models.application.remove('my_org/my_app') +>>> balena.models.application.remove('c184556293854781aea71b0bdae10e45') +>>> balena.models.application.remove(123) +``` + +## rename -This function registers a new api key for the current user with the name given. +Rename application. -#### Args: - name (str): user API key name. - description (Optional[str]): API key description. +**Signature:** `balena.models.application.rename(slug_or_uuid_or_id, new_name)` ⇒ None -#### Returns: - str: user API key. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + new_name (str): new application name. -#### Examples: +**Examples:** ```python ->>> balena.models.api_key.create_api_key('myApiKey') -3YHD9DVPLe6LbjEgQb7FEFXYdtPEMkV9 +>>> balena.models.application.rename(1681618, 'py-test-app') ``` -### Function: get_all() - -This function gets all API keys. -#### Returns: - list: user API key. +## restart -#### Examples: -```python ->>> balena.models.api_key.get_all() -[{u'description': None, u'created_at': u'2018-04-06T03:53:34.189Z', u'__metadata': {u'type': u'', u'uri': u'/balena/api_key(1296047)'}, u'is_of__actor': {u'__deferred': {u'uri': u'/balena/actor(2454095)'}, u'__id': 2454095}, u'id': 1296047, u'name': u'myApiKey'}] -``` -### Function: revoke(id) +Restart application. -This function revokes an API key. +**Signature:** `balena.models.application.restart(slug_or_uuid_or_id)` ⇒ None -#### Args: - id (str): API key id. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python ->>> balena.models.api_key.revoke(1296047) -OK +>>> balena.models.application.restart('myorg/RPI1') ``` -### Function: update(id, api_key_info) -This function updates details of an API key. +## revoke_support_access -#### Args: - id (str): API key id. - api_key_info: new API key info. - name (str): new API key name. - description (Optional[str]): new API key description. +Revoke support access to an application. + +**Signature:** `balena.models.application.revoke_support_access(slug_or_uuid_or_id)` ⇒ None -#### Examples: +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + +**Examples:** ```python ->>> balena.models.api_key.update(1296047, {'name':'new name') -OK +>>> balena.models.application.revoke_support_access(5685) ``` -## Config -This class implements configuration model for balena python SDK. +## shutdown -#### Attributes: - _config (dict): caching configuration. -### Function: get_all() +Shutdown devices by application id -Get all configuration. +**Signature:** `balena.models.application.shutdown(app_id, options)` ⇒ None -#### Returns: - dict: configuration information. +**Args:** + app_id (int): application id (number) + options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python ->>> balena.models.config.get_all() -{ all configuration details } +>>> balena.models.application.shutdown(5685) +>>> balena.models.application.shutdown(5685, {"force": True}) ``` -### Function: get_device_types() -Get device types configuration. +## track_latest_release + +Configure a specific application to track the latest available release. + +**Signature:** `balena.models.application.track_latest_release(slug_or_uuid_or_id)` ⇒ None -#### Returns: - list: device types information. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Examples: +**Examples:** ```python ->>> balena.models.config.get_device_types() -[ all configuration details ] +>>> balena.models.application.track_latest_release(5685) ``` -## ConfigVariable -This class is a wrapper for config variable models. -## ApplicationConfigVariable +## will_track_new_releases -This class implements application config variable model for balena python SDK. -### Function: create(app_id, config_var_name, value) + Get whether the application is configured to receive updates whenever a new release is available. -Create an application config variable. +**Signature:** `balena.models.application.will_track_new_releases(slug_or_uuid_or_id)` ⇒ bool -#### Args: - app_id (str): application id. - config_var_name (str): application config variable name. - value (str): application config variable value. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Returns: - dict: new application config variable info. +**Returns:** + bool: is tracking the latest release. -#### Examples: +**Examples:** ```python ->>> print(balena.models.config_variable.application_config_variable.create('1005160', 'BALENA_TEST_APP_CONFIG_VAR', 'test value')) -{"id":117738,"application":{"__deferred":{"uri":"/balena/application(1005160)"},"__id":1005160},"name":"BALENA_TEST_APP_CONFIG_VAR","value":"test value","__metadata":{"uri":"/balena/application_config_variable(117738)","type":""}} +>>> balena.models.application.will_track_new_releases(5685) ``` -### Function: get_all(app_id) -Get all application config variables belong to an application. +# ApplicationTag -#### Args: - app_id (str): application id. +This class implements application tag model for balena python SDK. +## get_all_by_application -#### Returns: - list: application config variables. +Get all application tags for an application. -#### Examples: -```python ->>> balena.models.config_variable.application_config_variable.get_all('1005160') -[{u'application': {u'__deferred': {u'uri': u'/balena/application(1005160)'}, u'__id': 1005160}, u'__metadata': {u'type': u'', u'uri': u'/balena/application_config_variable(116965)'}, u'id': 116965, u'value': u'false', u'name': u'BALENA_SUPERVISOR_NATIVE_LOGGER'}] -``` -### Function: remove(var_id) +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) -Remove a application config environment variable. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use -#### Args: - var_id (str): application config environment variable id. +**Returns:** + List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python ->>> balena.models.config_variable.application_config_variable.remove('117738') -'OK' +>>> balena.models.application.tags.get_all_by_application(1005160) ``` -### Function: update(var_id, value) -Update an application config variable. +## remove + +Remove an application tag. + +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, tag_key)` ⇒ None -#### Args: - var_id (str): application config variable id. - value (str): new application config variable value. +**Args:** + slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) + tag_key (str): tag key. -#### Examples: +**Examples:** ```python ->>> balena.models.config_variable.application_config_variable.update('117738', 'new test value') -'OK' +>>> balena.models.application.tags.remove(1005767, 'tag1') ``` -## DeviceConfigVariable -This class implements device config variable model for balena python SDK. -### Function: create(uuid, config_var_name, value) +## set -Create a device config variable. +Set an application tag (update tag value if it exists). -#### Args: - uuid (str): device uuid. - config_var_name (str): device config variable name. - value (str): device config variable value. +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, tag_key, value)` ⇒ None + +**Args:** + slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) + tag_key (str): tag key. + value (str): tag value. -#### Returns: - dict: new device config variable info. +**Returns:** + List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python ->>> balena.models.config_variable.device_config_variable.create('f14a73b3a762396f7bfeacf5d530c316aa8cfeff307bea93422f71a106c344','BALENA_TEST_DEVICE_CONFIG_VAR','test value') -{u'device': {u'__deferred': {u'uri': u'/balena/device(1083716)'}, u'__id': 1083716}, u'__metadata': {u'type': u'', u'uri': u'/balena/device_config_variable(163985)'}, u'id': 163985, u'value': u'test value', u'name': u'BALENA_TEST_DEVICE_CONFIG_VAR'} +>>> balena.models.application.tags.set(1005767, 'tag1', 'Python SDK') ``` -### Function: get_all(uuid) - -Get all device config variables belong to a device. - -#### Args: - uuid (str): device uuid. -#### Returns: - list: device config variables. +# ApplicationConfigVariable -#### Examples: -```python ->>> balena.models.config_variable.device_config_variable.get_all('f5213eac0d63ac47721b037a7406d306') -[{u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'__id74}, u'__metadata': {u'type': u'', u'uri': u'/balena/device_config_variab8)'}, u'id': 130598, u'value': u'1', u'name': u'BALENA_HOST_CONFIG_avoid_'}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'_36574}, u'__metadata': {u'type': u'', u'uri': u'/balena/device_config_var0597)'}, u'id': 130597, u'value': u'1', u'name': u'BALENA_HOST_CONFIG_disash'}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, 1036574}, u'__metadata': {u'type': u'', u'uri': u'/balena/device_config_(130596)'}, u'id': 130596, u'value': u'"i2c_arm=on","spi=on","audio=on"'': u'BALENA_HOST_CONFIG_dtparam'}, {u'device': {u'__deferred': {u'uri': udevice(1036574)'}, u'__id': 1036574}, u'__metadata': {u'type': u'', u'ubalena/device_config_variable(130595)'}, u'id': 130595, u'value': u'16', uu'BALENA_HOST_CONFIG_gpu_mem'}, {u'device': {u'__deferred': {u'uri': u'/rice(1036574)'}, u'__id': 1036574}, u'__metadata': {u'type': u'', u'uri':n/device_config_variable(130594)'}, u'id': 130594, u'value': u'false', uu'BALENA_HOST_LOG_TO_DISPLAY'}] -``` -### Function: get_all_by_application(app_id) +This class implements application config variable model for balena python SDK. +## get -Get all device config variables by application. +Get application config variable. -#### Args: - app_id (int): application id. +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] -#### Returns: - list: device config variables. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.config_variable.device_config_variable.get_all_by_application(1043050) -[{u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'__id74}, u'__metadata': {u'type': u'', u'uri': u'/balena/device_config_variab8)'}, u'id': 130598, u'value': u'1', u'name': u'BALENA_HOST_CONFIG_avoid_'}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'_36574}, u'__metadata': {u'type': u'', u'uri': u'/balena/device_config_var0597)'}, u'id': 130597, u'value': u'1', u'name': u'BALENA_HOST_CONFIG_disash'}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, 1036574}, u'__metadata': {u'type': u'', u'uri': u'/balena/device_config_(130596)'}, u'id': 130596, u'value': u'"i2c_arm=on","spi=on","audio=on"'': u'BALENA_HOST_CONFIG_dtparam'}, {u'device': {u'__deferred': {u'uri': udevice(1036574)'}, u'__id': 1036574}, u'__metadata': {u'type': u'', u'ubalena/device_config_variable(130595)'}, u'id': 130595, u'value': u'16', uu'BALENA_HOST_CONFIG_gpu_mem'}, {u'device': {u'__deferred': {u'uri': u'/rice(1036574)'}, u'__id': 1036574}, u'__metadata': {u'type': u'', u'uri':n/device_config_variable(130594)'}, u'id': 130594, u'value': u'false', uu'BALENA_HOST_LOG_TO_DISPLAY'}] +>>> balena.models.application.config_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` -### Function: remove(var_id) -Remove a device config environment variable. +## get_all_by_application -#### Args: - var_id (str): device config environment variable id. +Get all application config variables by application. -#### Examples: -```python ->>> balena.models.config_variable.device_config_variable.remove('132715') -'OK' -``` -### Function: update(var_id, value) +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) -Update a device config variable. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use -#### Args: - var_id (str): device config variable id. - value (str): new device config variable value. +**Returns:** + List[EnvironmentVariableBase]: application config variables. -#### Examples: +**Examples:** ```python ->>> balena.models.config_variable.device_config_variable.update('132715', 'new test value') -'OK' +>>> balena.models.application.config_var.get_all_by_application(9020) ``` -## Device - -This class implements device model for balena python SDK. - -Due to API changes, the returned Device object schema has changed. Here are the formats of the old and new returned objects. - -The old returned object's properties: `__metadata, actor, application, build, commit, created_at, custom_latitude, custom_longitude, device, device_type, download_progress, id, ip_address, is_connected_to_vpn, is_online, is_web_accessible, last_connectivity_event, last_vpn_event, latitude, local_id, location, lock_expiry_date, logs_channel, longitude, name, note, os_variant, os_version, provisioning_progress, provisioning_state, public_address, service_instance, status, supervisor_release, supervisor_version, support_expiry_date, user, uuid, vpn_address`. -The new returned object's properties (since python SDK v2.0.0): `__metadata, actor, belongs_to__application, belongs_to__user, created_at, custom_latitude, custom_longitude, device_type, download_progress, id, ip_address, is_accessible_by_support_until__date, is_connected_to_vpn, is_locked_until__date, is_managed_by__device, is_managed_by__service_instance, is_on__commit, is_online, is_web_accessible, last_connectivity_event, last_vpn_event, latitude, local_id, location, logs_channel, longitude, name, note, os_variant, os_version, provisioning_progress, provisioning_state, public_address, should_be_managed_by__supervisor_release, should_be_running__build, status, supervisor_version, uuid, vpn_address`. -### Function: disable_device_url(uuid) +## remove -Disable device url for a device. +Remove an application config variable. -#### Args: - uuid (str): device uuid. +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None -#### Raises: - DeviceNotFound: if device couldn't be found. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + key (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.device.disable_device_url('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -'OK' +>>> balena.models.application.config_var.remove(2184, 'test_env') ``` -### Function: disable_local_mode(uuid) -Disable local mode. +## set -#### Args: - uuid (str): device uuid. +Set the value of a specific application config variable. -#### Returns: - None. +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + env_var_name (str): environment variable name. + value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.device.disable_local_mode('b6070f4fea5edf808b576123157fe5ec') +>>> balena.models.application.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env', 'testing1') ``` -### Function: disable_lock_override(uuid) -Disable lock override. - -#### Args: - uuid (str): device uuid. +# ApplicationEnvVariable -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: enable_device_url(uuid) +This class implements application environment variable model for balena python SDK. +## get -Enable device url for a device. +Get application environment variable. -#### Args: - uuid (str): device uuid. +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] -#### Raises: - DeviceNotFound: if device couldn't be found. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python -# Check if device url enabled. ->>> balena.models.device.has_device_url('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -False -# Enable device url. ->>> balena.models.device.enable_device_url('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -'OK' -# Check device url again. ->>> balena.models.device.has_device_url('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -True +>>> balena.models.application.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` -### Function: enable_local_mode(uuid) - -Enable local mode. -#### Args: - uuid (str): device uuid. +## get_all_by_application -#### Returns: - None. +Get all application environment variables by application. -#### Examples: -```python ->>> balena.models.device.enable_local_mode('b6070f4fea5edf808b576123157fe5ec') -``` +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) -#### Raises: - LocalModeError: if local mode can't be enabled. -### Function: enable_lock_override(uuid) +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use -Enable lock override. +**Returns:** + List[EnvironmentVariableBase]: application environment variables. -#### Args: - uuid (str): device uuid. +**Examples:** +```python +>>> balena.models.application.env_var.get_all_by_application(9020) +>>> balena.models.application.env_var.get_all_by_application("myorg/myslug") +``` -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: generate_device_key(uuid) +## remove -Generate a device key. +Remove an application environment variable. -#### Args: - uuid (str): device uuid. +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None -#### Raises: - DeviceNotFound: if device couldn't be found. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + key (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.device.generate_device_key('df09262c283b1dc1462d0e82caa7a88e52588b8c5d7475dd22210edec1c50a') -2UrtMWeLqYXfTznZo1xNuZQXmEE6cOZk +>>> balena.models.application.env_var.remove(2184,'test_env4') ``` -### Function: generate_uuid() -Generate a random device UUID. +## set -#### Returns: - str: a generated UUID. +Set the value of a specific application environment variable. + +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None -#### Examples: +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + env_var_name (str): environment variable name. + value (str): environment variable value. + +**Examples:** ```python ->>> balena.models.device.generate_uuid() -'19dcb86aa288c66ffbd261c7bcd46117c4c25ec655107d7302aef88b99d14c' +>>> balena.models.application.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') ``` -### Function: get(uuid) -Get a single device by device uuid. +# BuildEnvVariable -#### Args: - uuid (str): device uuid. +This class implements build environment variable model for balena python SDK. +## get + +Get build environment variable. -#### Returns: - dict: device info. +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] -#### Raises: - DeviceNotFound: if device couldn't be found. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -{u'__metadata': {u'type': u'', u'uri': u'/ewa/device(122950)'}, u'last_connectivity_event': u'1970-01-01T00:00:00.000Z', u'is_web_accessible': False, u'device_type': u'raspberry-pi', u'id': 122950, u'logs_channel': None, u'uuid': u'8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143', u'application': {u'__deferred': {u'uri': u'/ewa/application(9020)'}, u'__id': 9020}, u'note': None, u'os_version': None, u'location': u'', u'latitude': u'', u'status': None, u'public_address': u'', u'provisioning_state': None, u'user': {u'__deferred': {u'uri': u'/ewa/user(5397)'}, u'__id': 5397}, u'is_online': False, u'supervisor_version': None, u'ip_address': None, u'vpn_address': None, u'name': u'floral-mountain', u'download_progress': None, u'longitude': u'', u'commit': None, u'provisioning_progress': None, u'supervisor_release': None} +>>> balena.models.application.build_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` -### Function: get_all() -Get all devices. +## get_all_by_application -#### Returns: - list: list contains info of devices. +Get all build environment variables by application. -#### Examples: -```python ->>> balena.models.device.get_all() -[{u'__metadata': {u'type': u'', u'uri': u'/ewa/device(122950)'}, u'last_connectivity_event': u'1970-01-01T00:00:00.000Z', u'is_web_accessible': False, u'device_type': u'raspberry-pi', u'id': 122950, u'logs_channel': None, u'uuid': u'8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143', u'application': {u'__deferred': {u'uri': u'/ewa/application(9020)'}, u'__id': 9020}, u'note': None, u'os_version': None, u'location': u'', u'latitude': u'', u'status': None, u'public_address': u'', u'provisioning_state': None, u'user': {u'__deferred': {u'uri': u'/ewa/user(5397)'}, u'__id': 5397}, u'is_online': False, u'supervisor_version': None, u'ip_address': None, u'vpn_address': None, u'name': u'floral-mountain', u'download_progress': None, u'longitude': u'', u'commit': None, u'provisioning_progress': None, u'supervisor_release': None}] -``` -### Function: get_all_by_application(name) - -Get devices by application name. +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) -#### Args: - name (str): application name. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use -#### Returns: - list: list contains info of devices. +**Returns:** + List[EnvironmentVariableBase]: build environment variables. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_all_by_application('RPI1') -[{u'__metadata': {u'type': u'', u'uri': u'/ewa/device(122950)'}, u'last_connectivity_event': u'1970-01-01T00:00:00.000Z', u'is_web_accessible': False, u'device_type': u'raspberry-pi', u'id': 122950, u'logs_channel': None, u'uuid': u'8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143', u'application': {u'__deferred': {u'uri': u'/ewa/application(9020)'}, u'__id': 9020}, u'note': None, u'os_version': None, u'location': u'', u'latitude': u'', u'status': None, u'public_address': u'', u'provisioning_state': None, u'user': {u'__deferred': {u'uri': u'/ewa/user(5397)'}, u'__id': 5397}, u'is_online': False, u'supervisor_version': None, u'ip_address': None, u'vpn_address': None, u'name': u'floral-mountain', u'download_progress': None, u'longitude': u'', u'commit': None, u'provisioning_progress': None, u'supervisor_release': None}] +>>> balena.models.application.build_var.get_all_by_application(9020) +>>> balena.models.application.build_var.get_all_by_application("myorg/myslug") ``` -### Function: get_all_by_application_id(appid) -Get devices by application name. +## remove + +Remove an build environment variable. -#### Args: - appid (str): application id. +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None -#### Returns: - list: list contains info of devices. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + key (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_all_by_application_id(1234) -[{u'__metadata': {u'type': u'', u'uri': u'/ewa/device(122950)'}, u'last_connectivity_event': u'1970-01-01T00:00:00.000Z', u'is_web_accessible': False, u'device_type': u'raspberry-pi', u'id': 122950, u'logs_channel': None, u'uuid': u'8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143', u'application': {u'__deferred': {u'uri': u'/ewa/application(9020)'}, u'__id': 9020}, u'note': None, u'os_version': None, u'location': u'', u'latitude': u'', u'status': None, u'public_address': u'', u'provisioning_state': None, u'user': {u'__deferred': {u'uri': u'/ewa/user(5397)'}, u'__id': 5397}, u'is_online': False, u'supervisor_version': None, u'ip_address': None, u'vpn_address': None, u'name': u'floral-mountain', u'download_progress': None, u'longitude': u'', u'commit': None, u'provisioning_progress': None, u'supervisor_release': None}] +>>> balena.models.application.build_var.remove(2184, 'test_env4') ``` -### Function: get_application_name(uuid) -Get application name by device uuid. +## set -#### Args: - uuid (str): device uuid. +Set the value of a specific build environment variable. -#### Returns: - str: application name. +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: get_by_name(name) +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + env_var_name (str): environment variable name. + value (str): environment variable value. -Get devices by device name. +**Examples:** +```python +>>> balena.models.application.build_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') +``` -#### Args: - name (str): device name. +# ApplicationMembership -#### Returns: - list: list contains info of devices. +This class implements application membership model for balena python SDK. +## change_role -#### Examples: -```python ->>> balena.models.device.get_by_name('floral-mountain') -[{u'__metadata': {u'type': u'', u'uri': u'/ewa/device(122950)'}, u'last_connectivity_event': u'1970-01-01T00:00:00.000Z', u'is_web_accessible': False, u'device_type': u'raspberry-pi', u'id': 122950, u'logs_channel': None, u'uuid': u'8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143', u'application': {u'__deferred': {u'uri': u'/ewa/application(9020)'}, u'__id': 9020}, u'note': None, u'os_version': None, u'location': u'', u'latitude': u'', u'status': None, u'public_address': u'', u'provisioning_state': None, u'user': {u'__deferred': {u'uri': u'/ewa/user(5397)'}, u'__id': 5397}, u'is_online': False, u'supervisor_version': None, u'ip_address': None, u'vpn_address': None, u'name': u'floral-mountain', u'download_progress': None, u'longitude': u'', u'commit': None, u'provisioning_progress': None, u'supervisor_release': None}] -``` -### Function: get_dashboard_url(uuid) +Changes the role of an application member. -Get balena Dashboard URL for a specific device. +**Signature:** `balena.models.application.change_role(membership_id, role_name)` ⇒ None -#### Args: - uuid (str): device uuid. +**Args:** + membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` + numeric pair of the membership + role_name (str): the role name to be granted to the membership. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_dashboard_url('19619a6317072b65a240b451f45f855d') -https://dashboard.balena.io/devices/19619a6317072b65a240b451f45f855d/summary +>>> balena.models.application.membership.change_role(55074, 'observer') ``` -### Function: get_device_slug(device_type_name) -Get device slug. +## create -#### Args: - device_type_name (str): device type name. +Creates a new membership for an application. -#### Returns: - str: device slug name. +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, username, role_name)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) -#### Raises: - InvalidDeviceType: if device type name is not supported. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + username (str): the username of the balena user that will become a member. + role_name (Optional[str]): the role name to be granted to the membership. -#### Examples: +**Returns:** + ApplicationMembershipType: application membership. + +**Examples:** ```python ->>> balena.models.device.get_device_slug('Intel Edison') -u'intel-edison' ->>> balena.models.device.get_device_slug('Raspberry Pi') -u'raspberry-pi' +>>> balena.models.application.membership.create(1681618, 'testuser') ``` -### Function: get_device_url(uuid) -Get a device url for a device. +## get -#### Args: - uuid (str): device uuid. +Get a single application membership. + +**Signature:** `balena.models.application.get(membership_id, options)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) -#### Raises: - DeviceNotFound: if device couldn't be found. +**Args:** + membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` + numeric pair of the membership + options (AnyObject): extra pine options to use -#### Examples: +**Returns:** + ApplicationMembershipType: application membership. + +**Examples:** ```python ->>> balena.models.device.get_device_url('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -'https://8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143.balenadevice.io' +>>> balena.models.application.membership.get(55074) +>>> balena.models.application.membership.get({"user": 123, "is_member_of__application": 125}) ``` -### Function: get_display_name(device_type_slug) -Get display name for a device. +## get_all -#### Args: - device_type_slug (str): device type slug. +Get all application memberships. -#### Returns: - str: device display name. +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) -#### Raises: - InvalidDeviceType: if device type slug is not supported. +**Args:** + options (AnyObject): extra pine options to use -#### Examples: +**Returns:** + List[ApplicationMembershipType]: list contains info of application memberships. + +**Examples:** ```python ->>> balena.models.device.get_display_name('intel-edison') -u'Intel Edison' ->>> balena.models.device.get_display_name('raspberry-pi') -u'Raspberry Pi' +>>> balena.models.application.membership.get_all() ``` -### Function: get_local_ip_address(uuid) - -Get the local IP addresses of a device. - -#### Args: - uuid (str): device uuid. -#### Returns: - list: IP addresses of a device. +## get_all_by_application -#### Raises: - DeviceNotFound: if device couldn't be found. - DeviceOffline: if device is offline. -### Function: get_local_mode_support(uuid) +Get all memberships by application. -Returns whether local mode is supported along with a message describing the reason why local mode is not supported. +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) -#### Args: - uuid (str): device uuid. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + options (AnyObject): extra pine options to use -#### Returns: - dict: local mode support information ({'supported': True/False, 'message': '...'}). +**Returns:** + list: list contains info of application memberships. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_local_mode_support('b6070f4fea5edf808b576123157fe5ec') -{'message': 'Local mode is only supported on development OS versions', 'supported': False} +>>> balena.models.application.membership.get_all_by_application(1681618) ``` -### Function: get_mac_address(uuid) - -Get the MAC addresses of a device. -#### Args: - uuid (str): device uuid. +## remove -#### Returns: - list: MAC addresses of a device. +Remove a membership. -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: get_manifest_by_application(app_name) +**Signature:** `balena.models.application.remove(membership_id)` ⇒ None -Get a device manifest by application name. +**Args:** + membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` -#### Args: - app_name (str): application name. +# ApplicationInvite -#### Returns: - dict: dictionary contains device manifest. -### Function: get_manifest_by_slug(slug) +This class implements application invite model for balena python SDK. +## accept -Get a device manifest by slug. +Accepts an invite. -#### Args: - slug (str): device slug name. +**Signature:** `balena.models.application.accept(invite_token)` ⇒ None -#### Returns: - dict: dictionary contains device manifest. +**Args:** + invite_token (str): invitationToken - invite token. -#### Raises: - InvalidDeviceType: if device slug name is not supported. -### Function: get_metrics(uuid) +**Examples:** +```python +>>> balena.models.application.invite.accept("qwerty-invitation-token") +``` -Get the metrics related information for a device. +## create -#### Args: - uuid (str): device uuid. +Creates a new invite for an application. -#### Returns: - dict: metrics of the device. +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, options)` ⇒ [ApplicationInviteType](#applicationinvitetype) -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: get_name(uuid) +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + options (ApplicationInviteOptions): Application Invite options dict to use. + invitee (str): the email/balena_username of the invitee. + role_name (Optional[str]): the role name to be granted to the invitee. + One of "observer", "developer", "operator". Defaults to "developer" + message (Optional[str]): the message to send along with the invite. -Get device name by device uuid. +**Returns:** + dict: application invite. -#### Args: - uuid (str): device uuid. +**Examples:** +```python +>>> balena.models.application.invite.create(1681618, 'invitee@example.org', 'developer', 'Test invite') +``` -#### Returns: - str: device name. +## get_all -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: get_os_update_status(uuid) +Get all invites. - Get the OS update status of a device. +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) -#### Args: - uuid (str): device uuid. +**Args:** + options (AnyObject): extra pine options to use -#### Returns: - dict: action response. +**Returns:** + List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python - >>> balena.models.device.get_os_update_status('b6070f4fea5edf808b576123157fe5ec') - {u'status': u'done', u'parameters': {u'target_version': u'2.29.2+rev1.prod'}, u'stdout': u'[1554490814][LOG]Normalized target version: 2.29.2+rev1 -', u'last_run': 1554491107242L, u'error': u'', u'action': u'resinhup'} - +>>> balena.models.application.invite.get_all() ``` -### Function: get_status(uuid) -Get the status of a device. +## get_all_by_application -#### Args: - uuid (str): device uuid. +Get all invites by application. + +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) -#### Raises: - DeviceNotFound: if device couldn't be found. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + options (AnyObject): extra pine options to use -#### Returns: - str: status of a device. List of available statuses: Idle, Configuring, Updating, Offline, Inactive and Post Provisioning. +**Returns:** + List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_status('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -'Offline' +>>> balena.models.application.invite.get_all_by_application(1681618) ``` -### Function: get_supervisor_state(uuid) -Get the supervisor state on a device +## revoke -#### Args: - uuid (str): device uuid. +Revoke an invite. -#### Returns: - dict: supervisor state. +**Signature:** `balena.models.application.revoke(invite_id)` ⇒ None + +**Args:** + invite_id (int): application invite id. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_supervisor_state('b6070f4fea5edf808b576123157fe5ec') -{u'status': u'Idle', u'update_failed': False, u'os_version': u'balenaOS 2.29.0+rev1', u'download_progress': None, u'update_pending': False, u'api_port': u'48484', u'commit': u'd26dd8a68a47c40daaa1d32e03c96d934f37c53b', u'update_downloaded': False, u'supervisor_version': u'9.0.1', u'ip_address': u'192.168.100.16'} +>>> balena.models.application.invite.revoke(5860) ``` -### Function: get_supervisor_target_state(uuid) -Get the supervisor target state on a device +# Device -#### Args: - uuid (str): device uuid. +This class implements device model for balena python SDK. +## deactivate + +Deactivates a device. -#### Returns: - dict: supervisor target state. +**Signature:** `balena.models.device.deactivate(uuid_or_id_or_ids)` ⇒ None -#### Examples: +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) + +**Examples:** ```python ->>> balena.models.device.get_supervisor_target_state('b6070f4fea5edf808b576123157fe5ec') -{u'local': {u'name': u'holy-darkness', u'config': {u'RESIN_SUPERVISOR_NATIVE_LOGGER': u'true', u'RESIN_SUPERVISOR_POLL_INTERVAL': u'900000'}, u'apps': {u'1398898': {u'name': u'test-nuc', u'commit': u'f9d139b80a7df94f90d7b9098b1353b14ca31b85', u'releaseId': 850293, u'services': {u'229592': {u'imageId': 1016025, u'serviceName': u'main', u'image': u'registry2.balena-cloud.com/v2/27aa30131b770a4f993da9a54eca6ed8@sha256:f489c30335a0036ecf1606df3150907b32ea39d73ec6de825a549385022e3e22', u'running': True, u'environment': {}, u'labels': {u'io.resin.features.dbus': u'1', u'io.resin.features.firmware': u'1', u'io.resin.features.kernel-modules': u'1', u'io.resin.features.resin-api': u'1', u'io.resin.features.supervisor-api': u'1'}, u'privileged': True, u'tty': True, u'restart': u'always', u'network_mode': u'host', u'volumes': ['resin-data:/data']}}, u'volumes': {u'resin-data': {}}, u'networks': {}}}}, u'dependent': {u'apps': {}, u'devices': {}}} +>>> balena.models.device.deactivate('44cc9d1861b9f992808c506276e5d31c') +>>> balena.models.device.deactivate([123, 234]) ``` -### Function: get_supported_device_types() -Get device slug. +## disable_device_url -#### Returns: - list: list of supported device types. -### Function: get_with_service_details(uuid, expand_release) +Disable device url for a device. -Get a single device along with its associated services' essential details. +**Signature:** `balena.models.device.disable_device_url(uuid_or_id_or_ids)` ⇒ None -#### Args: - uuid (str): device uuid. - expand_release (Optional[bool]): Set this parameter to False then the commit of service details will not be included. +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Returns: - dict: device info with associated services details. +**Examples:** +```python +>>> balena.models.device.disable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') +>>> balena.models.device.disable_device_url([123, 345]) +``` + +## disable_local_mode + +Disable local mode. + +**Signature:** `balena.models.device.disable_local_mode(uuid_or_id)` ⇒ None -#### Raises: - DeviceNotFound: if device couldn't be found. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + +**Returns:** + None. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_with_service_details('0fcd753af396247e035de53b4e43eec3') -{u'os_variant': u'prod', u'__metadata': {u'type': u'', u'uri': u'/balena/device(1136312)'}, u'is_managed_by__service_instance': {u'__deferred': {u'uri': u'/balena/service_instance(182)'}, u'__id': 182}, u'should_be_running__release': None, u'belongs_to__user': {u'__deferred': {u'uri': u'/balena/user(32986)'}, u'__id': 32986}, u'is_web_accessible': False, u'device_type': u'raspberrypi3', u'belongs_to__application': {u'__deferred': {u'uri': u'/balena/application(1116729)'}, u'__id': 1116729}, u'id': 1136312, u'is_locked_until__date': None, u'logs_channel': u'1da2f8db7c5edbf268ba6c34d91974de8e910eef0033a1172386ad27807552', u'uuid': u'0fcd753af396247e035de53b4e43eec3', u'is_managed_by__device': None, u'should_be_managed_by__supervisor_release': None, u'is_accessible_by_support_until__date': None, u'actor': 2895243, u'note': None, u'os_version': u'Balena OS 2.12.7+rev1', u'longitude': u'105.85', u'last_connectivity_event': u'2018-05-27T05:43:54.027Z', u'is_on__commit': u'01defe8bbd1b5b832b32c6e1d35890317671cbb5', u'location': u'Hanoi, Thanh Pho Ha Noi, Vietnam', u'status': u'Idle', u'public_address': u'14.231.243.124', u'is_connected_to_vpn': False, u'custom_latitude': u'', u'is_active': True, u'provisioning_state': u'', u'latitude': u'21.0333', u'custom_longitude': u'', 'current_services': {u'frontend': [{u'status': u'Running', u'download_progress': None, u'__metadata': {u'type': u'', u'uri': u'/balena/image_install(8952657)'}, u'install_date': u'2018-05-25T19:00:12.989Z', 'image_id': 296863, 'commit': u'01defe8bbd1b5b832b32c6e1d35890317671cbb5', 'service_id': 52327, u'id': 8952657}], u'data': [{u'status': u'Running', u'download_progress': None, u'__metadata': {u'type': u'', u'uri': u'/balena/image_install(8952656)'}, u'install_date': u'2018-05-25T19:00:12.989Z', 'image_id': 296864, 'commit': u'01defe8bbd1b5b832b32c6e1d35890317671cbb5', 'service_id': 52329, u'id': 8952656}], u'proxy': [{u'status': u'Running', u'download_progress': None, u'__metadata': {u'type': u'', u'uri': u'/balena/image_install(8952655)'}, u'install_date': u'2018-05-25T19:00:12.985Z', 'image_id': 296862, 'commit': u'01defe8bbd1b5b832b32c6e1d35890317671cbb5', 'service_id': 52328, u'id': 8952655}]}, u'is_online': False, u'supervisor_version': u'7.4.3', u'ip_address': u'192.168.0.102', u'provisioning_progress': None, u'owns__device_log': {u'__deferred': {u'uri': u'/balena/device_log(1136312)'}, u'__id': 1136312}, u'created_at': u'2018-05-25T10:55:47.825Z', u'download_progress': None, u'last_vpn_event': u'2018-05-27T05:43:54.027Z', u'device_name': u'billowing-night', u'local_id': None, u'vpn_address': None, 'current_gateway_downloads': []} +>>> balena.models.device.disable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` -### Function: grant_support_access(uuid, expiry_timestamp) -Grant support access to a device until a specified time. +## disable_lock_override -#### Args: - uuid (str): device uuid. - expiry_timestamp (int): a timestamp in ms for when the support access will expire. +Disable lock override. -#### Returns: - OK. +**Signature:** `balena.models.device.disable_lock_override(uuid_or_id)` ⇒ None -#### Examples: - >> > balena.models.device.grant_support_access('49b2a76b7f188c1d6f781e67c8f34adb4a7bfd2eec3f91d40b1efb75fe413d', 1511974999000) - 'OK' -### Function: has(uuid) +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -Check if a device exists. +## enable_device_url -#### Args: - uuid (str): device uuid. +Enable device url for a device. -#### Returns: - bool: True if device exists, False otherwise. -### Function: has_device_url(uuid) +**Signature:** `balena.models.device.enable_device_url(uuid_or_id_or_ids)` ⇒ None -Check if a device is web accessible with device urls +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Args: - uuid (str): device uuid. +**Examples:** +```python +>>> balena.models.device.enable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') +>>> balena.models.device.enable_device_url([123, 345]) +``` + +## enable_local_mode + +Enable local mode. -#### Raises: - DeviceNotFound: if device couldn't be found. +**Signature:** `balena.models.device.enable_local_mode(uuid_or_id)` ⇒ None -#### Examples: +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + +**Examples:** ```python ->>> balena.models.device.has_device_url('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -False +>>> balena.models.device.enable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` -### Function: has_lock_override(uuid) -Check if a device has the lock override enabled. +## enable_lock_override -#### Args: - uuid (str): device uuid. +Enable lock override. -#### Returns: - bool: lock override status. +**Signature:** `balena.models.device.enable_lock_override(uuid_or_id)` ⇒ None -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: identify(uuid) +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -Identify device. This function only works if you log in using credentials or Auth Token. +## generate_device_key -#### Args: - uuid (str): device uuid. +Generate a device key. -#### Examples: +**Signature:** `balena.models.device.generate_device_key(uuid_or_id, name, description, expiry_date)` ⇒ str + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + name (Optional[str]): device key name. + description (Optional[str]): description for device key. + expiry_date (Optional[str]): expiry date for device key, for example: `2030-01-01T00:00:00Z`. + +**Examples:** ```python ->>> balena.models.device.identify('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -'OK' +>>> balena.models.device.generate_device_key('df0926d8a5cf4293a1b3742c98a500a1') ``` -### Function: is_in_local_mode(uuid) -Check if local mode is enabled on the device. +## generate_uuid -#### Args: - uuid (str): device uuid. +Generate a random device UUID. -#### Returns: - bool: True if local mode enabled, otherwise False. +**Signature:** `balena.models.device.generate_uuid()` ⇒ str + +**Returns:** + str: a generated UUID. -#### Examples: +**Examples:** ```python ->>> balena.models.device.is_in_local_mode('b6070f4fea5edf808b576123157fe5ec') -True +>>> balena.models.device.generate_uuid() ``` -### Function: is_online(uuid) -Check if a device is online. +## get -#### Args: - uuid (str): device uuid. +This method returns a single device by id or uuid. -#### Returns: - bool: True if the device is online, False otherwise. +**Signature:** `balena.models.device.get(uuid_or_id, options)` ⇒ [TypeDevice](#typedevice) -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: is_tracking_application_release(uuid) +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + options (AnyObject): extra pine options to use -Get whether the device is configured to track the current application release. +**Returns:** + TypeDevice: device info. -#### Args: - uuid (str): device uuid. +**Examples:** +```python +>>> balena.models.device.get('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') +>>> balena.models.device.get('8deb12a7d7592c2b7f9e44735c2b0a41') +>>> balena.models.device.get(12345) +``` -#### Returns: - bool: is tracking the current application release. +## get_all -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: move(uuid, app_name) +This method returns all devices that the current user can access. +In order to have the following computed properties in the result +you have to explicitly define them in a `$select` in the extra options: + - overall_status + - overall_progress + - is_frozen -Move a device to another application. +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[TypeDevice]](#typedevice) -#### Args: - uuid (str): device uuid. - app_name (str): application name. +** Args:** + options (AnyObject): extra pine options to use -#### Raises: - DeviceNotFound: if device couldn't be found. - ApplicationNotFound: if application couldn't be found. - IncompatibleApplication: if moving a device to an application with different device-type. +**Returns:** + List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python ->>> balena.models.device.move('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143', 'RPI1Test') -'OK' +>>> balena.models.device.get_all() ``` -### Function: note(uuid, note) -Note a device. +## get_all_by_application -#### Args: - uuid (str): device uuid. - note (str): device note. +Get devices by application slug, uuid or id. + +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use -#### Raises: - DeviceNotFound: if device couldn't be found. +**Returns:** + List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python ->>> balena.models.device.note('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143', 'test device') -'OK' +>>> balena.models.device.get_all_by_application('my_org/RPI1') ``` -### Function: register(app_id, uuid) -Register a new device with a balena application. This function only works if you log in using credentials or Auth Token. +## get_all_by_organization -#### Args: - app_id (str): application id. - uuid (str): device uuid. +Get devices by organization slug, uuid or id. -#### Returns: - dict: dictionary contains device info. +**Signature:** `balena.models.device.get_all_by_organization(handle_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** + handle_or_id (Union[str, int]): organization handle (string) or id (number). + options (AnyObject): extra pine options to use + +**Returns:** + List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python ->>> device_uuid = balena.models.device.generate_uuid() ->>> balena.models.device.register('RPI1',device_uuid) -{'id':122950,'application':{'__deferred':{'uri':'/ewa/application(9020)'},'__id':9020},'user':{'__deferred':{'uri':'/ewa/user(5397)'},'__id':5397},'name':'floral-mountain','device_type':'raspberry-pi','uuid':'8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143','commit':null,'note':null,'status':null,'is_online':false,'last_connectivity_event':'1970-01-01T00:00:00.000Z','ip_address':null,'vpn_address':null,'public_address':'','os_version':null,'supervisor_version':null,'supervisor_release':null,'provisioning_progress':null,'provisioning_state':null,'download_progress':null,'is_web_accessible':false,'longitude':'','latitude':'','location':'','logs_channel':null,'__metadata':{'uri':'/ewa/device(122950)','type':''}} +>>> balena.models.device.get_all_by_organization('my_org') +>>> balena.models.device.get_all_by_organization(123) ``` -### Function: remove(uuid) -Remove a device. This function only works if you log in using credentials or Auth Token. +## get_application_info -#### Args: - uuid (str): device uuid. -### Function: rename(uuid, new_name) +***Deprecated*** +Return information about the application running on the device. +This function requires supervisor v1.8 or higher. -Rename a device. +**Signature:** `balena.models.device.get_application_info(uuid_or_id)` ⇒ Any -#### Args: - uuid (str): device uuid. - new_name (str): device new name. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Raises: - DeviceNotFound: if device couldn't be found. +**Returns:** + dict: dictionary contains application information. -#### Examples: +**Examples:** ```python ->>> balena.models.device.rename('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143', 'python-sdk-test-device') -'OK' -# Check device name. ->>> balena.models.device.get_name('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -u'python-sdk-test-device' +>>> balena.models.device.get_application_info('7f66ec3c5da146c3b6a84aaed1c07581') ``` -### Function: restart(uuid) - -Restart a user application container on device. This function only works if you log in using credentials or Auth Token. -#### Args: - uuid (str): device uuid. +## get_application_name -#### Raises: - DeviceNotFound: if device couldn't be found. +Get application name by device uuid. -#### Examples: -```python ->>> balena.models.device.restart('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -'OK' -``` -### Function: revoke_support_access(uuid) +**Signature:** `balena.models.device.get_application_name(uuid_or_id)` ⇒ str -Revoke support access to a device. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Args: - uuid (str): device uuid. +**Returns:** + str: application name. -#### Returns: - OK. +## get_by_name -#### Examples: - >> > balena.models.device.revoke_support_access('49b2a76b7f188c1d6f781e67c8f34adb4a7bfd2eec3f91d40b1efb75fe413d') - 'OK' -### Function: set_custom_location(uuid, location) +Get devices by device name. -Set a custom location for a device. +**Signature:** `balena.models.device.get_by_name(name, options)` ⇒ [List[TypeDevice]](#typedevice) -#### Args: - uuid (str): device uuid. - location (dict): device custom location, format: { 'latitude': , 'longitude': }. +**Args:** + name (str): device name. -#### Raises: - DeviceNotFound: if device couldn't be found. +**Returns:** + List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python ->>> location = { - 'latitude': '21.032777', - 'longitude': '105.831586' -} ->>> balena.models.device.set_custom_location('df09262c283b1dc1462d0e82caa7a88e52588b8c5d7475dd22210edec1c50a',location) -OK +>>> balena.models.device.get_by_name('floral-mountain') ``` -### Function: set_to_release(uuid, commit_id) -Set device to a specific release. -Set an empty commit_id will restore rolling releases to the device. +## get_dashboard_url -#### Args: - uuid (str): device uuid. - commit_id (str) : commit id. +Get balena Dashboard URL for a specific device. + +**Signature:** `balena.models.device.get_dashboard_url(uuid)` ⇒ None -#### Returns: - OK. +**Args:** + uuid (str): device uuid. -#### Examples: +**Examples:** ```python ->>> balena.models.device.set_to_release('49b2a76b7f188c1d6f781e67c8f34adb4a7bfd2eec3f91d40b1efb75fe413d', '45c90004de73557ded7274d4896a6db90ea61e36') -'OK' +>>> balena.models.device.get_dashboard_url('19619a6317072b65a240b451f45f855d') ``` -### Function: set_to_release_by_id(uuid, release_id) -Set device to a specific release by release id (please notice that release id is not the commit hash on balena dashboard). -Remove release_id will restore rolling releases to the device. +## get_device_url -#### Args: - uuid (str): device uuid. - release_id (Optional[int]): release id. +Get a device url for a device. -#### Returns: - OK. +**Signature:** `balena.models.device.get_device_url(uuid_or_id)` ⇒ str -#### Examples: +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + +**Examples:** ```python ->>> balena.models.device.set_to_release_by_id('49b2a76b7f188c1d6f781e67c8f34adb4a7bfd2eec3f91d40b1efb75fe413d', 165432) -'OK' ->>> balena.models.device.set_to_release_by_id('49b2a76b7f188c1d6f781e67c8f34adb4a7bfd2eec3f91d40b1efb75fe413d') -'OK' +>>> balena.models.device.get_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` -### Function: start_os_update(uuid, target_os_version) -Start an OS update on a device. +## get_local_ip_address -#### Args: - uuid (str): device uuid. - target_os_version (str): semver-compatible version for the target device. - Unsupported (unpublished) version will result in rejection. - The version **must** be the exact version number, a "prod" variant and greater than the one running on the device. +Get the local IP addresses of a device. + +**Signature:** `balena.models.device.get_local_ip_address(uuid_or_id)` ⇒ List[str] + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + +**Returns:** + List[str]: IP addresses of a device. + +## get_local_mode_support -#### Returns: - dict: action response. +Returns whether local mode is supported and a message describing the reason why local mode is not supported. -#### Raises: - DeviceNotFound: if device couldn't be found. - InvalidParameter|OsUpdateError: if target_os_version is invalid. +**Signature:** `balena.models.device.get_local_mode_support(uuid_or_id)` ⇒ LocalModeResponse -#### Examples: +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + +**Returns:** + dict: local mode support information ({'supported': True/False, 'message': '...'}). + +**Examples:** ```python ->>> balena.models.device.start_os_update('b6070f4fea5edf808b576123157fe5ec', '2.29.2+rev1.prod') -{u'status': u'in_progress', u'action': u'resinhup', u'parameters': {u'target_version': u'2.29.2+rev1.prod'}, u'last_run': 1554490809219L} +>>> balena.models.device.get_local_mode_support('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` -### Function: track_application_release(uuid) -Configure a specific device to track the current application release. +## get_mac_address -#### Args: - uuid (str): device uuid. +Get the MAC addresses of a device. -#### Raises: - DeviceNotFound: if device couldn't be found. -### Function: unset_custom_location(uuid) +**Signature:** `balena.models.device.get_mac_address(uuid_or_id)` ⇒ List[str] -clear custom location for a device. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Args: - uuid (str): device uuid. +**Returns:** + List[str]: MAC addresses of a device. -#### Raises: - DeviceNotFound: if device couldn't be found. +## get_metrics -#### Examples: -```python ->>> balena.models.device.unset_custom_location('df09262c283b1dc1462d0e82caa7a88e52588b8c5d7475dd22210edec1c50a') -OK -``` -## DeviceOs +Gets the metrics related information for a device. -This class implements device os model for balena python SDK. -### Function: download(raw) +**Signature:** `balena.models.device.get_metrics(uuid_or_id)` ⇒ [DeviceMetricsType](#devicemetricstype) -Download an OS image. This function only works if you log in using credentials or Auth Token. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Args: - raw (bool): determining function return value. - **data: os parameters keyword arguments. - version (str): the balenaOS version of the image. The SDK will try to parse version into semver-compatible version, unsupported (unpublished) version will result in rejection. - appId (str): the application ID. - network (str): the network type that the device will use, one of 'ethernet' or 'wifi'. - fileType (Optional[str]): one of '.img' or '.zip' or '.gz', defaults to '.img'. - wifiKey (Optional[str]): the key for the wifi network the device will connect to if network is wifi. - wifiSsid (Optional[str]): the ssid for the wifi network the device will connect to if network is wifi. - appUpdatePollInterval (Optional[str]): how often the OS checks for updates, in minutes. +**Returns:** + dict: metrics of the device. -#### Returns: - object: - If raw is True, urllib3.HTTPResponse object is returned. - If raw is False, original response object is returned. +## get_name -#### Notes: - default OS image file name can be found in response headers. +Get device name by device uuid. -#### Examples: -```python ->>> data = {'appId': '1476418', 'network': 'ethernet', 'version': '2.43.0+rev1.prod'} ->>> response = balena.models.device_os.download(**data) ->>> type(response) - ->>> response['headers'] ->>> response.headers -{'Content-Length': '134445838', 'Access-Control-Allow-Headers': 'Content-Type, Authorization, Application-Record-Count, MaxDataServiceVersion, X-Requested-With, X-Balena-Client', 'content-disposition': 'attachment; filename="balena-cloud-FooBar4-raspberry-pi2-2.43.0+rev1-v10.2.2.img.zip"', 'X-Content-Type-Options': 'nosniff', 'Access-Control-Max-Age': '86400', 'x-powered-by': 'Express', 'Vary': 'X-HTTP-Method-Override', 'x-transfer-length': '134445838', 'Connection': 'keep-alive', 'Access-Control-Allow-Credentials': 'true', 'Date': 'Tue, 07 Jan 2020 17:40:52 GMT', 'X-Frame-Options': 'DENY', 'Access-Control-Allow-Methods': 'GET, PUT, POST, PATCH, DELETE, OPTIONS, HEAD', 'Content-Type': 'application/zip', 'Access-Control-Allow-Origin': '*'} -``` -### Function: download_unconfigured_image(device_type, version, raw) +**Signature:** `balena.models.device.get_name(uuid_or_id)` ⇒ str -Download an unconfigured OS image. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Args: - device_type (str): device type slug. - version (str): the balenaOS version of the image. The SDK will try to parse version into semver-compatible version, unsupported (unpublished) version will result in rejection. - raw (bool): determining function return value. - -#### Returns: - object: - If raw is True, urllib3.HTTPResponse object is returned. - If raw is False, original response object is returned. - -#### Notes: - default OS image file name can be found in response headers. - -#### Examples: -```python ->>> response = balena.models.device_os.download_unconfigured_image('raspberry-pi2', 'latest') ->>> type(response) - ->>> response['headers'] ->>> response.headers -{'Access-Control-Allow-Headers': 'Content-Type, Authorization, Application-Record-Count, MaxDataServiceVersion, X-Requested-With, X-Balena-Client', 'content-disposition': 'attachment; filename="balena-cloud-raspberry-pi2-2.43.0+rev1-v10.2.2.img"', 'X-Content-Type-Options': 'nosniff', 'Access-Control-Max-Age': '86400', 'Transfer-Encoding': 'chunked', 'x-powered-by': 'Express', 'content-encoding': 'gzip', 'x-transfer-length': '134445269', 'last-modified': 'Mon, 23 Sep 2019 15:21:33 GMT', 'Connection': 'keep-alive', 'Access-Control-Allow-Credentials': 'true', 'Date': 'Tue, 07 Jan 2020 18:14:47 GMT', 'X-Frame-Options': 'DENY', 'Access-Control-Allow-Methods': 'GET, PUT, POST, PATCH, DELETE, OPTIONS, HEAD', 'Content-Type': 'application/octet-stream', 'Access-Control-Allow-Origin': '*'} -``` -### Function: get_config(app_id, options) - -Get an application config.json. - -#### Args: - app_id (str): application id. - options (dict): OS configuration options to use. The available options are listed below: - version (str): the OS version of the image. - network (Optional[str]): the network type that the device will use, one of 'ethernet' or 'wifi' and defaults to 'ethernet' if not specified. - appUpdatePollInterval (Optional[str]): how often the OS checks for updates, in minutes. - wifiKey (Optional[str]): the key for the wifi network the device will connect to. - wifiSsid (Optional[str]): the ssid for the wifi network the device will connect to. - ip (Optional[str]): static ip address. - gateway (Optional[str]): static ip gateway. - netmask (Optional[str]): static ip netmask. +**Returns:** + str: device name. + +## get_os_update_status + +***Deprecated*** +Get the OS update status of a device. -#### Returns: - dict: application config.json -### Function: get_device_os_semver_with_variant(os_version, os_variant) +**Signature:** `balena.models.device.get_os_update_status(uuid_or_id)` ⇒ HUPStatusResponse -Get current device os semver with variant. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Args: - os_version (str): current os version. - os_variant (Optional[str]): os variant. +**Returns:** + HUPStatusResponse: action response. -#### Examples: +**Examples:** ```python ->>> balena.models.device_os.get_device_os_semver_with_variant('balenaOS 2.29.2+rev1', 'prod') -'2.29.2+rev1.prod' +>>> balena.models.device.get_os_update_status('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` -### Function: get_supported_versions(device_type) -Get OS supported versions. +## get_status -#### Args: - device_type (str): device type slug +Get the status of a device. -#### Returns: - dict: the versions information, of the following structure: - * versions - an array of strings, containing exact version numbers supported by the current environment. - * recommended - the recommended version, i.e. the most recent version that is _not_ pre-release, can be `None`. - * latest - the most recent version, including pre-releases. - * default - recommended (if available) or latest otherwise. -### Function: is_architecture_compatible_with(os_architecture, application_architecture) +**Signature:** `balena.models.device.get_status(uuid_or_id)` ⇒ str -Returns whether the specified OS architecture is compatible with the target architecture. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Args: - os_architecture (str): The OS's architecture as specified in its device type. - application_architecture (str): The application's architecture as specified in its device type. +**Returns:** + str: status of a device. -#### Returns: - bool: Whether the specified OS architecture is capable of running applications build for the target architecture. -### Function: parse_params() +**Examples:** +```python +>>> balena.models.device.get_status('8deb12a7d7592c2b7f9e44735c2b0a41') +``` -Validate parameters for downloading device OS image. +## get_supervisor_state -#### Args: - **parameters: os parameters keyword arguments. +Get the supervisor state on a device -#### Returns: - dict: validated parameters. +**Signature:** `balena.models.device.get_supervisor_state(uuid_or_id)` ⇒ SupervisorStateType -#### Raises: - MissingOption: if mandatory option are missing. - InvalidOption: if appId or network are invalid (appId is not a number or parseable string. network is not in NETWORK_TYPES) -## EnvironmentVariable +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -This class is a wrapper for environment variable models. -## ApplicationEnvVariable +**Returns:** + dict: supervisor state. -This class implements application environment variable model for balena python SDK. +**Examples:** +```python +>>> balena.models.device.get_supervisor_state('b6070f4fea5a4f11b4d05c1f1c3b4e72') +``` -#### Attributes: - SYSTEM_VARIABLE_RESERVED_NAMES (list): list of reserved system variable names. - OTHER_RESERVED_NAMES_START (list): list of prefix for system variable. -### Function: create(app_id, env_var_name, value) +## get_supervisor_target_state -Create an environment variable for application. +Get the supervisor target state on a device -#### Args: - app_id (str): application id. - env_var_name (str): environment variable name. - value (str): environment variable value. +**Signature:** `balena.models.device.get_supervisor_target_state(uuid_or_id)` ⇒ Any -#### Returns: - dict: new application environment info. +**Args:** + uuid_or_id (Union[str, int]): device uuid (str) or id (int). -#### Examples: +**Returns:** + DeviceStateType: supervisor target state. + +**Examples:** ```python ->>> balena.models.environment_variables.application.create('978062', 'test2', '123') -{'id': 91138, 'application': {'__deferred': {'uri': '/balena/application(978062)'}, '__id': 978062}, 'name': 'test2', 'value': '123', '__metadata': {'uri': '/balena/environment_variable(91138)', 'type': ''}} +>>> balena.models.device.get_supervisor_target_state('b6070f4fea5edf808b576123157fe5ec') ``` -### Function: get_all(app_id) -Get all environment variables by application. +## get_supervisor_target_state_for_app + +Get the supervisor target state on a device -#### Args: - app_id (str): application id. +**Signature:** `balena.models.device.get_supervisor_target_state_for_app(slug_or_uuid_or_id, release)` ⇒ Any -#### Returns: - list: application environment variables. +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + release (Optional[Union[str, int]]): (optional) release uuid (default tracked) +**Returns:** + DeviceStateType: supervisor target state. -#### Examples: +**Examples:** ```python ->>> balena.models.environment_variables.application.get_all(9020) -[{u'application': {u'__deferred': {u'uri': u'/ewa/application(9020)'}, u'__id': 9020}, u'__metadata': {u'type': u'', u'uri': u'/ewa/environment_variable(5650)'}, u'id': 5650, u'value': u'7330634368117899', u'name': u'BALENA_RESTART'}] +>>> balena.models.device.get_supervisor_target_state_for_app('myorg/myapp') ``` -### Function: is_system_variable(variable) -Check if a variable is system specific. +## get_with_service_details -#### Args: - variable (str): environment variable name. +This method does not map exactly to the underlying model: it runs a +larger prebuilt query, and reformats it into an easy to use and +understand format. If you want more control, or to see the raw model +directly, use `device.get(uuidOrId, options)` instead. -#### Returns: - bool: True if system variable, False otherwise. +**Signature:** `balena.models.device.get_with_service_details(uuid_or_id, options)` ⇒ [TypeDeviceWithServices](#typedevicewithservices) -#### Examples: +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + options (AnyObject): extra pine options to use + +**Returns:** + dict: device info with associated services details. + +**Examples:** ```python ->>> balena.models.environment_variables.application.is_system_variable('BALENA_API_KEY') -True ->>> balena.models.environment_variables.application.is_system_variable('APPLICATION_API_KEY') -False +>>> balena.models.device.get_with_service_details('0fcd753af396247e035de53b4e43eec3') ``` -### Function: remove(var_id) -Remove application environment variable. +## grant_support_access + +Grant support access to a device until a specified time. + +**Signature:** `balena.models.device.grant_support_access(uuid_or_id_or_ids, expiry_timestamp)` ⇒ None -#### Args: - var_id (str): environment variable id. +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) + expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Examples: +**Examples:** ```python ->>> balena.models.environment_variables.application.remove(5652) -'OK' +>>> balena.models.device.grant_support_access('49b2a76e8a8d4a2b918c08a23b423580', 1511974999000) ``` -### Function: update(var_id, value) -Update an environment variable value for application. +## has -#### Args: - var_id (str): environment variable id. - value (str): new environment variable value. +Check if a device exists. -#### Examples: -```python ->>> balena.models.environment_variables.application.update(5652, 'new value') -'OK' -``` -## ServiceEnvVariable +**Signature:** `balena.models.device.has(uuid_or_id)` ⇒ bool -This class implements service environment variable model for balena python SDK. -### Function: create(app_id, service_name, env_var_name, value) +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -Create a service environment variable for application. +**Returns:** + bool: True if device exists, False otherwise. -#### Args: - app_id (str): application id. - service_name(str): service name. - env_var_name (str): environment variable name. - value (str): environment variable value. +## has_device_url -#### Returns: - str: new service environment variable info. +Check if a device is web accessible with device urls + +**Signature:** `balena.models.device.has_device_url(uuid_or_id)` ⇒ bool -#### Examples: +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + +**Examples:** ```python ->>> balena.models.environment_variables.service_environment_variable.create('1005160', 'proxy', 'app_proxy', 'test value') -{"id":12444,"created_at":"2018-03-18T09:34:09.144Z","service":{"__deferred":{"uri":"/balena/service(21668)"},"__id":21668},"name":"app_proxy","value":"test value","__metadata":{"uri":"/balena/service_environment_variable(12444)","type":""}} +>>> balena.models.device.has_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` -### Function: get_all_by_application(app_id) -Get all service environment variables by application. +## has_lock_override -#### Args: - app_id (str): application id. +Check if a device has the lock override enabled. -#### Returns: - list: service application environment variables. +**Signature:** `balena.models.device.has_lock_override(uuid_or_id)` ⇒ bool -#### Examples: -```python ->>> balena.models.environment_variables.service_environment_variable.get_all_by_application('1005160') -[{u'name': u'app_data', u'service': {u'__deferred': {u'uri': u'/balena/service(21667)'}, u'__id': 21667}, u'created_at': u'2018-03-16T19:21:21.087Z', u'__metadata': {u'type': u'', u'uri': u'/balena/service_environment_variable(12365)'}, u'value': u'app_data_value', u'id': 12365}, {u'name': u'app_data1', u'service': {u'__deferred': {u'uri': u'/balena/service(21667)'}, u'__id': 21667}, u'created_at': u'2018-03-16T19:21:49.662Z', u'__metadata': {u'type': u'', u'uri': u'/balena/service_environment_variable(12366)'}, u'value': u'app_data_value', u'id': 12366}, {u'name': u'app_front', u'service': {u'__deferred': {u'uri': u'/balena/service(21669)'}, u'__id': 21669}, u'created_at': u'2018-03-16T19:22:06.955Z', u'__metadata': {u'type': u'', u'uri': u'/balena/service_environment_variable(12367)'}, u'value': u'front_value', u'id': 12367}] -``` -### Function: remove(var_id) +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -Remove service environment variable. +**Returns:** + bool: lock override status. -#### Args: - var_id (str): service environment variable id. +## identify -#### Examples: -```python ->>> balena.models.environment_variables.service_environment_variable.remove('12444') -'OK' -``` -### Function: update(var_id, value) +Identify device. -Update a service environment variable value for application. +**Signature:** `balena.models.device.identify(uuid_or_id)` ⇒ None -#### Args: - var_id (str): service environment variable id. - value (str): new service environment variable value. +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.environment_variables.service_environment_variable.update('12444', 'new test value') -'OK' +>>> balena.models.device.identify('8deb12a7d7592c2b7f9e44735c2b0a41') ``` -## DeviceEnvVariable -This class implements device environment variable model for balena python SDK. -### Function: create(uuid, env_var_name, value) +## is_in_local_mode -Create a device environment variable. +Check if local mode is enabled on the device. -#### Args: - uuid (str): device uuid. - env_var_name (str): environment variable name. - value (str): environment variable value. +**Signature:** `balena.models.device.is_in_local_mode(uuid_or_id)` ⇒ bool -#### Returns: - dict: new device environment variable info. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + +**Returns:** + bool: True if local mode enabled, otherwise False. -#### Examples: +**Examples:** ```python ->>> balena.models.environment_variables.device.create('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143','test_env4', 'testing1') -{'name': u'test_env4', u'__metadata': {u'type': u'', u'uri': u'/balena/device_environment_variable(42166)'}, u'value': u'testing1', u'device': {u'__deferred': {u'uri': u'/balena/device(115792)'}, u'__id': 115792}, u'id': 42166} +>>> balena.models.device.is_in_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` -### Function: get_all(uuid) -Get all device environment variables. +## is_online -#### Args: - uuid (str): device uuid. +Check if a device is online. -#### Returns: - list: device environment variables. +**Signature:** `balena.models.device.is_online(uuid_or_id)` ⇒ bool -#### Examples: -```python ->>> balena.models.environment_variables.device.get_all('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') -[{u'device': {u'__deferred': {u'uri': u'/ewa/device(122950)'}, u'__id': 122950}, u'__metadata': {u'type': u'', u'uri': u'/ewa/device_environment_variable(2173)'}, u'id': 2173, u'value': u'1322944771964103', u'env_var_name': u'BALENA_DEVICE_RESTART'}] -``` -### Function: get_all_by_application(app_id) +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -Get all device environment variables for an application. +**Returns:** + bool: True if the device is online, False otherwise. + +## is_tracking_application_release -#### Args: - app_id (str): application id. +Get whether the device is configured to track the current application release. -#### Returns: - list: list of device environment variables. +**Signature:** `balena.models.device.is_tracking_application_release(uuid_or_id)` ⇒ bool -#### Examples: -```python ->>> balena.models.environment_variables.device.get_all_by_application('5780') -[{'name': u'device1', u'__metadata': {u'type': u'', u'uri': u'/balena/device_environment_variable(40794)'}, u'value': u'test', u'device': {u'__deferred': {u'uri': u'/balena/device(115792)'}, u'__id': 115792}, u'id': 40794}, {'name': u'BALENA_DEVICE_RESTART', u'__metadata': {u'type': u'', u'uri': u'/balena/device_environment_variable(1524)'}, u'value': u'961506585823372', u'device': {u'__deferred': {u'uri': u'/balena/device(121794)'}, u'__id': 121794}, u'id': 1524}] -``` -### Function: remove(var_id) +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -Remove a device environment variable. +**Returns:** + bool: is tracking the current application release. + +## move + +Move a device to another application. -#### Args: - var_id (str): environment variable id. +**Signature:** `balena.models.device.move(uuid_or_id, app_slug_or_uuid_or_id)` ⇒ None -#### Examples: +**Args:** + uuid_or_id (Union[str, int]): device uuid (str) or id (int). + app_slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + +**Examples:** ```python ->>> balena.models.environment_variables.device.remove(2184) -'OK' +>>> balena.models.device.move(123, 'RPI1Test') ``` -### Function: update(var_id, value) -Update a device environment variable. +## pin_to_os_release + +Mark a specific device to be updated to a particular OS release -#### Args: - var_id (str): environment variable id. - value (str): new environment variable value. +**Signature:** `balena.models.device.pin_to_os_release(uuid_or_id, target_os_version)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int). + target_os_version (str): semver-compatible version for the target device. + Unsupported (unpublished) version will result in rejection. + The version **must** be the exact version number, a "prod" variant + and greater or equal to the one running on the device. -#### Examples: +**Examples:** ```python ->>> balena.models.environment_variables.device.update(2184, 'new value') -'OK' +>>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') +>>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') ``` -## DeviceServiceEnvVariable -This class implements device service variable model for balena python SDK. -### Function: create(uuid, service_name, env_var_name, value) +## pin_to_release -Create a device service environment variable. +Configures the device to run a particular release +and not get updated when the current application release changes. -#### Args: - uuid (str): device uuid. - service_name (str): service name. - env_var_name (str): device service environment variable name. - value (str): device service environment variable value. +**Signature:** `balena.models.device.pin_to_release(uuid_or_id, full_release_hash_or_id)` ⇒ None -#### Returns: - dict: new device service environment variable info. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + full_release_hash_or_id (Union[str, int]) : the hash of a successful release (string) or id (number) -#### Examples: +**Examples:** ```python ->>> balena.models.environment_variables.device_service_environment_variable.create('f5213eac0d63ac47721b037a7406d306', 'data', 'dev_data_sdk', 'test1') -{"id":28970,"created_at":"2018-03-17T10:13:14.184Z","service_install":{"__deferred":{"uri":"/balena/service_install(30789)"},"__id":30789},"value":"test1","name":"dev_data_sdk","__metadata":{"uri":"/balena/device_service_environment_variable(28970)","type":""}} +>>> balena.models.device.pin_to_release('49b2a', '45c90004de73557ded7274d4896a6db90ea61e36') ``` -### Function: get_all(uuid) - -Get all device service environment variables belong to a device. -#### Args: - uuid (str): device uuid. +## pin_to_supervisor_release -#### Returns: - list: device service environment variables. +Set a specific device to run a particular supervisor release. +**Signature:** `balena.models.device.pin_to_supervisor_release(uuid_or_id, supervisor_version_or_id)` ⇒ None -#### Examples: +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + supervisor_version_or_id (Union[str, int]): the version of a released supervisor (string) or id (number) +**Examples:** ```python ->>> balena.models.environment_variables.device_service_environment_variable.get_all('f5213eac0d63ac47721b037a7406d306') -[{u'name': u'dev_proxy', u'created_at': u'2018-03-16T19:23:21.727Z', u'__metadata': {u'type': u'', u'uri': u'/balena/device_service_environment_variable(28888)'}, u'value': u'value', u'service_install': [{u'__metadata': {u'type': u'', u'uri': u'/balena/service_install(30788)'}, u'id': 30788, u'service': [{u'service_name': u'proxy', u'__metadata': {u'type': u'', u'uri': u'/balena/service(NaN)'}}]}], u'id': 28888}, {u'name': u'dev_data', u'created_at': u'2018-03-16T19:23:11.614Z', u'__metadata': {u'type': u'', u'uri': u'/balena/device_service_environment_variable(28887)'}, u'value': u'dev_data_value', u'service_install': [{u'__metadata': {u'type': u'', u'uri': u'/balena/service_install(30789)'}, u'id': 30789, u'service': [{u'service_name': u'data', u'__metadata': {u'type': u'', u'uri': u'/balena/service(NaN)'}}]}], u'id': 28887}, {u'name': u'dev_data1', u'created_at': u'2018-03-17T05:53:19.257Z', u'__metadata': {u'type': u'', u'uri': u'/balena/device_service_environment_variable(28964)'}, u'value': u'aaaa', u'service_install': [{u'__metadata': {u'type': u'', u'uri': u'/balena/service_install(30789)'}, u'id': 30789, u'service': [{u'service_name': u'data', u'__metadata': {u'type': u'', u'uri': u'/balena/service(NaN)'}}]}], u'id': 28964}] +>>> balena.models.device.pin_to_supervisor_release('f55dcdd9ada04b11b4d05c1f1c3b4e72', 'v13.0.0') ``` -### Function: get_all_by_application(app_id) -Get all device service environment variables belong to an application. +## ping -#### Args: - app_id (int): application id. +Ping a device. +This is useful to signal that the supervisor is alive and responding. + +**Signature:** `balena.models.device.ping(uuid_or_id)` ⇒ None -#### Returns: - list: list of device service environment variables. +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.environment_variables.device_service_environment_variable.get_all_by_application(1043050) -[{'id': 566017, 'created_at': '2021-04-23T08:28:08.539Z', 'service_install': {'__id': 1874939, '__deferred': {'uri': '/resin/service_install(@id)?@id=1874939'}}, 'value': '1', 'name': 'testEnv1', '__metadata': {'uri': '/resin/device_service_environment_variable(@id)?@id=566017'}}, {'id': 566015, 'created_at': '2021-04-23T08:17:45.767Z', 'service_install': {'__id': 1874939, '__deferred': {'uri': '/resin/service_install(@id)?@id=1874939'}}, 'value': '12', 'name': 'testEnv2', '__metadata': {'uri': '/resin/device_service_environment_variable(@id)?@id=566015'}}] +>>> balena.models.device.ping('8f66ec7335dd4a97b7661faa131b1502') +>>> balena.models.device.ping(1234) ``` -### Function: remove(var_id) -Remove a device service environment variable. +## purge + +Purge device. +This function clears the user application's `/data` directory. -#### Args: - var_id (str): device service environment variable id. +**Signature:** `balena.models.device.purge(uuid_or_id)` ⇒ None -#### Examples: +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. + +**Examples:** ```python ->>> balena.models.environment_variables.device_service_environment_variable.remove('28970') -'OK' +>>> balena.models.device.purge('8f66ec7335dd4a97b7661faa131b1502') ``` -### Function: update(var_id, value) -Update a device service environment variable. +## reboot + +Reboot the device. + +**Signature:** `balena.models.device.reboot(uuid_or_id, force)` ⇒ None -#### Args: - var_id (str): device environment variable id. - value (str): new device environment variable value. +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. + force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python ->>> balena.models.environment_variables.device_service_environment_variable.update('28970', 'test1 new value') -'OK' +>>> balena.models.device.reboot('8f66ec7335dd4a97b7661faa131b1502') ``` -## Image -This class implements image model for balena python SDK. -### Function: get(id) +## register -Get a specific image. +Register a new device with a balena application. -#### Args: - id (str): image id. +**Signature:** `balena.models.device.register(application_slug_or_uuid_or_id, uuid, device_type_slug)` ⇒ RegisterResponse -#### Returns: - dict: image info. +**Args:** + application_slug_or_uuid_or_id (Union[int, str]): application slug (string), uuid (string) or id (number). + uuid (str): device uuid. + device_type_slug (Optional[str]): device type slug or alias. -#### Raises: - ImageNotFound: if image couldn't be found. -### Function: get_log(id) +**Returns:** + dict: dictionary contains device info. -Get the build log from an image. +**Examples:** +```python +>>> device_uuid = balena.models.device.generate_uuid() +>>> balena.models.device.register('RPI1',device_uuid) +``` -#### Args: - id (str): image id. +## remove -#### Returns: - str: build log. +Remove device(s). -#### Raises: - ImageNotFound: if image couldn't be found. -## Organization +**Signature:** `balena.models.device.remove(uuid_or_id_or_ids)` ⇒ None -This class implements organization model for balena python SDK. -### Function: create(name, handle) +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -Creates a new organization. +## rename -#### Args: - name (str): the name of the organization that will be created. - handle (Optional[str]): The handle of the organization that will be created. +Renames a device. -#### Returns: - dict: organization info. +**Signature:** `balena.models.device.rename(uuid_or_id, new_name)` ⇒ None -#### Examples: +**Args:** + uuid_or_id (Union[str, int]): device uuid (str) or id (int) + new_name (str): device new name. + +**Examples:** ```python ->>> balena.models.organization.create('My Org', 'test_org') -'{'id': 147950, 'created_at': '2020-06-23T09:33:25.187Z', 'name': 'My Org', 'handle': 'test_org', 'billing_account_code': None, '__metadata': {'uri': '/resin/organization(@id)?@id=147950'}}' +>>> balena.models.device.rename(123, 'python-sdk-test-device') ``` -### Function: get(org_id) -Get a single organization by id. +## restart_application -#### Args: - org_id (str): organization id. +This function restarts the Docker container running +the application on the device, but doesn't reboot +the device itself. -#### Returns: - dict: organization info. +**Signature:** `balena.models.device.restart_application(uuid_or_id)` ⇒ None -#### Raises: - OrganizationNotFound: if organization couldn't be found. +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.organization.get('26474') -'{'id': 26474, 'created_at': '2018-08-14T00:24:33.144Z', 'name': 'test_account1', 'handle': 'test_account1', 'billing_account_code': None, '__metadata': {'uri': '/resin/organization(@id)?@id=26474'}}' +>>> balena.models.device.restart_application('8deb12a7d7592c2b7f9e44735c2b0a41') +>>> balena.models.device.restart_application(1234) ``` -### Function: get_all() -Get all organizations. +## restart_service + +Restart a service on device. -#### Returns: - list: list contains information of organizations. +**Signature:** `balena.models.device.restart_service(uuid_or_id, image_id)` ⇒ None -#### Examples: +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. + image_id (int): id of the image to restart + +**Examples:** ```python ->>> balena.models.organization.get_all() -'[{'id': 26474, 'created_at': '2018-08-14T00:24:33.144Z', 'name': 'test_account1', 'handle': 'test_account1', 'billing_account_code': None, '__metadata': {'uri': '/resin/organization(@id)?@id=26474'}}]' +>>> balena.models.device.restart_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) +>>> balena.models.device.restart_service(None, 392229) # if running on the device ``` -### Function: get_by_handle(handle) -Get a single organization by handle. +## revoke_support_access -#### Args: - handle (str): organization handle. +Revoke support access to a device. -#### Returns: - dict: organization info. +**Signature:** `balena.models.device.revoke_support_access(uuid_or_id_or_ids)` ⇒ None -#### Raises: - OrganizationNotFound: if organization couldn't be found. +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python ->>> balena.models.organization.get_by_handle('test_account1') -''{'id': 26474, 'created_at': '2018-08-14T00:24:33.144Z', 'name': 'test_account1', 'handle': 'test_account1', 'billing_account_code': None, '__metadata': {'uri': '/resin/organization(@id)?@id=26474'}}'' +>>> balena.models.device.revoke_support_access('49b2a76e8a8d4a2b918c08a23b423580') ``` -### Function: remove(org_id) -Remove an organization. +## set_custom_location -#### Args: - org_id (str): organization id. +Set a custom location for a device. -#### Returns: - dict: organization info. +**Signature:** `balena.models.device.set_custom_location(uuid_or_id_or_ids, location)` ⇒ None -#### Examples: +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) + location (dict): device custom location { 'latitude': Union[int,, str], 'longitude': Union[int, str]}. + +**Examples:** ```python ->>> balena.models.organization.remove('148003') -'OK +>>> balena.models.device.set_custom_location(123, {'latitude': '21.032777','longitude': '105.831586'}) ``` -## Release -This class implements release model for balena python SDK. -### Function: create_from_url(app_id, url, flatten_tarball) +## set_note -Create a new release built from the source in the provided url. +Note a device. -#### Args: - app_id (int): application id. - url (str): a url with a tarball of the project to build. - flatten_tarball (Optional[bool]): Should be true when the tarball includes an extra root folder with all the content. +**Signature:** `balena.models.device.set_note(uuid_or_id_or_ids, note)` ⇒ None -#### Returns: - int: release Id. +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) + note (str): device note. -#### Raises: - BuilderRequestError: if builder returns any errors. -### Function: get(commit_or_id) +**Examples:** +```python +>>> balena.models.device.note(123, 'test note') +``` -Get a specific release. +## shutdown -#### Args: - commit_or_id: release commit (str) or id (int). +Shutdown the device. -#### Returns: - dict: release info. +**Signature:** `balena.models.device.shutdown(uuid_or_id, force)` ⇒ None -#### Raises: +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. + force (Optional[bool]): If force is True, the update lock will be overridden. + +**Examples:** +```python +>>> balena.models.device.shutdown('8f66ec7335dd4a97b7661faa131b1502') +``` + +## start_application + +***Deprecated*** +Starts a user application container, usually after it has been stopped with `stop_application()`. +This function requires supervisor v1.8 or higher. + +**Signature:** `balena.models.device.start_application(uuid_or_id)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int). + +**Returns:** + dict: dictionary contains started application container id. + +**Examples:** +```python +>>> balena.models.device.start_application('8f66ec7335dd4a97b7661faa131b1502') +``` + +## start_os_update + +Start an OS update on a device. + +If using run_detached option, monitor progress with device.get() -- +status, provisioning_state and provisioning_progress entries. + +**Signature:** `balena.models.device.start_os_update(uuid_or_id, target_os_version)` ⇒ HUPStatusResponse + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int). + target_os_version (str): semver-compatible version for the target device. + Unsupported (unpublished) version will result in rejection. + The version **must** be the exact version number, a "prod" variant + and greater than the one running on the device. + run_detached (Optional[bool]): run the update in detached mode. + Default behaviour is run_detached=True for more reliable updates. + +**Returns:** + HUPStatusResponse: action response. + +**Examples:** +```python +>>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') +>>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') +``` + +## start_service + +Start a service on device. + +**Signature:** `balena.models.device.start_service(uuid_or_id, image_id)` ⇒ None + +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. + image_id (int): id of the image to start + +**Examples:** +```python +>>> balena.models.device.start_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 1234) +>>> balena.models.device.start_service(None, 1234) # if running on the device +``` + +## stop_application + +***Deprecated*** +Temporarily stops a user application container. +Application container will not be removed after invoking this function and a +reboot or supervisor restart will cause the container to start again. +This function requires supervisor v1.8 or higher. + +**Signature:** `balena.models.device.stop_application(uuid_or_id)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int). + +**Returns:** + dict: dictionary contains stopped application container id. + +**Examples:** +```python +>>> balena.models.device.stop_application('8f66ec7335dd4a97b7661faa131b1502') +``` + +## stop_service + +Stop a service on device. + +**Signature:** `balena.models.device.stop_service(uuid_or_id, image_id)` ⇒ None + +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. + image_id (int): id of the image to stop + +**Examples:** +```python +>>> balena.models.device.stop_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) +>>> balena.models.device.stop_service(None, 392229) # if running on the device +``` + +## track_application_release + +Configure a specific device to track the current application release. + +**Signature:** `balena.models.device.track_application_release(uuid_or_id_or_ids)` ⇒ None + +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) + +## unset_custom_location + +Clear the custom location of a device. + +**Signature:** `balena.models.device.unset_custom_location(uuid_or_id_or_ids)` ⇒ None + +**Args:** + uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) + +**Examples:** +```python +>>> balena.models.device.unset_custom_location(123) +``` + +## update + +update the device. + +**Signature:** `balena.models.device.update(uuid_or_id, force)` ⇒ None + +**Args:** + uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. + force (Optional[bool]): If force is True, the update lock will be overridden. + +**Examples:** +```python +>>> balena.models.device.update('8f66ec7335dd4a97b7661faa131b1502') +``` + +# DeviceTag + +This class implements device tag model for balena python SDK. +## get + +Get a device tag (update tag value if it exists). +___Note___: Notice that when using the device ID rather than UUID, +it will avoid one extra API roundtrip. + +**Signature:** `balena.models.device.get(uuid_or_id, tag_key)` ⇒ Optional[str] + +**Args:** + uuid_or_id (Union[str, int]): device uuid or device id. + tag_key (str): tag key. + +**Returns:** + Optional[str]: tag value + +**Examples:** +```python +>>> balena.models.device.tags.get('f5213eac0d63ac4', 'testtag') +``` + +## get_all + +Get all device tags. + +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** + options (AnyObject): extra pine options to use + +**Returns:** + List[BaseTagType]: tags list. + +**Examples:** +```python +>>> balena.models.device.tags.get_all() +``` + +## get_all_by_application + +Get all device tags for an application. + +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** + slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use + +**Returns:** + List[BaseTagType]: tags list. + +**Examples:** +```python +>>> balena.models.device.tags.get_all_by_application(1005160) +``` + +## get_all_by_device + +Get all device tags for a device. + +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (number) + options (AnyObject): extra pine options to use + +**Returns:** + List[BaseTagType]: tags list. + +**Examples:** +```python +>>> balena.models.device.tags.get_all_by_device('a03ab646ca5a4f11b4d05c1f1c3b4e72') +``` + +## remove + +Remove a device tag. + +**Signature:** `balena.models.device.remove(uuid_or_id, tag_key)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid or device id. + tag_key (str): tag key. + +**Examples:** +```python +>>> balena.models.device.tags.remove('f5213eac0d63ac477', 'testtag') +``` + +## set + +Set a device tag (update tag value if it exists). +___Note___: Notice that when using the device ID rather than UUID, +it will avoid one extra API roundtrip. + +**Signature:** `balena.models.device.set(uuid_or_id, tag_key, value)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid or device id. + tag_key (str): tag key. + value (str): tag value. + +**Examples:** +```python +>>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test1') +>>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test2') +``` + +# DeviceConfigVariable + +This class implements device config variable model for balena python SDK. +## get + +Get a device config variable. + +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + env_var_name (str): environment variable name. + +**Examples:** +```python +>>> balena.models.device.config_var.device.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') +``` + +## get_all_by_application + +Get all device config variables for an application. + +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use + +**Returns:** + List[EnvironmentVariableBase]: list of device environment variables. + +**Examples:** +```python +>>> balena.models.device.config_var.device.get_all_by_application(5780) +``` + +## get_all_by_device + +Get all device config variables belong to a device. + +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + options (AnyObject): extra pine options to use + +**Returns:** + List[EnvironmentVariableBase]: device config variables. + +**Examples:** +```python +>>> balena.models.device.config_var.get_all_by_device('f5213eac574a4fba8b9e32ab3a9cba12') +``` + +## remove + +Remove a device environment variable. + +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + key (str): environment variable name. + +**Examples:** +```python +>>> balena.models.device.config_var.device.remove(2184, 'test_env4') +``` + +## set + +Set the value of a device config variable. +Note that config variables must start with BALENA_ and RESIN_ prefixes. +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + env_var_name (str): environment variable name. + value (str): environment variable value. + +**Examples:** +```python +>>> balena.models.device.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','BALENA_test_env4', 'testing1') +``` + +# DeviceEnvVariable + +This class implements device environment variable model for balena python SDK. +## get + +Get device environment variable. + +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + env_var_name (str): environment variable name. + +**Examples:** +```python +>>> balena.models.device.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4') +``` + +## get_all_by_application + +Get all device environment variables for an application. + +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use + +**Returns:** + List[EnvironmentVariableBase]: list of device environment variables. + +**Examples:** +```python +>>> balena.models.device.env_var.get_all_by_application(5780) +``` + +## get_all_by_device + +Get all device environment variables. + +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + options (AnyObject): extra pine options to use + +**Returns:** + List[EnvironmentVariableBase]: device environment variables. + +**Examples:** +```python +>>> balena.models.device.env_var.get_all_by_device('8deb12a7d7592c2b7f9e44735c2b0a41') +``` + +## remove + +Remove a device environment variable. + +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + key (str): environment variable name. + +**Examples:** +```python +>>> balena.models.device.env_var.remove(2184, 'test_env4') +``` + +## set + +Set the value of a specific environment variable. + +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + env_var_name (str): environment variable name. + value (str): environment variable value. + +**Examples:** +```python +>>> balena.models.device.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4', 'testing1') +``` + +# DeviceServiceEnvVariable + +This class implements device service variable model for balena python SDK. +## get + +Get the overriden value of a service variable on a device + +**Signature:** `balena.models.device.get(uuid_or_id, service_name_or_id, key)` ⇒ Optional[str] + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + service_name_or_id (Union[str, int]): service name (string) or service id (number) + key (str): variable name + +**Returns:** + Optional[str]: device service environment variables. + +**Examples:** +```python +>>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'myservice', 'VAR') +>>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 1234', 'VAR') +``` + +## get_all_by_application + +Get all device service environment variables belong to an application. + +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use + +**Returns:** + List[EnvironmentVariableBase]: device service environment variables. + +**Examples:** +```python +>>> balena.models.device.service_var.get_all_by_application(1043050) +``` + +## get_all_by_device + +Get all device environment variables. + +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + options (AnyObject): extra pine options to use + +**Returns:** + List[EnvironmentVariableBase]: device service environment variables. + +**Examples:** +```python +>>> balena.models.device.service_var.get_all_by_device(8deb12a) +``` + +## remove + +Remove a device service environment variable. + +**Signature:** `balena.models.device.remove(uuid_or_id, service_name_or_id, key)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + service_name_or_id (Union[str, int]): service name (string) or service id (number) + key (str): variable name + +**Examples:** +```python +>>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR') +>>> balena.models.device.service_var.remove('7cf02a6a016a4b3c9e3b7a8d5f46e127', 28970, 'VAR') +``` + +## set + +Set the overriden value of a service variable on a device. + +**Signature:** `balena.models.device.set(uuid_or_id, service_name_or_id, key, value)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + service_name_or_id (Union[str, int]): service name (string) or service id (number) + key (str): variable name + value (str): variable value + +**Examples:** +```python +>>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR', 'override') +>>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 123, 'VAR', 'override') +``` + +# DeviceHistory + +This class implements device history model for balena python SDK. +## get_all_by_application + +Get all device history entries for an application. + +**Signature:** `balena.models.history.get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago + to_date (datetime): history entries younger or equal to this date. + options (AnyObject): extra pine options to use + +**Returns:** + List[DeviceHistoryType]: device history entries. + +**Examples:** +```python +>>> balena.models.device.history.get_all_by_application('myorg/myapp') +>>> balena.models.device.history.get_all_by_application(11196426) +>>> balena.models.device.history.get_all_by_application( +... 11196426, from_date=datetime.utcnow() + timedelta(days=-5) +... ) +>>> balena.models.device.history.get_all_by_application( +... 11196426, +... from_date=datetime.utcnow() + timedelta(days=-10), +... to_date=from_date = datetime.utcnow() + timedelta(days=-5)) +... ) +``` + +## get_all_by_device + +Get all device history entries for a device. + +**Signature:** `balena.models.history.get_all_by_device(uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** + uuid_or_id (str): device uuid (32 / 62 digits string) or id (number) __note__: No short IDs supported + from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago + to_date (datetime): history entries younger or equal to this date. + options (AnyObject): extra pine options to use + +**Returns:** + List[DeviceHistoryType]: device history entries. + +**Examples:** +```python +>>> balena.models.device.history.get_all_by_device('6046335305c8142883a4466d30abe211') +>>> balena.models.device.history.get_all_by_device(11196426) +>>> balena.models.device.history.get_all_by_device( +... 11196426, from_date=datetime.utcnow() + timedelta(days=-5) +... ) +>>> balena.models.device.history.get_all_by_device( +... 11196426, +... from_date=datetime.utcnow() + timedelta(days=-10), +... to_date=from_date = datetime.utcnow() + timedelta(days=-5)) +... ) +``` + +# DeviceType + +This class implements user API key model for balena python SDK. +## get + +Get a single device type. + +**Signature:** `balena.models.device_type.get(id_or_slug, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** + id_or_slug (Union[str, int]): device type slug or alias (string) or id (int). + options (AnyObject): extra pine options to use. + +**Returns:** + DeviceTypeType: Returns the device type + +## get_all + +Get all device types. + +**Signature:** `balena.models.device_type.get_all(options)` ⇒ [List[DeviceTypeType]](#devicetypetype) + +**Args:** + options (AnyObject): extra pine options to use. + +**Returns:** + List[DeviceTypeType]: list contains info of device types. + +## get_all_supported + +Get all supported device types. + +**Signature:** `balena.models.device_type.get_all_supported(options)` ⇒ None + +**Args:** + options (AnyObject): extra pine options to use. + +**Returns:** + List[DeviceTypeType]: list contains info of all supported device types. + +## get_by_slug_or_name + +Get a single device type by slug or name. + +**Signature:** `balena.models.device_type.get_by_slug_or_name(slug_or_name, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** + slug_or_name (str): device type slug or name. + options (AnyObject): extra pine options to use. + +**Returns:** + DeviceTypeType: Returns the device type + +## get_name + +Get display name for a device. + +**Signature:** `balena.models.device_type.get_name(slug)` ⇒ str + +**Args:** + slug (str): device type slug. + +## get_slug_by_name + +Get device slug. + +**Signature:** `balena.models.device_type.get_slug_by_name(name)` ⇒ str + +**Args:** + name (str): device type name. + +# ApiKey + +This class implements user API key model for balena python SDK. +## create + +This method registers a new api key for the current user with the name given. + +**Signature:** `balena.models.api_key.create(name, description, expiry_date)` ⇒ str + +**Args:** + name (str): the API key name + description (Optional[str]): the API key description + expiry_date (Optional[str]): the API key expiring date + +**Returns:** + str: API key + +**Examples:** +```python +>>> balena.models.api_key.create_api_key("myApiKey") +>>> balena.models.api_key.create_api_key("myApiKey", "my api key description") +>>> balena.models.api_key.create_api_key("myApiKey", "my descr", datetime.datetime.utcnow().isoformat()) +``` + +## get_all + +This function gets all API keys. + +**Signature:** `balena.models.api_key.get_all(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** + options (AnyObject): extra pine options to use + +**Returns:** + List[APIKeyType]: user API key + +**Examples:** +```python +>>> balena.models.api_key.get_all() +``` + +## get_all_named_user_api_keys + +Get all named user API keys of the current user. + +**Signature:** `balena.models.api_key.get_all_named_user_api_keys(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** + options (AnyObject): extra pine options to use + +**Examples:** +```python +>>> balena.models.api_key.get_all_named_user_api_keys() +``` + +## get_device_api_keys_by_device + +Get all API keys for a device. + +**Signature:** `balena.models.api_key.get_device_api_keys_by_device(uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** + device_uuid (Union[str, int]): device, uuid (string) or id (int) + options (AnyObject): extra pine options to use + +**Examples:** +```python +>>> balena.models.api_key.get_device_api_keys_by_device("44cc9d186") +>>> balena.models.api_key.get_device_api_keys_by_device(1111386) +``` + +## get_provisioning_api_keys_by_application + +Get all provisioning API keys for an application. + +**Signature:** `balena.models.api_key.get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use + +**Examples:** +```python +>>> balena.models.api_key.get_provisioning_api_keys_by_application(1296047) +>>> balena.models.api_key.get_provisioning_api_keys_by_application("myorg/myapp") +``` + +## revoke + +This function revokes an API key. + +**Signature:** `balena.models.api_key.revoke(id)` ⇒ None + +**Args:** + id (int): API key id. + +**Examples:** +```python +>>> balena.models.api_key.revoke(1296047) +``` + +## update + +This function updates details of an API key. + +**Signature:** `balena.models.api_key.update(id, api_key_info)` ⇒ None + +**Args:** + id (str): API key id. + api_key_info (APIKeyInfoType): new API key info. + +**Examples:** +```python +>>> balena.models.api_key.update(1296047, {"name":"new name"}) +``` + +# Key + +This class implements ssh key model for balena python SDK. +## create + +Create a ssh key. + +**Signature:** `balena.models.key.create(title, key)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** + title (str): key title. + key (str): the public ssh key. + +**Returns:** + SSHKeyType: new ssh key id. + +## get + +Get a single ssh key. + +**Signature:** `balena.models.key.get(id)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** + id (int): key id. + +**Returns:** + SSHKeyType: ssh key info. + +## get_all + +Get all ssh keys. + +**Signature:** `balena.models.key.get_all(options)` ⇒ [List[SSHKeyType]](#sshkeytype) + +**Args:** + options (AnyObject): extra pine options to use + +**Returns:** + List[SSHKeyType]: list of ssh keys. + +## remove + +Remove a ssh key. + +**Signature:** `balena.models.key.remove(id)` ⇒ None + +**Args:** + id (int): key id. + +# Organization + +This class implements organization model for balena python SDK. +## create + +Creates a new organization. + +**Signature:** `balena.models.organization.create(name, handle, logo_image)` ⇒ [OrganizationType](#organizationtype) + +**Args:** + name (str): the name of the organization that will be created. + handle (Optional[str]): The handle of the organization that will be created. + logo_image (Optional[io.BufferedReader]): The organization logo to be used. + +**Returns:** + dict: organization info. + +**Examples:** +```python +>>> balena.models.organization.create('My Org', 'test_org') +>>> with open('mypath/myfile.png', 'rb') as f: +>>> org = sdk.models.organization.create("my-name", None, f) +``` + +## get + +Get a single organization. + +**Signature:** `balena.models.organization.get(handle_or_id, options)` ⇒ [OrganizationType](#organizationtype) + +**Args:** + handle_or_id (str): organization handle (string) or id (number). + options (AnyObject): extra pine options to use + +**Returns:** + dict: organization info. + +**Raises:** + OrganizationNotFound: if organization couldn't be found. + +**Examples:** +```python +>>> balena.models.organization.get(26474) +>>> balena.models.organization.get('myorg') +``` + +## get_all + +Get all organizations. + +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationType]](#organizationtype) + +**Args:** + options (AnyObject): extra pine options to use + +**Returns:** + List[OrganizationType]: list contains information of organizations. + +**Examples:** +```python +>>> balena.models.organization.get_all() +``` + +## remove + +Remove an organization. + +**Signature:** `balena.models.organization.remove(handle_or_id)` ⇒ None + +**Args:** + handle_or_id (str): organization handle (string) or id (number). + +**Examples:** +```python +>>> balena.models.organization.remove(148003) +``` + +# OrganizationMembership + +This class implements organization membership model for balena python SDK. +## get + +Get a single organization membership. + +**Signature:** `balena.models.organization.get(membership_id, options)` ⇒ [OrganizationMembershipType](#organizationmembershiptype) + +**Args:** + membership_id (ResourceKey): the id (int) or an object with the unique + `user` & `is_member_of__organization` numeric pair of the membership + options (AnyObject): extra pine options to use + +**Returns:** + Organization membership. + +**Examples:** +```python +>>> balena.models.organization.memberships.get(17608) +``` + +## get_all + +Get all organization memberships. + +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** + options (AnyObject): extra pine options to use + +**Returns:** + List[OrganizationMembershipType]: organization memberships. + +**Examples:** +```python +>>> balena.models.organization.memberships.tags.get_all() +``` + +## get_all_by_organization + +Get all memberships by organization. + +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** + handle_or_id (Union[str, int]): organization handle (string) or id (number). + options (AnyObject): extra pine options to use + +**Returns:** + List[OrganizationMembershipType]: organization memberships. + +**Examples:** +```python +>>> balena.models.organization.memberships.get_all_by_organization(3014) +``` + +# OrganizationMembershipTag + +This class implements organization membership tag model for balena python SDK. +## get + +Get an organization membership tag. + +**Signature:** `balena.models.organization.get(membership_id, tag_key)` ⇒ Optional[str] + +**Args:** + membership_id: organization membership id. + tag_key (str): tag key. + +**Examples:** +```python +>>> balena.models.organization.memberships.tags.get(17608, 'mTag1') +``` + +## get_all + +Get all organization membership tags. + +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** + options (AnyObject): extra pine options to use + + +**Examples:** +```python +>>> balena.models.organization.memberships.tags.get_all() +``` + +## get_all_by_organization + +Get all organization membership tags for an organization. + +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** + handle_or_id (Union[str, int]): organization handle (string) or id (number). + options (AnyObject): extra pine options to use + +**Returns:** + List[OrganizationMembershipTagType]: organization membership tags. + +**Examples:** +```python +>>> balena.models.organization.memberships.tags.get_all_by_organization(3014) +``` + +## get_all_by_organization_membership + +Get all organization membership tags for a memberships of an organization. + +**Signature:** `balena.models.organization.get_all_by_organization_membership(membership_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** + membership_id (int): organization membership id. + options (AnyObject): extra pine options to use + +**Returns:** + list: organization membership tags. + +**Examples:** +```python +>>> balena.models.organization.memberships.tags.get_all_by_organization_membership(17608) +``` + +## remove + +Remove an organization membership tag. + +**Signature:** `balena.models.organization.remove(membership_id, tag_key)` ⇒ None + +**Args:** + membership_id: organization membership id. + tag_key (str): tag key. + +**Examples:** +```python +>>> balena.models.organization.memberships.tags.remove(17608, 'mTag1') +``` + +## set + +Set an organization membership tag. + +**Signature:** `balena.models.organization.set(membership_id, tag_key, value)` ⇒ None + +**Args:** + membership_id: organization membership id. + tag_key (str): tag key. + value (str): tag value. + +**Examples:** +```python +>>> balena.models.organization.memberships.tags.set(17608, 'mTag1', 'Python SDK') +``` + +# OrganizationInvite + +This class implements organization invite model for balena python SDK. +## accept + +Accepts an invite. + +**Signature:** `balena.models.organization.accept(invite_token)` ⇒ None + +**Args:** + invite_token (str): invitation Token - invite token. + +## create + +Creates a new invite for an organization. + +**Signature:** `balena.models.organization.create(handle_or_id, invitee, role_name, message)` ⇒ [OrganizationInviteType](#organizationinvitetype) + +**Args:** + handle_or_id (Union[str, int]): organization handle (string), or id (number). + invitee (str): the email/balena_username of the invitee. + role_name (Optional[str]): the role name to be granted to the invitee. + message (Optional[str]): the message to send along with the invite. + +**Returns:** + OrganizationInviteType: organization invite. + +**Examples:** +```python +>>> balena.models.organization.invite.create(26474, 'invitee@example.org', 'member', 'Test invite') +``` + +## get_all + +Get all invites. + +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** + options (AnyObject): extra pine options to use + +**Returns:** + List[OrganizationInviteType]: list contains info of invites. + +**Examples:** +```python +>>> balena.models.organization.invite.get_all() +``` + +## get_all_by_organization + +Get all invites by organization. + +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** + handle_or_id (Union[str, int]): organization handle (string), or id (number). + options (AnyObject): extra pine options to use. + +**Returns:** + List[OrganizationInviteType]: list contains info of invites. + +**Examples:** +```python +>>> balena.models.organization.invite.get_all_by_organization(26474) +``` + +## revoke + +Revoke an invite. + +**Signature:** `balena.models.organization.revoke(invite_id)` ⇒ None + +**Args:** + invite_id (int): organization invite id. + +**Examples:** +```python +>>> balena.models.organization.invite.revoke(2862) +``` + +# DeviceOs + +This class implements device os model for balena python SDK. +## download + +Get OS download size estimate. Currently only the raw (uncompressed) size is reported. + +**Signature:** `balena.models.os.download(device_type, version, options)` ⇒ None + +**Args:** + device_type (str): device type slug. + version (str): semver-compatible version or 'latest', defaults to 'latest'. + * The version **must** be the exact version number. + options (DownloadConfig): OS configuration options to use. + +**Returns:** + float: OS image download size, in bytes. + +Example: +```python +>>> with b.models.device_os.download("raspberrypi3") as stream: +... stream.raise_for_status() +... with open("my-image-filename", "wb") as f: +... for chunk in stream.iter_content(chunk_size=8192): +... f.write(chunk) +``` + +## get_all_os_versions + +Get all OS versions for the provided device type(s), inlcuding invalidated ones + +**Signature:** `balena.models.os.get_all_os_versions(device_type, options)` ⇒ None + +**Args:** + device_type (Union[str, List[str]]): device type slug. + options (AnyObject): extra pine options to use + +**Returns:** + list: balenaOS versions. + +## get_available_os_versions + +Get the supported OS versions for the provided device type(s) + +**Signature:** `balena.models.os.get_available_os_versions(device_type)` ⇒ None + +**Args:** + device_type (Union[str, List[str]]): device type slug. + +**Returns:** + list: balenaOS versions. + +## get_config + +Download application config.json. + +**Signature:** `balena.models.os.get_config(slug_or_uuid_or_id, options)` ⇒ None + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (ImgConfigOptions): OS configuration dict to use. The available options + are listed below: + network (Optional[Literal["ethernet", "wifi"]]): The network type that + the device will use, one of 'ethernet' or 'wifi'. + appUpdatePollInterval (Optional[int]): How often the OS checks for updates, in minutes. + provisioningKeyName (Optional[str]): Name assigned to API key + provisioningKeyExpiryDate (Optional[str]): Expiry Date assigned to API key + wifiKey (Optional[str]): The key for the wifi network the device will connect to. + wifiSsid (Optional[str]): The ssid for the wifi network the device will connect to. + ip (Optional[str]): static ip address + gateway (Optional[str]): static ip gateway. + netmask (Optional[str]): static ip netmask. + deviceType (Optional[str]): The device type. + version (str): Required: the OS version of the image. + developmentMode (Optional[bool]): If the device should be in development mode. + +**Returns:** + dict: application config.json content. + +**Raises:** + ApplicationNotFound: if application couldn't be found. + +## get_download_size + +Get OS download size estimate. Currently only the raw (uncompressed) size is reported. + +**Signature:** `balena.models.os.get_download_size(device_type, version)` ⇒ float + +**Args:** + device_type (str): device type slug. + version (str): semver-compatible version or 'latest', defaults to 'latest'. + * The version **must** be the exact version number. + +**Returns:** + float: OS image download size, in bytes. + +## get_max_satisfying_version + +Get OS download size estimate. Currently only the raw (uncompressed) size is reported. + +**Signature:** `balena.models.os.get_max_satisfying_version(device_type, version_or_range, os_type)` ⇒ Optional[str] + +**Args:** + device_type (str): device type slug. + version_or_range (str): can be one of the exact version number, + in which case it is returned if the version is supported, + or `None` is returned otherwise, + * a [semver](https://www.npmjs.com/package/semver)-compatible + range specification, in which case the most recent satisfying version is returned + if it exists, or `None` is returned, + `'latest'` in which case the most recent version is returned, including pre-releases, + `'recommended'` in which case the recommended version is returned, i.e. the most + recent version excluding pre-releases, which can be `None` if only pre-release versions + are available, + `'default'` in which case the recommended version is returned if available, + or `latest` is returned otherwise. + Defaults to `'latest'` + os_type (Optional[Literal["default", "esr"]]): The used OS type. + +**Returns:** + float: OS image download size, in bytes. + +## get_supervisor_releases_for_cpu_architecture + +Returns the Releases of the supervisor for the CPU Architecture + +**Signature:** `balena.models.os.get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** + cpu_architecture_slug_or_id (Union[str, int]): The slug (string) or id (number) for the CPU Architecture. + options (AnyObject): extra pine options to use. + +**Returns:** + ReleaseType: release info. + + +Example: + results = balena.models.os.get_supervisor_releases_for_cpu_architecture('aarch64'); + results = balena.models.os.get_supervisor_releases_for_cpu_architecture( + 'aarch64', + { $filter: { raw_version: '12.11.0' } }, + ); + +## get_supported_os_update_versions + +Get OS supported versions. + +**Signature:** `balena.models.os.get_supported_os_update_versions(device_type, current_version)` ⇒ None + +**Args:** + device_type (str): device type slug. + current_version (str): device type slug. + +## is_architecture_compatible_with + +Returns whether the specified OS architecture is compatible with the target architecture. + +**Signature:** `balena.models.os.is_architecture_compatible_with(os_architecture, application_architecture)` ⇒ None + +**Args:** + os_architecture (str): The OS's architecture as specified in its device type. + application_architecture (str): The application's architecture as specified in its device type. + +**Returns:** + bool: Whether the specified OS architecture is capable of + running applications build for the target architecture. + +## is_supported_os_update + + Returns the supported OS update targets for the provided device type. + +**Signature:** `balena.models.os.is_supported_os_update(device_type, current_version, target_version)` ⇒ bool + +**Args:** + device_type (str): device type slug. + current_version (str): emver-compatible version for the starting OS version + target_version (str): semver-compatible version for the target OS version + +# Config + +This class implements configuration model for balena python SDK. +## get_all + +Get all configuration. + +**Signature:** `balena.models.config.get_all()` ⇒ ConfigType + +**Returns:** + ConfigType: configuration information. + +**Examples:** +```python +>>> balena.models.config.get_all() +``` + +# Release + +This class implements release model for balena python SDK. +## create_from_url + +Create a new release built from the source in the provided url. + +**Signature:** `balena.models.release.create_from_url(slug_or_uuid_or_id, url, flatten_tarball)` ⇒ int + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + url (str): a url with a tarball of the project to build. + flatten_tarball (bool): Should be true when the tarball includes an extra root folder + with all the content. + +**Returns:** + int: release Id. + +## finalize + +Finalizes a draft release. + +**Signature:** `balena.models.release.finalize(commit_or_id_or_raw_version)` ⇒ None + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) + +## get + +Get a specific release. + +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, options)` ⇒ [ReleaseType](#releasetype) + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) + or id (number) or an object with the unique `application` (number or string) & `rawVersion` (string) + pair of the release options + options(AnyObject): extra pine options to use + +**Returns:** + ReleaseType: release info. + +## get_all_by_application + +Get all releases from an application. + +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + options (AnyObject): extra pine options to use + +**Returns:** + List[ReleaseType]: release info. + +## get_latest_by_application + +Get the latest successful release for an application. + +**Signature:** `balena.models.release.get_latest_by_application(slug_or_uuid_or_id, options)` ⇒ [Optional[ReleaseType]](#releasetype) + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). + options (AnyObject): extra pine options to use + +**Returns:** + Optional[ReleaseType]: release info. + +## get_with_image_details + +Get a specific release with the details of the images built. + +**Signature:** `balena.models.release.get_with_image_details(commit_or_id_or_raw_version, image_options, release_options)` ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) + image_options (AnyObject): extra pine options to use on image expand + release_options (AnyObject): extra pine options to use on release expand + +**Returns:** + dict: release info. + +**Raises:** ReleaseNotFound: if release couldn't be found. -### Function: get_all_by_application(app_id) -Get all releases from an application. +## set_is_invalidated + +Set the is_invalidated property of a release to True or False. + +**Signature:** `balena.models.release.set_is_invalidated(commit_or_id_or_raw_version, is_invalidated)` ⇒ None + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) + is_invalidated (bool): True for invalidated, False for validated. + +## set_known_issue_list + +Set a known issue list for a release. + +**Signature:** `balena.models.release.set_known_issue_list(commit_or_id_or_raw_version, known_issue_list)` ⇒ None + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) + known_issue_list (Optional[str]): the known issue list. + +## set_note + +Set a note for a release. + +**Signature:** `balena.models.release.set_note(commit_or_id_or_raw_version, note)` ⇒ None + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) + note (Optional[str]): the note. + +## set_release_version + +Set a direct semver for a given release. + +**Signature:** `balena.models.release.set_release_version(commit_or_id, semver)` ⇒ None + +**Args:** + commit_or_id(Union[str, int]): release commit (string) or id (int) + semver (str): the version to be released, must be a valid semver + +# ReleaseTag + +This class implements release tag model for balena python SDK. +## get + +Get a single release tag. + +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, tag_key)` ⇒ Optional[str] + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or + tag_key (str): tag key. + +**Examples:** +```python +>>> balena.models.release.tags.get(465307, 'releaseTag1') +``` + +## get_all + +Get all release tags. + +**Signature:** `balena.models.release.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** + options (AnyObject): extra pine options to use -#### Args: - app_id (str): applicaiton id. +**Returns:** + List[BaseTagType]: tags list. -#### Returns: - list: release info. -### Function: get_latest_by_application(app_id) +**Examples:** +```python +>>> balena.models.release.tags.get_all() +``` -Get the latest successful release for an application. +## get_all_by_application -#### Args: - app_id (str): applicaiton id. +Get all device tags for an application. -#### Returns: - dict: release info. -### Function: get_with_image_details(commit_or_id) +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) -Get a specific release with the details of the images built. +**Args:** + slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use -#### Args: - commit_or_id: release commit (str) or id (int). +**Returns:** + List[BaseTagType]: tags list. -#### Returns: - dict: release info. +**Examples:** +```python +>>> balena.models.release.tags.get_all_by_application(1005160) +``` -#### Raises: - ReleaseNotFound: if release couldn't be found. -## Service +## get_all_by_release + +Get all release tags for a release. + +**Signature:** `balena.models.release.get_all_by_release(commit_or_id_or_raw_version, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or + options (AnyObject): extra pine options to use + +**Returns:** + List[BaseTagType]: tags list. + +**Examples:** +```python +>>> balena.models.release.tags.get_all_by_release(135) +``` + +## remove + +Remove a release tag. + +**Signature:** `balena.models.release.remove(commit_or_id_or_raw_version, tag_key)` ⇒ None + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or + tag_key (str): tag key. + +**Examples:** +```python +>>> balena.models.release.tags.remove(135, 'releaseTag1') +``` + +## set + +Set a release tag (update tag value if it exists). + +**Signature:** `balena.models.release.set(commit_or_id_or_raw_version, tag_key, value)` ⇒ None + +**Args:** + commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or + tag_key (str): tag key. + value (str): tag value. + +**Examples:** +```python +>>> balena.models.release.tags.set(465307, 'releaseTag1', 'Python SDK') +``` + +# Service This class implements service model for balena python SDK. -### Function: get_all_by_application(app_id) +## get_all_by_application Get all services from an application. -#### Args: - app_id (str): application id. +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ServiceType]](#servicetype) -#### Returns: - list: service info. -## Tag +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use -This class is a wrapper for Tag models. -## DeviceTag +**Returns:** + List[ServiceType]: service info. -This class implements device tag model for balena python SDK. -### Function: get_all() +# ServiceEnvVariable -Get all device tags. +This class implements Service environment variable model for balena python SDK. +## get + +Get the value of a specific service variable + +**Signature:** `balena.models.service.get(service_id_or_natural_key, key)` ⇒ Optional[str] + +**Args:** + service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name + key (str): variable name + +**Examples:** +```python +>>> balena.models.service.var.get(1234,'test_env4') +>>> balena.models.service.var.get({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') +``` + +## get_all_by_application + +Get all service variables by application. + +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** + slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) + options (AnyObject): extra pine options to use + +**Returns:** + List[EnvironmentVariableBase]: application environment variables. + +**Examples:** +```python +>>> balena.models.service.var.get_all_by_application(9020) +>>> balena.models.service.var.get_all_by_application("myorg/myslug") +``` + +## get_all_by_service + +Get all variables for a service. + +**Signature:** `balena.models.service.get_all_by_service(service_id_or_natural_key, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** + service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name + options (AnyObject): extra pine options to use + +**Returns:** + List[EnvironmentVariableBase]: service environment variables. + +**Examples:** +```python +>>> balena.models.service.var.get_all_by_service(1234) +>>> balena.models.service.var.get_all_by_service({'application': 'myorg/myapp', 'service_name': 'service'}) +``` + +## remove + +Clear the value of a specific service variable + +**Signature:** `balena.models.service.remove(service_id_or_natural_key, key)` ⇒ None + +**Args:** + service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name + key (str): variable name + +**Examples:** +```python +>>> balena.models.service.var.remove({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') +>>> balena.models.service.var.remove(1234,'test_env4') +``` + +## set + +Set the value of a specific application environment variable. + +**Signature:** `balena.models.service.set(service_id_or_natural_key, key, value)` ⇒ None + +**Args:** + service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name + key (str): variable name + value (str): environment variable value. + +**Examples:** +```python +>>> balena.models.service.var.set({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR', 'value') +>>> balena.models.service.var.set(1234,'test_env4', 'value') +``` + +# Image + +This class implements image model for balena python SDK. +## get + +Get a specific image. + +**Signature:** `balena.models.image.get(id, options)` ⇒ [ImageType](#imagetype) + +**Args:** + id (int): image id. + options (AnyObject): extra pine options to use. + +**Returns:** + ImageType: image info. + +## get_logs + +Get the build log from an image. + +**Signature:** `balena.models.image.get_logs(id)` ⇒ str + +**Args:** + id (str): image id. + +**Returns:** + str: build log. + +# Auth + +This class implements all authentication functions for balena python SDK. +## authenticate + +This function authenticates provided credentials information. +You should use Auth.login when possible, as it takes care of saving the Auth Token and username as well. + +**Signature:** `balena.auth.authenticate()` ⇒ str + +**Args:** + **credentials: credentials keyword arguments. + username (str): Balena username. + password (str): Password. + +**Returns:** + str: Auth Token, + +**Examples:** +```python +>>> balena.auth.authenticate(username='', password='') +``` + +## get_actor_id + +Get current logged in actor id. + +**Signature:** `balena.auth.get_actor_id()` ⇒ int + +**Returns:** + int: actor id + +**Examples:** +```python +# If you are logged in. +>>> balena.auth.get_actor_id() +``` + +## get_token + +This function retrieves Auth Token. + +**Signature:** `balena.auth.get_token()` ⇒ Optional[str] + +**Returns:** + str: Auth Token. + +**Examples:** +```python +>>> balena.auth.get_token() +``` + +## get_user_info + +Get current logged in user's info + +**Signature:** `balena.auth.get_user_info()` ⇒ UserInfo + +**Returns:** + UserInfo: user info. + +**Examples:** +```python +# If you are logged in as a user. +>>> balena.auth.get_user_info() +``` + +## is_logged_in + +This function checks if you're logged in + +**Signature:** `balena.auth.is_logged_in()` ⇒ bool + +**Returns:** + bool: True if logged in, False otherwise. + +**Examples:** +```python +# Check if user logged in. +>>> if balena.auth.is_logged_in(): +... print('You are logged in!') +... else: +... print('You are not logged in!') +``` + +## login + +This function is used for logging into balena using email and password. + +**Signature:** `balena.auth.login()` ⇒ None + +**Args:** + **credentials: credentials keyword arguments. + username (str): Balena email. + password (str): Password. + +**Examples:** +```python +>>> from balena import Balena +... balena = Balena() +... credentials = {'username': '', 'password': ''} +... balena.auth.login(**credentials) +... # or +... balena.auth.login(username='', password='') +``` + +## login_with_token + +This function is used for logging into balena using Auth Token. +Auth Token can be found in Preferences section on balena Dashboard. + +**Signature:** `balena.auth.login_with_token(token)` ⇒ None + +**Args:** + token (str): Auth Token. + +**Returns:** + This functions saves Auth Token to Settings and returns nothing. + +**Examples:** +```python +>>> from balena import Balena +>>> balena = Balena() +>>> auth_token = +>>> balena.auth.login_with_token(auth_token) +``` + +## logout + +This function is used for logging out from balena. + +**Signature:** `balena.auth.logout()` ⇒ None + +**Examples:** +```python +# If you are logged in. +>>> balena.auth.logout() +``` + +## register + +This function is used for registering to balena. + +**Signature:** `balena.auth.register()` ⇒ str + +**Args:** + **credentials: credentials keyword arguments. + email (str): email to register. + password (str): Password. + +**Returns:** + str: Auth Token for new account. + +**Examples:** +```python +>>> credentials = {'email': '', 'password': ''} +>>> balena.auth.register(**credentials) +``` + +## whoami + +Return current logged in username. + +**Signature:** `balena.auth.whoami()` ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] + +**Returns:** + Optional[WhoamiResult]: current logged in information + +**Examples:** +```python +>>> balena.auth.whoami() +``` + +# TwoFactorAuth + +This class implements basic 2FA functionalities for balena python SDK. +## challenge + +Challenge two-factor authentication. +If your account has two-factor authentication enabled and logging in using credentials, +you need to pass two-factor authentication before being allowed to use other functions. + +**Signature:** `balena.twofactor_auth.challenge(code)` ⇒ None + +**Args:** + code (str): two-factor authentication code. + +**Examples:** +```python +# You need to enable two-factor authentication on dashboard first. +# Check if two-factor authentication is passed for current session. +>>> balena.twofactor_auth.is_passed() +False +>>> balena.twofactor_auth.challenge('123456') +# Check again if two-factor authentication is passed for current session. +>>> balena.twofactor_auth.is_passed() +True +``` + +## disable + +Disable two factor authentication. +__Note__: Disable will only work when using a token that has 2FA enabled. + +**Signature:** `balena.twofactor_auth.disable(password)` ⇒ str + +**Args:** + password (str): password. + +**Returns:** + str: session token. + +**Examples:** +```python +>>> balena.twofactor_auth.disable('your_password') +``` + +## enable + +Enable two factor authentication. + +**Signature:** `balena.twofactor_auth.enable(code)` ⇒ str + +**Args:** + code (str): two-factor authentication code. + +**Returns:** + str: session token. -#### Returns: - list: list contains device tags. +**Examples:** +```python +>>> balena.twofactor_auth.enable('123456') +``` + +## get_setup_key + +Retrieves a setup key for enabling two factor authentication. +This value should be provided to your 2FA app in order to get a token. +This function only works if you disable two-factor authentication or log in using Auth Token from dashboard. + +**Signature:** `balena.twofactor_auth.get_setup_key()` ⇒ str + +**Returns:** + str: setup key. + +**Examples:** +```python +>>> balena.twofactor_auth.get_setup_key() +``` + +## is_enabled + +Check if two-factor authentication is enabled. + +**Signature:** `balena.twofactor_auth.is_enabled()` ⇒ bool + +**Returns:** + bool: True if enabled. Otherwise False. -#### Examples: +**Examples:** ```python ->>> balena.models.tag.device.get_all() -[{u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'__id': 1036574}, u'tag_key': u'db_tag', u'id': 20157, u'value': u'rpi3', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20157)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1055117)'}, u'__id': 1055117}, u'tag_key': u'group1', u'id': 20158, u'value': u'aaa', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20158)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1055116)'}, u'__id': 1055116}, u'tag_key': u'group1', u'id': 20159, u'value': u'bbb', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20159)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1055116)'}, u'__id': 1055116}, u'tag_key': u'db_tag', u'id': 20160, u'value': u'aaa', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20160)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'__id': 1036574}, u'tag_key': u'newtag', u'id': 20161, u'value': u'test1', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20161)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'__id': 1036574}, u'tag_key': u'newtag1', u'id': 20162, u'value': u'test1', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20162)'}}] +>>> balena.twofactor_auth.is_enabled() ``` -### Function: get_all_by_application(app_id) -Get all device tags for an application. +## is_passed + +Check if two-factor authentication challenge was passed. +If the user does not have 2FA enabled, this will be True. -#### Args: - app_id (str): application id . +**Signature:** `balena.twofactor_auth.is_passed()` ⇒ bool -#### Returns: - list: list contains device tags. +**Returns:** + bool: True if passed. Otherwise False. -#### Examples: +**Examples:** ```python ->>> balena.models.tag.device.get_all_by_application('1005160') -[{u'device': {u'__deferred': {u'uri': u'/balena/device(1055117)'}, u'__id': 1055117}, u'tag_key': u'group1', u'id': 20158, u'value': u'aaa', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20158)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1055116)'}, u'__id': 1055116}, u'tag_key': u'group1', u'id': 20159, u'value': u'bbb', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20159)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1055116)'}, u'__id': 1055116}, u'tag_key': u'db_tag', u'id': 20160, u'value': u'aaa', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20160)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'__id': 1036574}, u'tag_key': u'db_tag', u'id': 20157, u'value': u'rpi3', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20157)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'__id': 1036574}, u'tag_key': u'newtag', u'id': 20161, u'value': u'test1', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20161)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'__id': 1036574}, u'tag_key': u'newtag1', u'id': 20162, u'value': u'test1', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20162)'}}] +>>> balena.twofactor_auth.is_passed() ``` -### Function: get_all_by_device(uuid) -Get all device tags for a device. +## verify -#### Args: - uuid (str): device uuid. +Verifies two factor authentication. +Note that this method not update the token automatically. +You should use balena.twofactor_auth.challenge() when possible, as it takes care of that as well. + +**Signature:** `balena.twofactor_auth.verify(code)` ⇒ str -#### Returns: - list: list contains device tags. +**Args:** + code (str): two-factor authentication code. -#### Raises: - DeviceNotFound: if device couldn't be found. +**Returns:** + str: session token. -#### Examples: +**Examples:** ```python ->>> balena.models.tag.device.get_all_by_device('a03ab646c01f39e39a1e3deb7fce76b93075c6d599fd5be4a889b8145e2f8f') -[{u'device': {u'__deferred': {u'uri': u'/balena/device(1055116)'}, u'__id': 1055116}, u'tag_key': u'group1', u'id': 20159, u'value': u'bbb', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20159)'}}, {u'device': {u'__deferred': {u'uri': u'/balena/device(1055116)'}, u'__id': 1055116}, u'tag_key': u'db_tag', u'id': 20160, u'value': u'aaa', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20160)'}}] +>>> balena.twofactor_auth.verify('123456') ``` -### Function: remove(uuid, tag_key) -Remove a device tag. +# Logs -#### Args: - uuid (str): device uuid. - tag_key (str): tag key. +This class implements functions that allow processing logs from device. +## history -#### Raises: - DeviceNotFound: if device couldn't be found. +Get device logs history. -#### Examples: -```python ->>> balena.models.tag.device.remove('f5213eac0d63ac47721b037a7406d306', 'testtag')) -OK -``` -### Function: set(uuid, tag_key, value) +**Signature:** `balena.logs.history(uuid_or_id, count)` ⇒ List[Log] -Set a device tag (update tag value if it exists). +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. -#### Args: - uuid (str): device uuid. - tag_key (str): tag key. - value (str): tag value. +## stop -#### Returns: - dict: dict contains device tag info if tag doesn't exist. - OK: if tag exists. +Will grecefully unsubscribe from all devices and stop the consumer thread. +**Signature:** `balena.logs.stop()` ⇒ None -#### Raises: - DeviceNotFound: if device couldn't be found. -#### Examples: -```python ->>> balena.models.tag.device.set('f5213eac0d63ac47721b037a7406d306', 'testtag','test1') -{u'device': {u'__deferred': {u'uri': u'/balena/device(1036574)'}, u'__id': 1036574}, u'tag_key': u'testtag', u'id': 20163, u'value': u'test1', u'__metadata': {u'type': u'', u'uri': u'/balena/device_tag(20163)'}} ->>> balena.models.tag.device.set('f5213eac0d63ac47721b037a7406d306', 'testtag','test2') -OK -``` -## ApplicationTag +## subscribe -This class implements application tag model for balena python SDK. -### Function: get_all() +Subscribe to device logs. -Get all application tags. +**Signature:** `balena.logs.subscribe(uuid_or_id, callback, error, count)` ⇒ None -#### Returns: - list: list contains application tags. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + callback (Callable[[Log], None]): this callback is called on receiving a message. + error (Optional[Callable[[Any], None]]): this callback is called on an error event. + count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. -#### Examples: -```python ->>> balena.models.tag.application.get_all() -[{u'application': {u'__deferred': {u'uri': u'/balena/application(1005160)'}, u'__id': 1005160}, u'tag_key': u'appTag', u'id': 12886, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/application_tag(12886)'}}, {u'application': {u'__deferred': {u'uri': u'/balena/application(1005767)'}, u'__id': 1005767}, u'tag_key': u'appTa1', u'id': 12887, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/application_tag(12887)'}}, {u'application': {u'__deferred': {u'uri': u'/balena/application(1005767)'}, u'__id': 1005767}, u'tag_key': u'appTag2', u'id': 12888, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/application_tag(12888)'}}] -``` -### Function: get_all_by_application(app_id) +## unsubscribe -Get all application tags for an application. +Unsubscribe from device logs for a specific device. -#### Args: - app_id (str): application id . +**Signature:** `balena.logs.unsubscribe(uuid_or_id)` ⇒ None -#### Returns: - list: list contains application tags. +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: -```python ->>> balena.models.tag.application.get_all_by_application('1005767') -[{u'application': {u'__deferred': {u'uri': u'/balena/application(1005767)'}, u'__id': 1005767}, u'tag_key': u'appTa1', u'id': 12887, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/application_tag(12887)'}}, {u'application': {u'__deferred': {u'uri': u'/balena/application(1005767)'}, u'__id': 1005767}, u'tag_key': u'appTag2', u'id': 12888, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/application_tag(12888)'}}] -``` -### Function: remove(app_id, tag_key) +## unsubscribe_all -Remove an application tag. +Unsubscribe all subscribed devices. +**Signature:** `balena.logs.unsubscribe_all()` ⇒ None -#### Args: - app_id (str): application id. - tag_key (str): tag key. -#### Examples: -```python ->>> balena.models.tag.application.remove('1005767', 'tag1') -OK -``` -### Function: set(app_id, tag_key, value) +# Settings -Set an application tag (update tag value if it exists). +Create a module object. -#### Args: - app_id (str): application id. - tag_key (str): tag key. - value (str): tag value. +The name must be a string; the optional doc argument can have any type. +# Types +## APIKeyInfoType -#### Returns: - dict: dict contains application tag info if tag doesn't exist. - OK: if tag exists. -#### Examples: ```python ->>> balena.models.tag.application.set('1005767', 'tag1', 'Python SDK') -{u'application': {u'__deferred': {u'uri': u'/balena/application(1005767)'}, u'__id': 1005767}, u'tag_key': u'tag1', u'id': 12889, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/application_tag(12889)'}} ->>> balena.models.tag.application.set('1005767', 'tag1','Balena Python SDK') -OK +{ + "name": str, + "description": Optional[str], + "expiry_date": Optional[str] +} ``` -## ReleaseTag -This class implements release tag model for balena python SDK. -### Function: get_all() -Get all release tags. +## APIKeyType -#### Returns: - list: list contains release tags. -#### Examples: ```python ->>> balena.models.tag.release.get_all() -[{u'release': {u'__deferred': {u'uri': u'/balena/release(465307)'}, u'__id': 465307}, u'tag_key': u'releaseTag1', u'id': 135, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/release_tag(135)'}}] +{ + "id": int, + "created_at": str, + "name": str, + "description": Optional[str], + "expiry_date": Optional[str], + "is_of__actor": Union[List[ActorType], PineDeferred] +} ``` -### Function: get_all_by_application(app_id) -Get all release tags for an application. -#### Args: - app_id (str): application id. +## ActorType -#### Returns: - list: list contains release tags. -#### Examples: ```python ->>> balena.models.tag.release.get_all_by_application('1043050') -[{u'release': {u'__deferred': {u'uri': u'/balena/release(465307)'}, u'__id': 465307}, u'tag_key': u'releaseTag1', u'id': 135, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/release_tag(135)'}}] +{ + "id": int, + "is_of__user": Union[List[UserType], PineDeferred, None], + "is_of__application": Union[List[TypeApplication], PineDeferred, None], + "is_of__device": Union[List[TypeDevice], PineDeferred, None], + "is_of__public_device": Union[List[PublicDeviceType], PineDeferred, None], + "api_key": Union[List[APIKeyType], PineDeferred, None] +} ``` -### Function: get_all_by_release(commit_or_id) -Get all release tags for a release. -#### Args: - commit_or_id: release commit (str) or id (int). +## ApplicationHostedOnApplication -#### Returns: - list: list contains release tags. -#### Examples: ```python ->>> balena.models.tag.release.get_all_by_release(135) -[{u'release': {u'__deferred': {u'uri': u'/balena/release(465307)'}, u'__id': 465307}, u'tag_key': u'releaseTag1', u'id': 135, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/release_tag(135)'}}] +{ + "application": Union[List[TypeApplication], PineDeferred], + "can_use__application_as_host": Union[List[TypeApplication], PineDeferred] +} ``` -### Function: remove(commit_or_id, tag_key) -Remove a release tag. -#### Args: - commit_or_id: release commit (str) or id (int). - tag_key (str): tag key. +## ApplicationInviteType + -#### Examples: ```python ->>> balena.models.tag.release.remove(135, 'releaseTag1') -OK +{ + "id": int, + "message": str, + "created_at": str, + "invitationToken": str, + "application_membership_role": Union[List[ApplicationMembershipRoleType], PineDeferred], + "invitee": Union[List[InviteeType], PineDeferred], + "is_invited_to__application": Union[List[ApplicationType], PineDeferred] +} ``` -### Function: set(commit_or_id, tag_key, value) -Set a release tag (update tag value if it exists). -#### Args: - commit_or_id: release commit (str) or id (int). - tag_key (str): tag key. - value (str): tag value. +## ApplicationMembershipRoleType -#### Returns: - dict: dict contains release tag info if tag doesn't exist. - OK: if tag exists. -#### Examples: ```python ->>> balena.models.tag.release.set(465307, 'releaseTag1', 'Python SDK') -{u'release': {u'__deferred': {u'uri': u'/balena/release(465307)'}, u'__id': 465307}, u'tag_key': u'releaseTag1', u'id': 135, u'value': u'Python SDK', u'__metadata': {u'type': u'', u'uri': u'/balena/release_tag(135)'}} ->>> balena.models.tag.release.set(465307, 'releaseTag1', 'Python SDK 1') -OK +{ + "id": int, + "name": Literal["developer", "operator", "observer"] +} ``` -## Key - -This class implements ssh key model for balena python SDK. -### Function: create(title, key) - -Create a ssh key. This function only works if you log in using credentials or Auth Token. -#### Args: - title (str): key title. - key (str): the public ssh key. -#### Returns: - str: new ssh key id. -### Function: get(id) +## ApplicationMembershipType -Get a single ssh key. -#### Args: - id (str): key id. +```python +{ + "id": int, + "user": Union[List[UserType], PineDeferred], + "is_member_of__application": Union[List[TypeApplication], PineDeferred], + "application_membership_role": Union[List[ApplicationMembershipRoleType], PineDeferred] +} +``` -#### Returns: - dict: ssh key info. -#### Raises: - KeyNotFound: if ssh key couldn't be found. -### Function: get_all() +## ApplicationType -Get all ssh keys. -#### Returns: - list: list of ssh keys. -### Function: remove(id) +```python +{ + "id": int, + "name": str, + "slug": str, + "description": Optional[str], + "supports_multicontainer": bool, + "supports_web_url": bool, + "is_legacy": bool, + "requires_payment": bool, + "needs__os_version_range": Optional[str], + "maximum_device_count": Optional[int] +} +``` -Remove a ssh key. This function only works if you log in using credentials or Auth Token. -#### Args: - id (str): key id. -## Supervisor +## BaseTagType -This class implements supervisor model for balena python SDK. -#### Attributes: - SUPERVISOR_API_VERSION (str): supervisor API version. - SUPERVISOR_ADDRESS (str): supervisor endpoint address on device. - SUPERVISOR_API_KEY (str): supervisor API key on device. - _on_device (bool): API endpoint flag. - If True then all commands will be sent to the API on device. - If False then all command will be sent to the balena API proxy endpoint (api.balena.io/supervisor/). - If SUPERVISOR_ADDRESS and SUPERVISOR_API_KEY are available, _on_device will be set to True by default. Otherwise, it's False. -### Function: blink(device_uuid, app_id) +```python +{ + "id": int, + "tag_key": str, + "value": str +} +``` -Start a blink pattern on a LED for 15 seconds. This is the same with `balena.models.device.identify()`. -No need to set device_uuid and app_id if command is sent to the API on device. -#### Args: - device_uuid (Optional[str]): device uuid. - app_id (Optional[str]): application id. +## BasicUserInfoType -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. -#### Examples: ```python ->>> balena.models.supervisor.blink(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') -'OK' +{ + "id": int, + "username": str +} ``` -### Function: force_api_endpoint(endpoint) -Force all API commands to a specific endpoint. -#### Args: - endpoint (bool): True if selecting the API on device. False if selecting the balena API proxy endpoint. +## CpuArchitectureType -#### Raises: - InvalidOption: if endpoint value is not bool. -### Function: get_application_info(app_id, device_uuid) -***Deprecated*** -Return information about the application running on the device. -This function requires supervisor v1.8 or higher. -No need to set device_uuid if command is sent to the API on device. +```python +{ + "id": int, + "slug": str, + "is_supported_by__device_type": Optional[List[CpuArchitectureType]] +} +``` -#### Args: - app_id (str): application id. - device_uuid (Optional[str]): device uuid. -#### Returns: - dict: dictionary contains application information. +## CreditBundleType -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. -#### Examples: ```python ->>> balena.models.supervisor.get_application_info(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') +{ + "id": int, + "created_at": str, + "is_created_by__user": Union[List[UserType], PineDeferred, None], + "original_quantity": float, + "total_balance": float, + "total_cost": float, + "payment_status": Literal["processing", "paid", "failed", "complimentary", "cancelled", "refunded"], + "belongs_to__organization": Union[List[OrganizationType], PineDeferred], + "is_for__feature": Any, + "is_associated_with__invoice_id": Optional[str], + "error_message": Optional[str] +} ``` -### Function: get_device_state(app_id, device_uuid) -Return the current device state, as reported to the balena API and with some extra fields added to allow control over pending/locked updates. -This function requires supervisor v1.6 or higher. -No need to set device_uuid and app_id if command is sent to the API on device. -#### Args: - app_id (Optional[str]): application id. - device_uuid (Optional[str]): device uuid. +## DeviceFamilyType -#### Returns: - dict: dictionary contains device state. -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. - -#### Examples: ```python ->>> balena.models.supervisor.get_device_state(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') -{u'status': u'Idle', u'update_failed': False, u'update_pending': False, u'download_progress': None, u'os_version': u'Balena OS 1.1.1', u'api_port': 48484, u'commit': u'ff812b9a5f82d9661fb23c24aa86dce9425f1112', u'update_downloaded': False, u'supervisor_version': u'1.7.0', u'ip_address': u'192.168.0.102'} +{ + "created_at": str, + "modified_at": str, + "id": int, + "slug": str, + "name": str, + "is_manufactured_by__device_manufacturer": Union[List[DeviceManufacturerType], PineDeferred, None] +} ``` -### Function: ping(device_uuid, app_id) -Check that the supervisor is alive and well. -No need to set device uuid and app_id if command is sent to the API on device. -#### Args: - device_uuid (Optional[str]): device uuid. - app_id (Optional[str]): application id. +## DeviceHistoryType -#### Returns: - str: `OK` signals that the supervisor is alive and well. -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not set. - -#### Examples: ```python ->>> balena.models.supervisor.ping(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') -'OK' +{ + "created_at": str, + "id": int, + "end_timestamp": str, + "is_created_by__actor": Union[List[ActorType], PineDeferred, None], + "is_ended_by__actor": Union[List[ActorType], PineDeferred, None], + "tracks__device": Union[List[TypeDevice], PineDeferred], + "tracks__actor": Union[List[ActorType], PineDeferred, None], + "uuid": Optional[str], + "belongs_to__application": Union[List[TypeApplication], PineDeferred], + "is_active": bool, + "is_running__release": Union[List[ReleaseType], PineDeferred, None], + "should_be_running__release": Union[List[ReleaseType], PineDeferred, None], + "os_version": Optional[str], + "os_variant": Optional[str], + "supervisor_version": Optional[str], + "is_of__device_type": Union[List[DeviceTypeType], PineDeferred, None], + "should_be_managed_by__release": Union[List[ReleaseType], PineDeferred, None] +} ``` -### Function: purge(app_id, device_uuid) -Clears the user application's /data folder. -No need to set device_uuid and app_id if command is sent to the API on device. -#### Args: - app_id (str): application id. - device_uuid (Optional[str]): device uuid. +## DeviceManufacturerType -#### Returns: - dict: when successful, this dictionary is returned `{ 'Data': 'OK', 'Error': '' }`. -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. - -#### Examples: ```python ->>> balena.models.supervisor.purge(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') -{u'Data': u'OK', u'Error': u''} +{ + "created_at": str, + "modified_at": str, + "id": int, + "slug": str, + "name": str +} ``` -### Function: reboot(device_uuid, app_id, force) -Reboot the device. -No need to set device_uuid and app_id if command is sent to the API on device. - -#### Args: - device_uuid (Optional[str]): device uuid. - app_id (Optional[str]): application id. - force (Optional[bool]): If force is True, the update lock will be overridden. -#### Returns: - dict: when successful, this dictionary is returned `{ 'Data': 'OK', 'Error': '' }`. +## DeviceMetricsType -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. -#### Examples: ```python ->>> balena.models.supervisor.reboot(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') -{u'Data': u'OK', u'Error': u''} +{ + "memory_usage": int, + "memory_total": int, + "storage_block_device": str, + "storage_usage": int, + "storage_total": int, + "cpu_usage": int, + "cpu_temp": int, + "cpu_id": str, + "is_undervolted": bool +} ``` -### Function: regenerate_supervisor_api_key(app_id, device_uuid) -Invalidate the current SUPERVISOR_API_KEY and generates a new one. -The application will be restarted on the next update cycle to update the API key environment variable. -No need to set device_uuid and app_id if command is sent to the API on device. -#### Args: - app_id (Optional[str]): application id. - device_uuid (Optional[str]): device uuid. +## DeviceTypeAliasType -#### Returns: - str: new supervisor API key. -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. - -#### Examples: ```python ->>> balena.models.supervisor.regenerate_supervisor_api_key(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') -'480af7bb8a9cf56de8a1e295f0d50e6b3bb46676aaddbf4103aa43cb57039364' +{ + "id": int, + "is_referenced_by__alias": str, + "references__device_type": Union[List[DeviceTypeType], PineDeferred] +} ``` -### Function: restart(app_id, device_uuid) -Restart user application container. -No need to set device_uuid and app_id if command is sent to the API on device. -#### Args: - app_id (str): application id. - device_uuid (Optional[str]): device uuid. +## DeviceTypeType -#### Returns: - str: `OK` signals that the supervisor is alive and well. -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. - -#### Examples: ```python ->>> balena.models.supervisor.restart(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') -'OK' +{ + "id": int, + "slug": str, + "name": str, + "is_private": bool, + "logo": str, + "contract": Any, + "belongs_to__device_family": Union[List[DeviceFamilyType], PineDeferred, None], + "is_default_for__application": Optional[List[TypeApplication]], + "is_of__cpu_architecture": Union[List[CpuArchitectureType], PineDeferred], + "is_accessible_privately_by__organization": Optional[List[OrganizationType]], + "describes_device": Optional[List[TypeDevice]], + "device_type_alias": Optional[List[DeviceTypeAliasType]] +} ``` -### Function: restart_service(device_uuid, image_id) -Restart a service on device. -#### Args: - device_uuid (str): device uuid. - image_id (int): id of the image to start +## EnvironmentVariableBase + -#### Examples: ```python ->>> balena.models.supervisor.restart_service('f3887b184396844f52402c5cf09bd3b9', 392229) -OK +{ + "id": int, + "name": str, + "value": str +} ``` -### Function: shutdown(device_uuid, app_id, force) -Shut down the device. -No need to set device_uuid and app_id if command is sent to the API on device. -#### Args: - device_uuid (Optional[str]): device uuid. - app_id (Optional[str]): application id. - force (Optional[bool]): If force is True, the update lock will be overridden. - -#### Returns: - dict: when successful, this dictionary is returned `{ 'Data': 'OK', 'Error': '' }`. +## ImageBasicInfoType -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. -#### Examples: ```python ->>> balena.models.supervisor.shutdown(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='8362') -{u'Data': u'OK', u'Error': u''} +{ + "id": int, + "service_name": str +} ``` -### Function: start_application(app_id, device_uuid) - -***Deprecated*** -Starts a user application container, usually after it has been stopped with `stop_application()`. -This function requires supervisor v1.8 or higher. -No need to set device_uuid if command is sent to the API on device. -#### Args: - app_id (str): application id. - device_uuid (Optional[str]): device uuid. -#### Returns: - dict: dictionary contains started application container id. +## ImageInstallType -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. -#### Examples: ```python ->>> balena.models.supervisor.start_application(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') +{ + "id": int, + "download_progress": Optional[float], + "status": str, + "install_date": str, + "installs__image": Union[List[ImageType], PineDeferred], + "device": Union[List[TypeDevice], PineDeferred], + "is_provided_by__release": Union[List[ReleaseType], PineDeferred] +} ``` -### Function: start_service(device_uuid, image_id) -Start a service on device. -#### Args: - device_uuid (str): device uuid. - image_id (int): id of the image to start +## ImageType + -#### Examples: ```python ->>> balena.models.supervisor.start_service('f3887b184396844f52402c5cf09bd3b9', 392229) -OK +{ + "id": int, + "created_at": str, + "build_log": str, + "contract": Any, + "content_hash": str, + "project_type": str, + "status": str, + "is_stored_at__image_location": str, + "start_timestamp": str, + "end_timestamp": str, + "push_timestamp": str, + "image_size": str, + "dockerfile": str, + "error_message": str, + "is_a_build_of__service": Union[List[ServiceType], PineDeferred], + "release_image": Optional[List[ReleaseImageType]] +} ``` -### Function: stop_application(app_id, device_uuid) - -***Deprecated*** -Temporarily stops a user application container. Application container will not be removed after invoking this function and a reboot or supervisor restart will cause the container to start again. -This function requires supervisor v1.8 or higher. -No need to set device_uuid if command is sent to the API on device. -#### Args: - app_id (str): application id. - device_uuid (Optional[str]): device uuid. -#### Returns: - dict: dictionary contains stopped application container id. +## InviteeType -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. -#### Examples: ```python ->>> balena.models.supervisor.stop_application(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') +{ + "id": int, + "created_at": str, + "email": str +} ``` -### Function: stop_service(device_uuid, image_id) -Stop a service on device. -#### Args: - device_uuid (str): device uuid. - image_id (int): id of the image to start +## OrganizationInviteType + -#### Examples: ```python ->>> balena.models.supervisor.stop_service('f3887b184396844f52402c5cf09bd3b9', 392229) -OK +{ + "id": int, + "message": str, + "created_at": str, + "invitationToken": str, + "organization_membership_role": Union[List[OrganizationMembershipRoleType], PineDeferred], + "invitee": Union[List[InviteeType], PineDeferred], + "is_invited_to__organization": Union[List[OrganizationType], PineDeferred] +} ``` -### Function: update(device_uuid, app_id, force) -Triggers an update check on the supervisor. Optionally, forces an update when updates are locked. -No need to set device_uuid and app_id if command is sent to the API on device. - -#### Args: - device_uuid (Optional[str]): device uuid. - app_id (Optional[str]): application id. - force (Optional[bool]): If force is True, the update lock will be overridden. -#### Raises: - InvalidOption: if the endpoint is balena API proxy endpoint and device_uuid or app_id is not specified. +## OrganizationMembershipRoleType -#### Examples: -```python ->>> balena.models.supervisor.update(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020') -(Empty Response) -``` ```python -# Force an update ->>> balena.models.supervisor.update(device_uuid='8f66ec7335267e7cc7999ca9eec029a01ea7d823214c742ace5cfffaa21be3', app_id='9020', force=True) -(Empty Response) +{ + "id": int, + "name": Literal["administrator", "member"] +} ``` -## Auth - -This class implements all authentication functions for balena python SDK. -### Function: authenticate() - -This function authenticates provided credentials information. -You should use Auth.login when possible, as it takes care of saving the Auth Token and username as well. -#### Args: - **credentials: credentials keyword arguments. - username (str): Balena username. - password (str): Password. -#### Returns: - str: Auth Token, +## OrganizationMembershipTagType -#### Raises: - LoginFailed: if the username or password is invalid. -#### Examples: ```python ->>> balena.auth.authenticate(username='', password='') -'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6NTM5NywidXNlcm5hbWUiOiJnX3Ryb25nX25naGlhX25ndXllbiIsImVtYWlsIjoicmVzaW5weXRob25zZGt0ZXN0QGdtYWlsLmNvbSIsInNvY2lhbF9zZXJ2aWNlX2FjY291bnQiOlt7ImNyZWF0ZWRfYXQiOiIyMDE1LTExLTIzVDAzOjMwOjE0LjU3MloiLCJpZCI6MTE2NiwidXNlciI6eyJfX2RlZmVycmVkIjp7InVyaSI6Ii9ld2EvdXNlcig1Mzk3KSJ9LCJfX2lkIjo1Mzk3fSwicHJvdmlkZXIiOiJnb29nbGUiLCJyZW1vdGVfaWQiOiIxMDE4OTMzNzc5ODQ3NDg1NDMwMDIiLCJkaXNwbGF5X25hbWUiOiJUcm9uZyBOZ2hpYSBOZ3V5ZW4iLCJfX21ldGFkYXRhIjp7InVyaSI6Ii9ld2Evc29jaWFsX3NlcnZpY2VfYWNjb3VudCgxMTY2KSIsInR5cGUiOiIifX1dLCJoYXNfZGlzYWJsZWRfbmV3c2xldHRlciI6ZmFsc2UsImp3dF9zZWNyZXQiOiI0UDVTQzZGV1pIVU5JR0NDT1dJQUtST0tST0RMUTRNVSIsImhhc1Bhc3N3b3JkU2V0Ijp0cnVlLCJuZWVkc1Bhc3N3b3JkUmVzZXQiOmZhbHNlLCJwdWJsaWNfa2V5Ijp0cnVlLCJmZWF0dXJlcyI6W10sImludGVyY29tVXNlck5hbWUiOiJnX3Ryb25nX25naGlhX25ndXllbiIsImludGVyY29tVXNlckhhc2giOiI5YTM0NmUwZTgzNjk0MzYxODU3MTdjNWRhZTZkZWZhZDdiYmM4YzZkOGNlMzgxYjhhYTY5YWRjMTRhYWZiNGU0IiwicGVybWlzc2lvbnMiOltdLCJpYXQiOjE0NDgyNTYzMDYsImV4cCI6MTQ0ODg2MTEwNn0.U9lfEpPHBRvGQSayASE-glI-lQtAjyIFYd00uXOUzLI' +{ + "organization_membership": Union[List[OrganizationMembershipType], PineDeferred] +} ``` -### Function: get_email() -This function retrieves current logged in user's get_email -#### Returns: - str: user email. +## OrganizationMembershipType -#### Raises: - InvalidOption: if not logged in. -#### Examples: ```python -# If you are logged in. ->>> balena.auth.get_email() -u'balenapythonsdktest@gmail.com' +{ + "id": int, + "created_at": str, + "user": Union[List[UserType], PineDeferred], + "is_member_of__organization": Union[List[OrganizationType], PineDeferred], + "organization_membership_role": Union[List[OrganizationMembershipRoleType], PineDeferred], + "effective_seat_role": str, + "organization_membership_tag": Optional[List[OrganizationMembershipTagType]] +} ``` -### Function: get_token() -This function retrieves Auth Token. -#### Returns: - str: Auth Token. +## OrganizationPrivateDeviceTypeAccess -#### Raises: - InvalidOption: if not logged in and there is no token in Settings. -#### Examples: ```python -# If you are logged in. ->>> balena.auth.get_token() -'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6NTM5NywidXNlcm5hbWUiOiJnX3Ryb25nX25naGlhX25ndXllbiIsImVtYWlsIjoicmVzaW5weXRob25zZGt0ZXN0QGdtYWlsLmNvbSIsInNvY2lhbF9zZXJ2aWNlX2FjY291bnQiOlt7ImNyZWF0ZWRfYXQiOiIyMDE1LTExLTIzVDAzOjMwOjE0LjU3MloiLCJpZCI6MTE2NiwidXNlciI6eyJfX2RlZmVycmVkIjp7InVyaSI6Ii9ld2EvdXNlcig1Mzk3KSJ9LCJfX2lkIjo1Mzk3fSwicHJvdmlkZXIiOiJnb29nbGUiLCJyZW1vdGVfaWQiOiIxMDE4OTMzNzc5ODQ3NDg1NDMwMDIiLCJkaXNwbGF5X25hbWUiOiJUcm9uZyBOZ2hpYSBOZ3V5ZW4iLCJfX21ldGFkYXRhIjp7InVyaSI6Ii9ld2Evc29jaWFsX3NlcnZpY2VfYWNjb3VudCgxMTY2KSIsInR5cGUiOiIifX1dLCJoYXNfZGlzYWJsZWRfbmV3c2xldHRlciI6ZmFsc2UsImp3dF9zZWNyZXQiOiI0UDVTQzZGV1pIVU5JR0NDT1dJQUtST0tST0RMUTRNVSIsImhhc1Bhc3N3b3JkU2V0Ijp0cnVlLCJuZWVkc1Bhc3N3b3JkUmVzZXQiOmZhbHNlLCJwdWJsaWNfa2V5Ijp0cnVlLCJmZWF0dXJlcyI6W10sImludGVyY29tVXNlck5hbWUiOiJnX3Ryb25nX25naGlhX25ndXllbiIsImludGVyY29tVXNlckhhc2giOiI5YTM0NmUwZTgzNjk0MzYxODU3MTdjNWRhZTZkZWZhZDdiYmM4YzZkOGNlMzgxYjhhYTY5YWRjMTRhYWZiNGU0IiwicGVybWlzc2lvbnMiOltdLCJpYXQiOjE0NDgyNTY2ODMsImV4cCI6MTQ0ODg2MTQ4M30.oqq4DUI4cTbhzYznSwODZ_4zLOeGiJYuZRn82gTfQ6o' +{ + "id": int, + "organization": Union[List[OrganizationType], PineDeferred], + "has_private_access_to__device_type": Union[List[TypeDevice], PineDeferred] +} ``` -### Function: get_user_id() -This function retrieves current logged in user's id. -#### Returns: - str: user id. +## OrganizationType -#### Raises: - InvalidOption: if not logged in. -#### Examples: ```python -# If you are logged in. ->>> balena.auth.get_user_id() -5397 +{ + "id": int, + "created_at": str, + "name": str, + "handle": str, + "logo_image": WebResource, + "has_past_due_invoice_since__date": str, + "application": Optional[List[TypeApplication]], + "organization_membership": Optional[List[OrganizationMembershipType]], + "owns__team": Optional[List[TeamType]], + "organization__has_private_access_to__device_type": Optional[List[OrganizationPrivateDeviceTypeAccess]] +} ``` -### Function: is_logged_in() -This function checks if you're logged in -#### Returns: - bool: True if logged in, False otherwise. +## PineDeferred + -#### Examples: ```python -# Check if user logged in. ->>> if balena.auth.is_logged_in(): -... print('You are logged in!') -... else: -... print('You are not logged in!') +{ + "_PineDeferred__id": int +} ``` -### Function: log_out() -This function is used for logging out from balena. -#### Returns: - bool: True if successful, False otherwise. +## PublicDeviceType + -#### Examples: ```python -# If you are logged in. ->>> balena.auth.log_out() -True +{ + "latitude": str, + "longitude": str, + "belongs_to__application": Union[List[TypeApplication], PineDeferred], + "is_of__device_type": Union[List[TypeDevice], PineDeferred], + "was_recently_online": bool +} ``` -### Function: login() - -This function is used for logging into balena using email and password. -#### Args: - **credentials: credentials keyword arguments. - username (str): Balena email. - password (str): Password. -#### Returns: - This functions saves Auth Token to Settings and returns nothing. +## PublicOrganizationType -#### Raises: - LoginFailed: if the email or password is invalid. -#### Examples: ```python ->>> from balena import Balena ->>> balena = Balena() ->>> credentials = {'username': '', 'password': ''} ->>> balena.auth.login(**credentials) -(Empty Return) +{ + "id": int, + "name": str, + "handle": str +} ``` -### Function: login_with_token(token) - -This function is used for logging into balena using Auth Token. -Auth Token can be found in Preferences section on balena Dashboard. -#### Args: - token (str): Auth Token. -#### Returns: - This functions saves Auth Token to Settings and returns nothing. +## ReleaseImageType -#### Raises: - MalformedToken: if token is invalid. -#### Examples: ```python ->>> from balena import Balena ->>> balena = Balena() ->>> auth_token = ->>> balena.auth.login_with_token(auth_token) -(Empty Return) +{ + "id": int, + "created_at": str, + "image": Union[List[ImageType], PineDeferred], + "is_part_of__release": Union[List[ReleaseType], PineDeferred] +} ``` -### Function: register() -This function is used for registering to balena. -#### Args: - **credentials: credentials keyword arguments. - email (str): email to register. - password (str): Password. +## ReleaseType + + +```python +{ + "id": int, + "created_at": str, + "commit": str, + "composition": Any, + "contract": Any, + "status": Literal["cancelled", "error", "failed", "interrupted", "local", "running", "success", "timeout"], + "source": str, + "build_log": str, + "is_invalidated": bool, + "start_timestamp": str, + "update_timestamp": str, + "end_timestamp": str, + "phase": Literal["next", "current", "sunset", "end-of-life"], + "semver": str, + "semver_major": int, + "semver_minor": int, + "semver_patch": int, + "semver_prerelease": str, + "semver_build": str, + "variant": str, + "revision": int, + "known_issue_list": str, + "raw_version": str, + "version": ReleaseVersion, + "is_final": bool, + "is_finalized_at__date": str, + "note": str, + "invalidation_reason": str, + "is_created_by__user": Union[List[UserType], PineDeferred, None], + "belongs_to__application": Union[List[TypeApplication], PineDeferred], + "release_image": Optional[List[ReleaseImageType]], + "should_be_running_on__application": Optional[List[TypeApplication]], + "is_running_on__device": Optional[List[TypeDevice]], + "is_pinned_to__device": Optional[List[TypeDevice]], + "should_operate__device": Optional[List[TypeDevice]], + "should_manage__device": Optional[List[TypeDevice]], + "release_tag": Optional[List[BaseTagType]] +} +``` -#### Returns: - str: Auth Token for new account. -#### Raises: - RequestError: if error occurs during registration. +## ReleaseVersion + -#### Examples: ```python ->>> credentials = {'email': '', 'password': ''} ->>> balena.auth.register(**credentials) -'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6NTM5OCwidXNlcm5hbWUiOiJ0ZXN0MjcxMCIsImVtYWlsIjoidGVzdDI3MTBAZ21haWwuY29tIiwic29jaWFsX3NlcnZpY2VfYWNjb3VudCI6bnVsbCwiaGFzX2Rpc2FibGVkX25ld3NsZXR0ZXIiOmZhbHNlLCJqd3Rfc2VjcmV0IjoiQlJXR0ZIVUgzNVBKT0VKTVRSSVo2MjdINjVKVkJKWDYiLCJoYXNQYXNzd29yZFNldCI6dHJ1ZSwibmVlZHNQYXNzd29yZFJlc2V0IjpmYWxzZSwicHVibGljX2tleSI6ZmFsc2UsImZlYXR1cmVzIjpbXSwiaW50ZXJjb21Vc2VyTmFtZSI6InRlc3QyNzEwIiwiaW50ZXJjb21Vc2VySGFzaCI6IjNiYTRhZDRkZjk4MDQ1OTc1YmU2ZGUwYWJmNjFiYjRmYWY4ZmEzYTljZWI0YzE4Y2QxOGU1NmViNmI1NzkxZDAiLCJwZXJtaXNzaW9ucyI6W10sImlhdCI6MTQ0ODI1NzgyOCwiZXhwIjoxNDQ4ODYyNjI4fQ.chhf6deZ9BNDMmPr1Hm-SlRoWkK7t_4cktAPo12aCoE' +{ + "raw": str, + "major": int, + "minor": int, + "patch": int, + "version": str, + "build": List[str], + "prerelease": List[Union[str, int]] +} ``` -### Function: who_am_i() -This function retrieves username of logged in user. -#### Returns: - str: username. - -#### Raises: - NotLoggedIn: if there is no user logged in. - -#### Examples: -```python ->>> balena.auth.who_am_i() -u'g_trong_nghia_nguyen' +## ReleaseWithImageDetailsType + + +```python +{ + "id": int, + "created_at": str, + "commit": str, + "composition": Any, + "contract": Any, + "status": Literal["cancelled", "error", "failed", "interrupted", "local", "running", "success", "timeout"], + "source": str, + "build_log": str, + "is_invalidated": bool, + "start_timestamp": str, + "update_timestamp": str, + "end_timestamp": str, + "phase": Literal["next", "current", "sunset", "end-of-life"], + "semver": str, + "semver_major": int, + "semver_minor": int, + "semver_patch": int, + "semver_prerelease": str, + "semver_build": str, + "variant": str, + "revision": int, + "known_issue_list": str, + "raw_version": str, + "version": ReleaseVersion, + "is_final": bool, + "is_finalized_at__date": str, + "note": str, + "invalidation_reason": str, + "is_created_by__user": Union[List[UserType], PineDeferred, None], + "belongs_to__application": Union[List[TypeApplication], PineDeferred], + "release_image": Optional[List[ReleaseImageType]], + "should_be_running_on__application": Optional[List[TypeApplication]], + "is_running_on__device": Optional[List[TypeDevice]], + "is_pinned_to__device": Optional[List[TypeDevice]], + "should_operate__device": Optional[List[TypeDevice]], + "should_manage__device": Optional[List[TypeDevice]], + "release_tag": Optional[List[BaseTagType]], + "images": List[ImageBasicInfoType], + "user": BasicUserInfoType +} ``` -## Logs -This class implements functions that allow processing logs from device. -### Function: history(uuid, count) -Get device logs history. +## SSHKeyType -#### Args: - uuid (str): device uuid. - count (Optional[int]): number of historical messages to include. -### Function: subscribe(uuid, callback, error, count) -Subscribe to device logs. +```python +{ + "title": str, + "public_key": str, + "id": int, + "created_at": str, + "user": Union[List[UserType], PineDeferred] +} +``` -#### Args: - uuid (str): device uuid. - callback (function): this callback is called on receiving a message. - error (Optional[function]): this callback is called on an error event. - count (Optional[int]): number of historical messages to include. -#### Returns: - dict: a log entry will contain the following keys: `isStdErr, timestamp, message, isSystem, createdAt`. -### Function: unsubscribe(uuid) +## ServiceInstanceType -Unsubscribe from device logs for a specific device. -#### Args: - uuid (str): device uuid. -### Function: unsubscribe_all() +```python +{ + "id": int, + "created_at": str, + "service_type": str, + "ip_address": str, + "last_heartbeat": str +} +``` -Unsubscribe all subscribed devices. -## Settings -This class handles settings for balena python SDK. +## ServiceType -#### Attributes: - HOME_DIRECTORY (str): home directory path. - CONFIG_SECTION (str): section name in configuration file. - CONFIG_FILENAME (str): configuration file name. - _setting (dict): default value to settings. -### Function: get(key) -Get a setting value. +```python +{ + "id": int, + "created_at": str, + "service_name": str, + "application": Union[List[TypeApplication], PineDeferred], + "is_built_by__image": Optional[List[ImageType]], + "service_environment_variable": Optional[List[EnvironmentVariableBase]], + "device_service_environment_variable": Optional[List[EnvironmentVariableBase]] +} +``` -#### Args: - key (str): setting. -#### Returns: - str: setting value. +## TeamApplicationAccessType -#### Raises: - InvalidOption: If getting a non-existent setting. -#### Examples: ```python ->>> balena.settings.get('api_endpoint') -'https://api.balena.io/' +{ + "id": int, + "team": Union[List[TeamType], PineDeferred], + "grants_access_to__application": Union[List[TypeApplication], PineDeferred], + "application_membership_role": Union[List[ApplicationMembershipRoleType], PineDeferred] +} ``` -### Function: get_all() -Get all settings. -#### Returns: - dict: all settings. +## TeamMembershipType + -#### Examples: ```python ->>> balena.settings.get_all() -{'image_cache_time': '604800000', 'api_endpoint': 'https://api.balena.io/', 'data_directory': '/root/.balena', 'token_refresh_interval': '3600000', 'cache_directory': '/root/.balena/cache', 'pine_endpoint': 'https://api.balena.io/ewa/'} +{ + "id": int, + "created_at": str, + "user": Union[List[UserType], PineDeferred], + "is_member_of__team": Union[List[TeamType], PineDeferred] +} ``` -### Function: has(key) -Check if a setting exists. -#### Args: - key (str): setting. +## TeamType -#### Returns: - bool: True if exists, False otherwise. -#### Examples: ```python ->>> balena.settings.has('api_endpoint') -True +{ + "id": int, + "created_at": str, + "name": str, + "belongs_to__organization": Union[List[OrganizationType], PineDeferred], + "team_membership": Optional[List[TeamMembershipType]], + "team_application_access": Optional[List[TeamApplicationAccessType]] +} ``` -### Function: remove(key) -Remove a setting. -#### Args: - key (str): setting. +## TypeApplication + + +```python +{ + "id": int, + "created_at": str, + "app_name": str, + "actor": Union[List[ActorType], PineDeferred], + "slug": str, + "uuid": str, + "is_accessible_by_support_until__date": str, + "is_host": bool, + "should_track_latest_release": bool, + "is_public": bool, + "is_of__class": Literal["fleet", "block", "app"], + "is_archived": bool, + "is_discoverable": bool, + "is_stored_at__repository_url": str, + "public_organization": Union[List[PublicOrganizationType], PineDeferred, None], + "application_type": Union[List[ApplicationType], PineDeferred], + "is_for__device_type": Union[List[DeviceTypeType], PineDeferred], + "depends_on__application": Union[List[ApplicationType], PineDeferred, None], + "organization": Union[List[OrganizationType], PineDeferred], + "should_be_running__release": Union[List[ReleaseType], PineDeferred, None], + "application_config_variable": Optional[List[EnvironmentVariableBase]], + "application_environment_variable": Optional[List[EnvironmentVariableBase]], + "build_environment_variable": Optional[List[EnvironmentVariableBase]], + "application_tag": Optional[List[BaseTagType]], + "owns__device": Optional[List[TypeDevice]], + "owns__public_device": Optional[List[PublicDeviceType]], + "owns__release": Optional[List[ReleaseType]], + "service": Optional[List[ServiceType]], + "is_depended_on_by__application": Optional[List[ApplicationType]], + "is_directly_accessible_by__user": Optional[List[UserType]], + "user_application_membership": Optional[List[ApplicationMembershipType]], + "team_application_access": Optional[List[TeamApplicationAccessType]], + "can_use__application_as_host": Optional[List[ApplicationHostedOnApplication]] +} +``` -#### Returns: - bool: True if successful, False otherwise. -#### Examples: -```python -# Remove an existing key from settings ->>> balena.settings.remove('tmp') -True -# Remove a non-existing key from settings ->>> balena.settings.remove('tmp1') -False +## TypeApplicationWithDeviceServiceDetails + + +```python +{ + "id": int, + "created_at": str, + "app_name": str, + "actor": Union[List[ActorType], PineDeferred], + "slug": str, + "uuid": str, + "is_accessible_by_support_until__date": str, + "is_host": bool, + "should_track_latest_release": bool, + "is_public": bool, + "is_of__class": Literal["fleet", "block", "app"], + "is_archived": bool, + "is_discoverable": bool, + "is_stored_at__repository_url": str, + "public_organization": Union[List[PublicOrganizationType], PineDeferred, None], + "application_type": Union[List[ApplicationType], PineDeferred], + "is_for__device_type": Union[List[DeviceTypeType], PineDeferred], + "depends_on__application": Union[List[ApplicationType], PineDeferred, None], + "organization": Union[List[OrganizationType], PineDeferred], + "should_be_running__release": Union[List[ReleaseType], PineDeferred, None], + "application_config_variable": Optional[List[EnvironmentVariableBase]], + "application_environment_variable": Optional[List[EnvironmentVariableBase]], + "build_environment_variable": Optional[List[EnvironmentVariableBase]], + "application_tag": Optional[List[BaseTagType]], + "owns__device": List[TypeDeviceWithServices], + "owns__public_device": Optional[List[PublicDeviceType]], + "owns__release": Optional[List[ReleaseType]], + "service": Optional[List[ServiceType]], + "is_depended_on_by__application": Optional[List[ApplicationType]], + "is_directly_accessible_by__user": Optional[List[UserType]], + "user_application_membership": Optional[List[ApplicationMembershipType]], + "team_application_access": Optional[List[TeamApplicationAccessType]], + "can_use__application_as_host": Optional[List[ApplicationHostedOnApplication]] +} ``` -### Function: set(key, value) -Set value for a setting. -#### Args: - key (str): setting. - value (str): setting value. +## TypeCurrentService + -#### Examples: ```python ->>> balena.settings.set(key='tmp',value='123456') -(Empty Return) +{ + "id": int, + "image_id": int, + "service_id": int, + "download_progress": int, + "status": str, + "install_date": str +} ``` -## TwoFactorAuth -This class implements basic 2FA functionalities for balena python SDK. -### Function: challenge(code) -Challenge two-factor authentication. -If your account has two-factor authentication enabled and logging in using credentials, you need to pass two-factor authentication before being allowed to use other functions. +## TypeDevice + + +```python +{ + "id": int, + "actor": Union[List[ActorType], PineDeferred], + "created_at": str, + "modified_at": str, + "custom_latitude": str, + "custom_longitude": str, + "device_name": str, + "download_progress": int, + "ip_address": str, + "public_address": str, + "mac_address": str, + "is_accessible_by_support_until__date": str, + "is_connected_to_vpn": bool, + "is_locked_until__date": str, + "is_web_accessible": bool, + "is_active": bool, + "is_frozen": bool, + "is_online": bool, + "last_connectivity_event": str, + "last_vpn_event": str, + "latitude": str, + "local_id": str, + "location": str, + "longitude": str, + "note": str, + "os_variant": str, + "os_version": str, + "provisioning_progress": int, + "provisioning_state": str, + "status": str, + "supervisor_version": str, + "uuid": str, + "api_heartbeat_state": Literal["online", "offline", "timeout", "unknown"], + "memory_usage": int, + "memory_total": int, + "storage_block_device": str, + "storage_usage": int, + "storage_total": int, + "cpu_usage": int, + "cpu_temp": int, + "cpu_id": str, + "is_undervolted": bool, + "overall_status": Literal["configuring", "inactive", "post-provisioning", "updating", "operational", "disconnected", "reduced-functionality"], + "overall_progress": int, + "is_of__device_type": Union[List[DeviceTypeType], PineDeferred], + "belongs_to__application": Union[List[TypeApplication], PineDeferred], + "belongs_to__user": Union[List[UserType], PineDeferred, None], + "is_running__release": Union[List[ReleaseType], PineDeferred, None], + "is_pinned_on__release": Union[List[ReleaseType], PineDeferred, None], + "is_managed_by__service_instance": Union[List[ServiceInstanceType], PineDeferred, None], + "should_be_operated_by__release": Union[List[ReleaseType], PineDeferred, None], + "should_be_managed_by__release": Union[List[ReleaseType], PineDeferred, None], + "device_config_variable": Optional[List[EnvironmentVariableBase]], + "device_environment_variable": Optional[List[EnvironmentVariableBase]], + "device_tag": Optional[List[BaseTagType]], + "service_install": Optional[List[ServiceInstanceType]], + "image_install": Optional[List[ImageInstallType]] +} +``` -#### Args: - code (str): two-factor authentication code. -#### Examples: -```python -# You need to enable two-factor authentication on dashboard first. -# Check if two-factor authentication is passed for current session. ->>> balena.twofactor_auth.is_passed() -False ->>> secret = balena.twofactor_auth.get_otpauth_secret() ->>> balena.twofactor_auth.challenge(balena.twofactor_auth.generate_code(secret)) -# Check again if two-factor authentication is passed for current session. ->>> balena.twofactor_auth.is_passed() -True +## TypeDeviceWithServices + + +```python +{ + "id": int, + "actor": Union[List[ActorType], PineDeferred], + "created_at": str, + "modified_at": str, + "custom_latitude": str, + "custom_longitude": str, + "device_name": str, + "download_progress": int, + "ip_address": str, + "public_address": str, + "mac_address": str, + "is_accessible_by_support_until__date": str, + "is_connected_to_vpn": bool, + "is_locked_until__date": str, + "is_web_accessible": bool, + "is_active": bool, + "is_frozen": bool, + "is_online": bool, + "last_connectivity_event": str, + "last_vpn_event": str, + "latitude": str, + "local_id": str, + "location": str, + "longitude": str, + "note": str, + "os_variant": str, + "os_version": str, + "provisioning_progress": int, + "provisioning_state": str, + "status": str, + "supervisor_version": str, + "uuid": str, + "api_heartbeat_state": Literal["online", "offline", "timeout", "unknown"], + "memory_usage": int, + "memory_total": int, + "storage_block_device": str, + "storage_usage": int, + "storage_total": int, + "cpu_usage": int, + "cpu_temp": int, + "cpu_id": str, + "is_undervolted": bool, + "overall_status": Literal["configuring", "inactive", "post-provisioning", "updating", "operational", "disconnected", "reduced-functionality"], + "overall_progress": int, + "is_of__device_type": Union[List[DeviceTypeType], PineDeferred], + "belongs_to__application": Union[List[TypeApplication], PineDeferred], + "belongs_to__user": Union[List[UserType], PineDeferred, None], + "is_running__release": Union[List[ReleaseType], PineDeferred, None], + "is_pinned_on__release": Union[List[ReleaseType], PineDeferred, None], + "is_managed_by__service_instance": Union[List[ServiceInstanceType], PineDeferred, None], + "should_be_operated_by__release": Union[List[ReleaseType], PineDeferred, None], + "should_be_managed_by__release": Union[List[ReleaseType], PineDeferred, None], + "device_config_variable": Optional[List[EnvironmentVariableBase]], + "device_environment_variable": Optional[List[EnvironmentVariableBase]], + "device_tag": Optional[List[BaseTagType]], + "service_install": Optional[List[ServiceInstanceType]], + "image_install": Optional[List[ImageInstallType]], + "current_services": Dict[str, List[TypeCurrentService]] +} ``` -### Function: generate_code(secret) -Generate two-factor authentication code. -#### Args: - secret (str): one time password authentication secret string. +## TypeVar -#### Returns: - str: 6 digit two-factor authentication code. -#### Examples: ```python ->>> secret = balena.twofactor_auth.get_otpauth_secret() ->>> balena.twofactor_auth.generate_code(secret) -'259975' +{ + +} ``` -### Function: get_otpauth_secret() -Retrieve one time password authentication secret string. -This function only works if you disable two-factor authentication or log in using Auth Token from dashboard. -#### Returns: - str: one time password authentication secret string. +## TypedDict + -#### Examples: ```python ->>> balena.twofactor_auth.get_otpauth_secret() -'WGURB3DIUWXTGQDBGFNGKDLV2L3LXOVN' +{ + +} ``` -### Function: is_enabled() -Check if two-factor authentication is enabled. -#### Returns: - bool: True if enabled. Otherwise False. +## UserType + -#### Examples: ```python ->>> balena.twofactor_auth.is_enabled() -False +{ + "id": int, + "actor": Union[List[ActorType], PineDeferred], + "created_at": str, + "username": str, + "organization_membership": Optional[List[OrganizationMembershipType]], + "user_application_membership": Optional[List[ApplicationMembershipType]], + "team_membership": Optional[List[TeamMembershipType]], + "has_direct_access_to__application": Optional[List[TypeApplication]] +} ``` -### Function: is_passed() -Check if two-factor authentication challenge was passed. -#### Returns: - bool: True if enabled. Otherwise False. +## WebResource + -#### Examples: ```python ->>> balena.twofactor_auth.is_passed() -True +{ + "filename": str, + "href": str, + "content_type": str, + "content_disposition": str, + "size": int +} ``` + + diff --git a/pages/external-docs/sdk/python-sdk/v14.5.0.md b/pages/external-docs/sdk/python-sdk/v14.5.0.md index 2de128c2a8..08a691bc6b 100644 --- a/pages/external-docs/sdk/python-sdk/v14.5.0.md +++ b/pages/external-docs/sdk/python-sdk/v14.5.0.md @@ -30,7 +30,7 @@ The Balena object can be configured with a dict of type Settings ```python balena = Balena({ "balena_host": "balena-cloud.com", - "api_version": "v6", + "api_version": "v7", "device_actions_endpoint_version": "v1", "data_directory": "/home/example/.balena", "image_cache_time": str(1 * 1000 * 60 * 60 * 24 * 7), # 1 week @@ -77,1096 +77,863 @@ balena = Balena({"retry_rate_limited_request": True}) If you feel something is missing, not clear or could be improved, [please don't hesitate to open an issue in GitHub](https://github.com/balena-io/balena-sdk-python/issues), we'll be happy to help. -## Table of Contents -- [balena](#balena) - - [.models](#models) - - [.application](#application) - - [create(name, device_type, organization, application_class)](#application.create) ⇒ [TypeApplication](#typeapplication) - - [disable_device_urls(slug_or_uuid_or_id)](#application.disable_device_urls) ⇒ None - - [enable_device_urls(slug_or_uuid_or_id)](#application.enable_device_urls) ⇒ None - - [generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date)](#application.generate_provisioning_key) ⇒ str - - [get(slug_or_uuid_or_id, options, context)](#application.get) ⇒ [TypeApplication](#typeapplication) - - [get_all(options, context)](#application.get_all) ⇒ [List[TypeApplication]](#typeapplication) - - [get_all_by_organization(org_handle_or_id, options)](#application.get_all_by_organization) ⇒ [List[TypeApplication]](#typeapplication) - - [get_all_directly_accessible(options)](#application.get_all_directly_accessible) ⇒ [List[TypeApplication]](#typeapplication) - - [get_by_name(app_name, options, context)](#application.get_by_name) ⇒ [TypeApplication](#typeapplication) - - [get_by_owner(app_name, owner, options)](#application.get_by_owner) ⇒ [TypeApplication](#typeapplication) - - [get_dashboard_url(app_id)](#application.get_dashboard_url) ⇒ str - - [get_directly_accessible(slug_or_uuid_or_id, options)](#application.get_directly_accessible) ⇒ [TypeApplication](#typeapplication) - - [get_id(slug_or_uuid_or_id)](#application.get_id) ⇒ int - - [get_target_release_hash(slug_or_uuid_or_id)](#application.get_target_release_hash) ⇒ Optional[str] - - [get_with_device_service_details(slug_or_uuid_or_id, options)](#application.get_with_device_service_details) ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) - - [grant_support_access(slug_or_uuid_or_id, expiry_timestamp)](#application.grant_support_access) ⇒ None - - [has(slug_or_uuid_or_id)](#application.has) ⇒ bool - - [has_any()](#application.has_any) ⇒ bool - - [is_tracking_latest_release(slug_or_uuid_or_id)](#application.is_tracking_latest_release) ⇒ bool - - [pin_to_release(slug_or_uuid_or_id, full_release_hash)](#application.pin_to_release) ⇒ None - - [purge(app_id)](#application.purge) ⇒ None - - [reboot(app_id, options)](#application.reboot) ⇒ None - - [remove(slug_or_uuid_or_id)](#application.remove) ⇒ None - - [rename(slug_or_uuid_or_id, new_name)](#application.rename) ⇒ None - - [restart(slug_or_uuid_or_id)](#application.restart) ⇒ None - - [revoke_support_access(slug_or_uuid_or_id)](#application.revoke_support_access) ⇒ None - - [shutdown(app_id, options)](#application.shutdown) ⇒ None - - [track_latest_release(slug_or_uuid_or_id)](#application.track_latest_release) ⇒ None - - [will_track_new_releases(slug_or_uuid_or_id)](#application.will_track_new_releases) ⇒ bool - - [.tags](#applicationtag) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationtag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(slug_or_uuid_or_id, tag_key)](#applicationtag.remove) ⇒ None - - [set(slug_or_uuid_or_id, tag_key, value)](#applicationtag.set) ⇒ None - - [.config_var](#applicationconfigvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#applicationconfigvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationconfigvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#applicationconfigvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#applicationconfigvariable.set) ⇒ None - - [.env_var](#applicationenvvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#applicationenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#applicationenvvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#applicationenvvariable.set) ⇒ None - - [.build_var](#buildenvvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#buildenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#buildenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#buildenvvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#buildenvvariable.set) ⇒ None - - [.membership](#applicationmembership) - - [change_role(membership_id, role_name)](#applicationmembership.change_role) ⇒ None - - [create(slug_or_uuid_or_id, username, role_name)](#applicationmembership.create) ⇒ [ApplicationMembershipType](#applicationmembershiptype) - - [get(membership_id, options)](#applicationmembership.get) ⇒ [ApplicationMembershipType](#applicationmembershiptype) - - [get_all(options)](#applicationmembership.get_all) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationmembership.get_all_by_application) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) - - [remove(membership_id)](#applicationmembership.remove) ⇒ None - - [.invite](#applicationinvite) - - [accept(invite_token)](#applicationinvite.accept) ⇒ None - - [create(slug_or_uuid_or_id, options)](#applicationinvite.create) ⇒ [ApplicationInviteType](#applicationinvitetype) - - [get_all(options)](#applicationinvite.get_all) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationinvite.get_all_by_application) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) - - [revoke(invite_id)](#applicationinvite.revoke) ⇒ None - - [.device](#device) - - [deactivate(uuid_or_id_or_ids)](#device.deactivate) ⇒ None - - [disable_device_url(uuid_or_id_or_ids)](#device.disable_device_url) ⇒ None - - [disable_local_mode(uuid_or_id)](#device.disable_local_mode) ⇒ None - - [disable_lock_override(uuid_or_id)](#device.disable_lock_override) ⇒ None - - [enable_device_url(uuid_or_id_or_ids)](#device.enable_device_url) ⇒ None - - [enable_local_mode(uuid_or_id)](#device.enable_local_mode) ⇒ None - - [enable_lock_override(uuid_or_id)](#device.enable_lock_override) ⇒ None - - [generate_device_key(uuid_or_id, name, description, expiry_date)](#device.generate_device_key) ⇒ str - - [generate_uuid()](#device.generate_uuid) ⇒ str - - [get(uuid_or_id, options)](#device.get) ⇒ [TypeDevice](#typedevice) - - [get_all(options)](#device.get_all) ⇒ [List[TypeDevice]](#typedevice) - - [get_all_by_application(slug_or_uuid_or_id, options)](#device.get_all_by_application) ⇒ [List[TypeDevice]](#typedevice) - - [get_all_by_organization(handle_or_id, options)](#device.get_all_by_organization) ⇒ [List[TypeDevice]](#typedevice) - - [get_application_info(uuid_or_id)](#device.get_application_info) ⇒ Any - - [get_application_name(uuid_or_id)](#device.get_application_name) ⇒ str - - [get_by_name(name, options)](#device.get_by_name) ⇒ [List[TypeDevice]](#typedevice) - - [get_dashboard_url(uuid)](#device.get_dashboard_url) ⇒ None - - [get_device_url(uuid_or_id)](#device.get_device_url) ⇒ str - - [get_local_ip_address(uuid_or_id)](#device.get_local_ip_address) ⇒ List[str] - - [get_local_mode_support(uuid_or_id)](#device.get_local_mode_support) ⇒ LocalModeResponse - - [get_mac_address(uuid_or_id)](#device.get_mac_address) ⇒ List[str] - - [get_metrics(uuid_or_id)](#device.get_metrics) ⇒ [DeviceMetricsType](#devicemetricstype) - - [get_name(uuid_or_id)](#device.get_name) ⇒ str - - [get_os_update_status(uuid_or_id)](#device.get_os_update_status) ⇒ HUPStatusResponse - - [get_status(uuid_or_id)](#device.get_status) ⇒ str - - [get_supervisor_state(uuid_or_id)](#device.get_supervisor_state) ⇒ SupervisorStateType - - [get_supervisor_target_state(uuid_or_id)](#device.get_supervisor_target_state) ⇒ Any - - [get_supervisor_target_state_for_app(slug_or_uuid_or_id, release)](#device.get_supervisor_target_state_for_app) ⇒ Any - - [get_with_service_details(uuid_or_id, options)](#device.get_with_service_details) ⇒ [TypeDeviceWithServices](#typedevicewithservices) - - [grant_support_access(uuid_or_id_or_ids, expiry_timestamp)](#device.grant_support_access) ⇒ None - - [has(uuid_or_id)](#device.has) ⇒ bool - - [has_device_url(uuid_or_id)](#device.has_device_url) ⇒ bool - - [has_lock_override(uuid_or_id)](#device.has_lock_override) ⇒ bool - - [identify(uuid_or_id)](#device.identify) ⇒ None - - [is_in_local_mode(uuid_or_id)](#device.is_in_local_mode) ⇒ bool - - [is_online(uuid_or_id)](#device.is_online) ⇒ bool - - [is_tracking_application_release(uuid_or_id)](#device.is_tracking_application_release) ⇒ bool - - [move(uuid_or_id, app_slug_or_uuid_or_id)](#device.move) ⇒ None - - [pin_to_release(uuid_or_id, full_release_hash_or_id)](#device.pin_to_release) ⇒ None - - [ping(uuid_or_id)](#device.ping) ⇒ None - - [purge(uuid_or_id)](#device.purge) ⇒ None - - [reboot(uuid_or_id, force)](#device.reboot) ⇒ None - - [register(application_slug_or_uuid_or_id, uuid, device_type_slug)](#device.register) ⇒ RegisterResponse - - [remove(uuid_or_id_or_ids)](#device.remove) ⇒ None - - [rename(uuid_or_id, new_name)](#device.rename) ⇒ None - - [restart_application(uuid_or_id)](#device.restart_application) ⇒ None - - [restart_service(uuid_or_id, image_id)](#device.restart_service) ⇒ None - - [revoke_support_access(uuid_or_id_or_ids)](#device.revoke_support_access) ⇒ None - - [set_custom_location(uuid_or_id_or_ids, location)](#device.set_custom_location) ⇒ None - - [set_note(uuid_or_id_or_ids, note)](#device.set_note) ⇒ None - - [set_supervisor_release(uuid_or_id, supervisor_version_or_id)](#device.set_supervisor_release) ⇒ None - - [shutdown(uuid_or_id, force)](#device.shutdown) ⇒ None - - [start_application(uuid_or_id)](#device.start_application) ⇒ None - - [start_os_update(uuid_or_id, target_os_version)](#device.start_os_update) ⇒ HUPStatusResponse - - [start_service(uuid_or_id, image_id)](#device.start_service) ⇒ None - - [stop_application(uuid_or_id)](#device.stop_application) ⇒ None - - [stop_service(uuid_or_id, image_id)](#device.stop_service) ⇒ None - - [track_application_release(uuid_or_id_or_ids)](#device.track_application_release) ⇒ None - - [unset_custom_location(uuid_or_id_or_ids)](#device.unset_custom_location) ⇒ None - - [update(uuid_or_id, force)](#device.update) ⇒ None - - [.tags](#devicetag) - - [get(uuid_or_id, tag_key)](#devicetag.get) ⇒ Optional[str] - - [get_all(options)](#devicetag.get_all) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#devicetag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_device(uuid_or_id, options)](#devicetag.get_all_by_device) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(uuid_or_id, tag_key)](#devicetag.remove) ⇒ None - - [set(uuid_or_id, tag_key, value)](#devicetag.set) ⇒ None - - [.config_var](#deviceconfigvariable) - - [get(uuid_or_id, env_var_name)](#deviceconfigvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceconfigvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceconfigvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, key)](#deviceconfigvariable.remove) ⇒ None - - [set(uuid_or_id, env_var_name, value)](#deviceconfigvariable.set) ⇒ None - - [.env_var](#deviceenvvariable) - - [get(uuid_or_id, env_var_name)](#deviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceenvvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, key)](#deviceenvvariable.remove) ⇒ None - - [set(uuid_or_id, env_var_name, value)](#deviceenvvariable.set) ⇒ None - - [.service_var](#deviceserviceenvvariable) - - [get(uuid_or_id, service_name_or_id, key)](#deviceserviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceserviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceserviceenvvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, service_name_or_id, key)](#deviceserviceenvvariable.remove) ⇒ None - - [set(uuid_or_id, service_name_or_id, key, value)](#deviceserviceenvvariable.set) ⇒ None - - [.history](#devicehistory) - - [get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options)](#devicehistory.get_all_by_application) ⇒ [List[DeviceHistoryType]](#devicehistorytype) - - [get_all_by_device(uuid_or_id, from_date, to_date, options)](#devicehistory.get_all_by_device) ⇒ [List[DeviceHistoryType]](#devicehistorytype) - - [.device_type](#devicetype) - - [get(id_or_slug, options)](#devicetype.get) ⇒ [DeviceTypeType](#devicetypetype) - - [get_all(options)](#devicetype.get_all) ⇒ [List[DeviceTypeType]](#devicetypetype) - - [get_all_supported(options)](#devicetype.get_all_supported) ⇒ None - - [get_by_slug_or_name(slug_or_name, options)](#devicetype.get_by_slug_or_name) ⇒ [DeviceTypeType](#devicetypetype) - - [get_name(slug)](#devicetype.get_name) ⇒ str - - [get_slug_by_name(name)](#devicetype.get_slug_by_name) ⇒ str - - [.api_key](#apikey) - - [create(name, description, expiry_date)](#apikey.create) ⇒ str - - [get_all(options)](#apikey.get_all) ⇒ [List[APIKeyType]](#apikeytype) - - [get_all_named_user_api_keys(options)](#apikey.get_all_named_user_api_keys) ⇒ [List[APIKeyType]](#apikeytype) - - [get_device_api_keys_by_device(uuid_or_id, options)](#apikey.get_device_api_keys_by_device) ⇒ [List[APIKeyType]](#apikeytype) - - [get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options)](#apikey.get_provisioning_api_keys_by_application) ⇒ [List[APIKeyType]](#apikeytype) - - [revoke(id)](#apikey.revoke) ⇒ None - - [update(id, api_key_info)](#apikey.update) ⇒ None - - [.key](#key) - - [create(title, key)](#key.create) ⇒ [SSHKeyType](#sshkeytype) - - [get(id)](#key.get) ⇒ [SSHKeyType](#sshkeytype) - - [get_all(options)](#key.get_all) ⇒ [List[SSHKeyType]](#sshkeytype) - - [remove(id)](#key.remove) ⇒ None - - [.organization](#organization) - - [create(name, handle, logo_image)](#organization.create) ⇒ [OrganizationType](#organizationtype) - - [get(handle_or_id, options)](#organization.get) ⇒ [OrganizationType](#organizationtype) - - [get_all(options)](#organization.get_all) ⇒ [List[OrganizationType]](#organizationtype) - - [remove(handle_or_id)](#organization.remove) ⇒ None - - [.membership](#organizationmembership) - - [get(membership_id, options)](#organizationmembership.get) ⇒ [OrganizationMembershipType](#organizationmembershiptype) - - [get_all(options)](#organizationmembership.get_all) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) - - [get_all_by_organization(handle_or_id, options)](#organizationmembership.get_all_by_organization) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) - - [.tags](#organizationmembershiptag) - - [get(membership_id, tag_key)](#organizationmembershiptag.get) ⇒ Optional[str] - - [get_all(options)](#organizationmembershiptag.get_all) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [get_all_by_organization(handle_or_id, options)](#organizationmembershiptag.get_all_by_organization) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [get_all_by_organization_membership(membership_id, options)](#organizationmembershiptag.get_all_by_organization_membership) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [remove(membership_id, tag_key)](#organizationmembershiptag.remove) ⇒ None - - [set(membership_id, tag_key, value)](#organizationmembershiptag.set) ⇒ None - - [.invite](#organizationinvite) - - [accept(invite_token)](#organizationinvite.accept) ⇒ None - - [create(handle_or_id, invitee, role_name, message)](#organizationinvite.create) ⇒ [OrganizationInviteType](#organizationinvitetype) - - [get_all(options)](#organizationinvite.get_all) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) - - [get_all_by_organization(handle_or_id, options)](#organizationinvite.get_all_by_organization) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) - - [revoke(invite_id)](#organizationinvite.revoke) ⇒ None - - [.os](#deviceos) - - [download(device_type, version, options)](#deviceos.download) ⇒ None - - [get_all_os_versions(device_type, options)](#deviceos.get_all_os_versions) ⇒ None - - [get_available_os_versions(device_type)](#deviceos.get_available_os_versions) ⇒ None - - [get_config(slug_or_uuid_or_id, options)](#deviceos.get_config) ⇒ None - - [get_download_size(device_type, version)](#deviceos.get_download_size) ⇒ float - - [get_max_satisfying_version(device_type, version_or_range, os_type)](#deviceos.get_max_satisfying_version) ⇒ Optional[str] - - [get_supported_os_update_versions(device_type, current_version)](#deviceos.get_supported_os_update_versions) ⇒ None - - [is_architecture_compatible_with(os_architecture, application_architecture)](#deviceos.is_architecture_compatible_with) ⇒ None - - [is_supported_os_update(device_type, current_version, target_version)](#deviceos.is_supported_os_update) ⇒ bool - - [.config](#config) - - [get_all()](#config.get_all) ⇒ ConfigType - - [.release](#release) - - [create_from_url(slug_or_uuid_or_id, url, flatten_tarball)](#release.create_from_url) ⇒ int - - [finalize(commit_or_id_or_raw_version)](#release.finalize) ⇒ None - - [get(commit_or_id_or_raw_version, options)](#release.get) ⇒ [ReleaseType](#releasetype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#release.get_all_by_application) ⇒ [List[ReleaseType]](#releasetype) - - [get_latest_by_application(slug_or_uuid_or_id, options)](#release.get_latest_by_application) ⇒ [Optional[ReleaseType]](#releasetype) - - [get_with_image_details(commit_or_id_or_raw_version, image_options, release_options)](#release.get_with_image_details) ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) - - [set_is_invalidated(commit_or_id_or_raw_version, is_invalidated)](#release.set_is_invalidated) ⇒ None - - [set_known_issue_list(commit_or_id_or_raw_version, known_issue_list)](#release.set_known_issue_list) ⇒ None - - [set_note(commit_or_id_or_raw_version, note)](#release.set_note) ⇒ None - - [set_release_version(commit_or_id, semver)](#release.set_release_version) ⇒ None - - [.tags](#releasetag) - - [get(commit_or_id_or_raw_version, tag_key)](#releasetag.get) ⇒ Optional[str] - - [get_all(options)](#releasetag.get_all) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#releasetag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_release(commit_or_id_or_raw_version, options)](#releasetag.get_all_by_release) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(commit_or_id_or_raw_version, tag_key)](#releasetag.remove) ⇒ None - - [set(commit_or_id_or_raw_version, tag_key, value)](#releasetag.set) ⇒ None - - [.service](#service) - - [get_all_by_application(slug_or_uuid_or_id, options)](#service.get_all_by_application) ⇒ [List[ServiceType]](#servicetype) - - [.var](#serviceenvvariable) - - [get(service_id_or_natural_key, key)](#serviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#serviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_service(service_id_or_natural_key, options)](#serviceenvvariable.get_all_by_service) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(service_id_or_natural_key, key)](#serviceenvvariable.remove) ⇒ None - - [set(service_id_or_natural_key, key, value)](#serviceenvvariable.set) ⇒ None - - [.image](#image) - - [get(id, options)](#image.get) ⇒ [ImageType](#imagetype) - - [get_logs(id)](#image.get_logs) ⇒ str - - [.auth](#auth) - - [authenticate()](#auth.authenticate) ⇒ str - - [get_actor_id()](#auth.get_actor_id) ⇒ int - - [get_token()](#auth.get_token) ⇒ Optional[str] - - [get_user_info()](#auth.get_user_info) ⇒ UserInfo - - [is_logged_in()](#auth.is_logged_in) ⇒ bool - - [login()](#auth.login) ⇒ None - - [login_with_token(token)](#auth.login_with_token) ⇒ None - - [logout()](#auth.logout) ⇒ None - - [register()](#auth.register) ⇒ str - - [whoami()](#auth.whoami) ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] - - [.two_factor](#twofactorauth) - - [challenge(code)](#twofactorauth.challenge) ⇒ None - - [disable(password)](#twofactorauth.disable) ⇒ str - - [enable(code)](#twofactorauth.enable) ⇒ str - - [get_setup_key()](#twofactorauth.get_setup_key) ⇒ str - - [is_enabled()](#twofactorauth.is_enabled) ⇒ bool - - [is_passed()](#twofactorauth.is_passed) ⇒ bool - - [verify(code)](#twofactorauth.verify) ⇒ str - - [.logs](#logs) - - [history(uuid_or_id, count)](#logs.history) ⇒ List[Log] - - [stop()](#logs.stop) ⇒ None - - [subscribe(uuid_or_id, callback, error, count)](#logs.subscribe) ⇒ None - - [unsubscribe(uuid_or_id)](#logs.unsubscribe) ⇒ None - - [unsubscribe_all()](#logs.unsubscribe_all) ⇒ None - - [.settings](#module) - - [.types](#types) - -## Models +# Models This module implements all models for balena python SDK. -## Application +# Application This class implements application model for balena python SDK. - - -### Function: create(name, device_type, organization, application_class) ⇒ [TypeApplication](#typeapplication) +## create Create an application. -#### Args: +**Signature:** `balena.models.application.create(name, device_type, organization, application_class)` ⇒ [TypeApplication](#typeapplication) + +**Args:** name (str): application name. device_type (str): device type (slug). organization (Union[str, int]): handle or id of the organization that the application will belong to. application_class (Optional[Literal["app", "fleet", "block"]]): application class. -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.create('foo', 'raspberry-pi', 12345) >>> balena.models.application.create('foo', 'raspberry-pi', 12345, 'block') ``` - -### Function: disable_device_urls(slug_or_uuid_or_id) ⇒ None +## disable_device_urls Disable device urls for all devices that belong to an application. -#### Args: +**Signature:** `balena.models.application.disable_device_urls(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.disable_device_urls(5685) ``` - -### Function: enable_device_urls(slug_or_uuid_or_id) ⇒ None +## enable_device_urls Enable device urls for all devices that belong to an application -#### Args: +**Signature:** `balena.models.application.enable_device_urls(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.enable_device_urls(5685) ``` - -### Function: generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date) ⇒ str +## generate_provisioning_key Generate a device provisioning key for a specific application. -#### Args: +**Signature:** `balena.models.application.generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date)` ⇒ str + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) key_name (Optional[str]): provisioning key name. description (Optional[str]): description for provisioning key. expiry_date (Optional[str]): expiry date for provisioning key, for example: `2030-01-01T00:00:00Z`. -#### Returns: +**Returns:** str: device provisioning key. -#### Examples: +**Examples:** ```python >>> balena.models.application.generate_provisioning_key(5685) ``` - -### Function: get(slug_or_uuid_or_id, options, context) ⇒ [TypeApplication](#typeapplication) +## get Get a single application. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, options, context)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get("myorganization/myapp") >>> balena.models.application.get(123) ``` - -### Function: get_all(options, context) ⇒ [List[TypeApplication]](#typeapplication) +## get_all Get all applications -#### Args: +**Signature:** `balena.models.application.get_all(options, context)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all() ``` - -### Function: get_all_by_organization(org_handle_or_id, options) ⇒ [List[TypeApplication]](#typeapplication) +## get_all_by_organization Get all applications of an organization. -#### Args: +**Signature:** `balena.models.application.get_all_by_organization(org_handle_or_id, options)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** org_handle_or_id (Union[str, int]): handle or id of the organization. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all_by_organization('myorg') ``` - -### Function: get_all_directly_accessible(options) ⇒ [List[TypeApplication]](#typeapplication) +## get_all_directly_accessible Get all applications directly accessible by the user -#### Args: +**Signature:** `balena.models.application.get_all_directly_accessible(options)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[APIKeyType]: user API key -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all_directly_accessible() ``` - -### Function: get_by_name(app_name, options, context) ⇒ [TypeApplication](#typeapplication) +## get_by_name Get a single application using the appname. -#### Args: +**Signature:** `balena.models.application.get_by_name(app_name, options, context)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get("myapp") ``` - -### Function: get_by_owner(app_name, owner, options) ⇒ [TypeApplication](#typeapplication) - -Get a single application using the appname and the handle of the owning organization. - -#### Args: - app_name (str): application name. - owner (str): The handle of the owning organization. - options (AnyObject): extra pine options to use. - -#### Returns: - TypeApplication: application info. - -#### Examples: -```python ->>> balena.models.application.get_by_owner('foo', 'my_org') -``` - - -### Function: get_dashboard_url(app_id) ⇒ str +## get_dashboard_url Get Dashboard URL for a specific application. -#### Args: +**Signature:** `balena.models.application.get_dashboard_url(app_id)` ⇒ str + +**Args:** app_id (int): application id. -#### Returns: +**Returns:** str: Dashboard URL for the specific application. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_dashboard_url(1476418) ``` - -### Function: get_directly_accessible(slug_or_uuid_or_id, options) ⇒ [TypeApplication](#typeapplication) +## get_directly_accessible Get a single application directly accessible by the user -#### Args: +**Signature:** `balena.models.application.get_directly_accessible(slug_or_uuid_or_id, options)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_directly_accessible("myorganization/myapp") >>> balena.models.application.get_directly_accessible(123) ``` - -### Function: get_id(slug_or_uuid_or_id) ⇒ int +## get_id Given an application slug or uuid or id, returns it numeric id. -#### Args: +**Signature:** `balena.models.application.get_id(slug_or_uuid_or_id)` ⇒ int + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** int: The id. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_dashboard_url(1476418) ``` - -### Function: get_target_release_hash(slug_or_uuid_or_id) ⇒ Optional[str] +## get_target_release_hash Get the hash of the current release for a specific application. -#### Args: +**Signature:** `balena.models.application.get_target_release_hash(slug_or_uuid_or_id)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** Optional[str]: The release hash of the current release or None. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_target_release_hash(5685) ``` - -### Function: get_with_device_service_details(slug_or_uuid_or_id, options) ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) +## get_with_device_service_details This method does not map exactly to the underlying model: it runs a larger prebuilt query, and reformats it into an easy to use and understand format. If you want more control, or to see the raw model directly, use `application.get(uuidOrId, options)` instead. -#### Args: +**Signature:** `balena.models.application.get_with_device_service_details(slug_or_uuid_or_id, options)` ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_with_device_service_details('my_org_handle/my_app_name') ``` - -### Function: grant_support_access(slug_or_uuid_or_id, expiry_timestamp) ⇒ None +## grant_support_access Grant support access to an application until a specified time. -#### Args: +**Signature:** `balena.models.application.grant_support_access(slug_or_uuid_or_id, expiry_timestamp)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Examples: +**Examples:** ```python >>> balena.models.application.grant_support_access(5685, 1511974999000) ``` - -### Function: has(slug_or_uuid_or_id) ⇒ bool +## has Check if an application exists. -#### Args: +**Signature:** `balena.models.application.has(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** bool: True if application exists, False otherwise. -#### Examples: +**Examples:** ```python >>> balena.models.application.has('my_org/foo') ``` - -### Function: has_any() ⇒ bool +## has_any Check if the user has any applications. -#### Returns: +**Signature:** `balena.models.application.has_any()` ⇒ bool + +**Returns:** bool: True if user has any applications, False otherwise. -#### Examples: +**Examples:** ```python >>> balena.models.application.has_any() ``` - -### Function: is_tracking_latest_release(slug_or_uuid_or_id) ⇒ bool +## is_tracking_latest_release Get whether the application is up to date and is tracking the latest finalized release for updates -#### Args: +**Signature:** `balena.models.application.is_tracking_latest_release(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Returns: +**Returns:** bool: is tracking the latest release. -#### Examples: +**Examples:** ```python >>> balena.models.application.is_tracking_latest_release(5685) ``` - -### Function: pin_to_release(slug_or_uuid_or_id, full_release_hash) ⇒ None +## pin_to_release Configures the application to run a particular release and not get updated when the latest release changes. -#### Args: +**Signature:** `balena.models.application.pin_to_release(slug_or_uuid_or_id, full_release_hash)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). full_release_hash (str) : the hash of a successful release (string) -#### Examples: +**Examples:** ```python >>> balena.models.application.set_to_release(5685, '7dba4e0c461215374edad74a5b78f470b894b5b7') ``` - -### Function: purge(app_id) ⇒ None +## purge Purge devices by application id -#### Args: +**Signature:** `balena.models.application.purge(app_id)` ⇒ None + +**Args:** app_id (int): application id (number) -#### Examples: +**Examples:** ```python >>> balena.models.application.purge(5685) ``` - -### Function: reboot(app_id, options) ⇒ None +## reboot Reboots devices by application id -#### Args: +**Signature:** `balena.models.application.reboot(app_id, options)` ⇒ None + +**Args:** app_id (int): application id (number) options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python >>> balena.models.application.reboot(5685) >>> balena.models.application.reboot(5685, {"force": True}) ``` - -### Function: remove(slug_or_uuid_or_id) ⇒ None +## remove Remove application. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.remove('my_org/my_app') >>> balena.models.application.remove('c184556293854781aea71b0bdae10e45') >>> balena.models.application.remove(123) ``` - -### Function: rename(slug_or_uuid_or_id, new_name) ⇒ None +## rename Rename application. -#### Args: +**Signature:** `balena.models.application.rename(slug_or_uuid_or_id, new_name)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). new_name (str): new application name. -#### Examples: +**Examples:** ```python >>> balena.models.application.rename(1681618, 'py-test-app') ``` - -### Function: restart(slug_or_uuid_or_id) ⇒ None +## restart Restart application. -#### Args: +**Signature:** `balena.models.application.restart(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.restart('myorg/RPI1') ``` - -### Function: revoke_support_access(slug_or_uuid_or_id) ⇒ None +## revoke_support_access Revoke support access to an application. -#### Args: +**Signature:** `balena.models.application.revoke_support_access(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.revoke_support_access(5685) ``` - -### Function: shutdown(app_id, options) ⇒ None +## shutdown Shutdown devices by application id -#### Args: +**Signature:** `balena.models.application.shutdown(app_id, options)` ⇒ None + +**Args:** app_id (int): application id (number) options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python >>> balena.models.application.shutdown(5685) >>> balena.models.application.shutdown(5685, {"force": True}) ``` - -### Function: track_latest_release(slug_or_uuid_or_id) ⇒ None +## track_latest_release Configure a specific application to track the latest available release. -#### Args: +**Signature:** `balena.models.application.track_latest_release(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Examples: +**Examples:** ```python >>> balena.models.application.track_latest_release(5685) ``` - -### Function: will_track_new_releases(slug_or_uuid_or_id) ⇒ bool +## will_track_new_releases Get whether the application is configured to receive updates whenever a new release is available. -#### Args: +**Signature:** `balena.models.application.will_track_new_releases(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Returns: +**Returns:** bool: is tracking the latest release. -#### Examples: +**Examples:** ```python >>> balena.models.application.will_track_new_releases(5685) ``` -## ApplicationTag -This class implements application tag model for balena python SDK. +# ApplicationTag - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +This class implements application tag model for balena python SDK. +## get_all_by_application Get all application tags for an application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.get_all_by_application(1005160) ``` - -### Function: remove(slug_or_uuid_or_id, tag_key) ⇒ None +## remove Remove an application tag. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, tag_key)` ⇒ None + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.remove(1005767, 'tag1') ``` - -### Function: set(slug_or_uuid_or_id, tag_key, value) ⇒ None +## set Set an application tag (update tag value if it exists). -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, tag_key, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) tag_key (str): tag key. value (str): tag value. -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.set(1005767, 'tag1', 'Python SDK') ``` -## ApplicationConfigVariable -This class implements application config variable model for balena python SDK. +# ApplicationConfigVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements application config variable model for balena python SDK. +## get Get application config variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.application.config_var.get('8deb12','test_env4') +>>> balena.models.application.config_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all application config variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application config variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.get_all_by_application(9020) ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an application config variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.remove(2184, 'test_env') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific application config variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.application.config_var.set('8deb12','test_env', 'testing1') +>>> balena.models.application.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env', 'testing1') ``` -## ApplicationEnvVariable -This class implements application environment variable model for balena python SDK. +# ApplicationEnvVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements application environment variable model for balena python SDK. +## get Get application environment variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.application.env_var.get('8deb12','test_env4') +>>> balena.models.application.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all application environment variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.get_all_by_application(9020) >>> balena.models.application.env_var.get_all_by_application("myorg/myslug") ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an application environment variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.remove(2184,'test_env4') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific application environment variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.application.env_var.set('8deb12','test_env4', 'testing1') +>>> balena.models.application.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') ``` -## BuildEnvVariable -This class implements build environment variable model for balena python SDK. +# BuildEnvVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements build environment variable model for balena python SDK. +## get Get build environment variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.application.build_var.get('8deb12','test_env4') +>>> balena.models.application.build_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all build environment variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: build environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.get_all_by_application(9020) >>> balena.models.application.build_var.get_all_by_application("myorg/myslug") ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an build environment variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.remove(2184, 'test_env4') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific build environment variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.application.build_var.set('8deb12','test_env4', 'testing1') +>>> balena.models.application.build_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') ``` -## ApplicationMembership -This class implements application membership model for balena python SDK. +# ApplicationMembership - -### Function: change_role(membership_id, role_name) ⇒ None +This class implements application membership model for balena python SDK. +## change_role Changes the role of an application member. -#### Args: +**Signature:** `balena.models.application.change_role(membership_id, role_name)` ⇒ None + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` numeric pair of the membership role_name (str): the role name to be granted to the membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.change_role(55074, 'observer') ``` - -### Function: create(slug_or_uuid_or_id, username, role_name) ⇒ [ApplicationMembershipType](#applicationmembershiptype) +## create Creates a new membership for an application. -#### Args: +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, username, role_name)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). username (str): the username of the balena user that will become a member. role_name (Optional[str]): the role name to be granted to the membership. -#### Returns: +**Returns:** ApplicationMembershipType: application membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.create(1681618, 'testuser') ``` - -### Function: get(membership_id, options) ⇒ [ApplicationMembershipType](#applicationmembershiptype) +## get Get a single application membership. -#### Args: +**Signature:** `balena.models.application.get(membership_id, options)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` numeric pair of the membership options (AnyObject): extra pine options to use -#### Returns: +**Returns:** ApplicationMembershipType: application membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get(55074) >>> balena.models.application.membership.get({"user": 123, "is_member_of__application": 125}) ``` - -### Function: get_all(options) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) +## get_all Get all application memberships. -#### Args: +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationMembershipType]: list contains info of application memberships. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) +## get_all_by_application Get all memberships by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: list contains info of application memberships. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get_all_by_application(1681618) ``` - -### Function: remove(membership_id) ⇒ None +## remove Remove a membership. -#### Args: +**Signature:** `balena.models.application.remove(membership_id)` ⇒ None + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` -## ApplicationInvite -This class implements application invite model for balena python SDK. +# ApplicationInvite - -### Function: accept(invite_token) ⇒ None +This class implements application invite model for balena python SDK. +## accept Accepts an invite. -#### Args: +**Signature:** `balena.models.application.accept(invite_token)` ⇒ None + +**Args:** invite_token (str): invitationToken - invite token. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.accept("qwerty-invitation-token") ``` - -### Function: create(slug_or_uuid_or_id, options) ⇒ [ApplicationInviteType](#applicationinvitetype) +## create Creates a new invite for an application. -#### Args: +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, options)` ⇒ [ApplicationInviteType](#applicationinvitetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (ApplicationInviteOptions): Application Invite options dict to use. invitee (str): the email/balena_username of the invitee. @@ -1174,200 +941,212 @@ Creates a new invite for an application. One of "observer", "developer", "operator". Defaults to "developer" message (Optional[str]): the message to send along with the invite. -#### Returns: +**Returns:** dict: application invite. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.create(1681618, 'invitee@example.org', 'developer', 'Test invite') ``` - -### Function: get_all(options) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) +## get_all Get all invites. -#### Args: +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) +## get_all_by_application Get all invites by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.get_all_by_application(1681618) ``` - -### Function: revoke(invite_id) ⇒ None +## revoke Revoke an invite. -#### Args: +**Signature:** `balena.models.application.revoke(invite_id)` ⇒ None + +**Args:** invite_id (int): application invite id. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.revoke(5860) ``` -## Device -This class implements device model for balena python SDK. +# Device - -### Function: deactivate(uuid_or_id_or_ids) ⇒ None +This class implements device model for balena python SDK. +## deactivate Deactivates a device. -#### Args: +**Signature:** `balena.models.device.deactivate(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.deactivate('44cc9d1861b9f992808c506276e5d31c') >>> balena.models.device.deactivate([123, 234]) ``` - -### Function: disable_device_url(uuid_or_id_or_ids) ⇒ None +## disable_device_url Disable device url for a device. -#### Args: +**Signature:** `balena.models.device.disable_device_url(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Examples: +**Examples:** ```python ->>> balena.models.device.disable_device_url('8deb12a58') +>>> balena.models.device.disable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.disable_device_url([123, 345]) ``` - -### Function: disable_local_mode(uuid_or_id) ⇒ None +## disable_local_mode Disable local mode. -#### Args: +**Signature:** `balena.models.device.disable_local_mode(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** None. -#### Examples: +**Examples:** ```python ->>> balena.models.device.disable_local_mode('b6070f4f') +>>> balena.models.device.disable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: disable_lock_override(uuid_or_id) ⇒ None +## disable_lock_override Disable lock override. -#### Args: +**Signature:** `balena.models.device.disable_lock_override(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: enable_device_url(uuid_or_id_or_ids) ⇒ None +## enable_device_url Enable device url for a device. -#### Args: +**Signature:** `balena.models.device.enable_device_url(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Examples: +**Examples:** ```python ->>> balena.models.device.enable_device_url('8deb12a58') +>>> balena.models.device.enable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.enable_device_url([123, 345]) ``` - -### Function: enable_local_mode(uuid_or_id) ⇒ None +## enable_local_mode Enable local mode. -#### Args: +**Signature:** `balena.models.device.enable_local_mode(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python ->>> balena.models.device.enable_local_mode('b6070f4f') +>>> balena.models.device.enable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: enable_lock_override(uuid_or_id) ⇒ None +## enable_lock_override Enable lock override. -#### Args: +**Signature:** `balena.models.device.enable_lock_override(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: generate_device_key(uuid_or_id, name, description, expiry_date) ⇒ str +## generate_device_key Generate a device key. -#### Args: +**Signature:** `balena.models.device.generate_device_key(uuid_or_id, name, description, expiry_date)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) name (Optional[str]): device key name. description (Optional[str]): description for device key. expiry_date (Optional[str]): expiry date for device key, for example: `2030-01-01T00:00:00Z`. -#### Examples: +**Examples:** ```python ->>> balena.models.device.generate_device_key('df0926') +>>> balena.models.device.generate_device_key('df0926d8a5cf4293a1b3742c98a500a1') ``` - -### Function: generate_uuid() ⇒ str +## generate_uuid Generate a random device UUID. -#### Returns: +**Signature:** `balena.models.device.generate_uuid()` ⇒ str + +**Returns:** str: a generated UUID. -#### Examples: +**Examples:** ```python >>> balena.models.device.generate_uuid() ``` - -### Function: get(uuid_or_id, options) ⇒ [TypeDevice](#typedevice) +## get This method returns a single device by id or uuid. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, options)` ⇒ [TypeDevice](#typedevice) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeDevice: device info. -#### Examples: +**Examples:** ```python >>> balena.models.device.get('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') ->>> balena.models.device.get('8deb12') +>>> balena.models.device.get('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.get(12345) ``` - -### Function: get_all(options) ⇒ [List[TypeDevice]](#typedevice) +## get_all This method returns all devices that the current user can access. In order to have the following computed properties in the result @@ -1376,652 +1155,720 @@ you have to explicitly define them in a `$select` in the extra options: - overall_progress - is_frozen -#### Args: +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[TypeDevice]](#typedevice) + +** Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[TypeDevice]](#typedevice) +## get_all_by_application Get devices by application slug, uuid or id. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all_by_application('my_org/RPI1') ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[TypeDevice]](#typedevice) +## get_all_by_organization Get devices by organization slug, uuid or id. -#### Args: +**Signature:** `balena.models.device.get_all_by_organization(handle_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all_by_organization('my_org') >>> balena.models.device.get_all_by_organization(123) ``` - -### Function: get_application_info(uuid_or_id) ⇒ Any +## get_application_info ***Deprecated*** Return information about the application running on the device. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.get_application_info(uuid_or_id)` ⇒ Any + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains application information. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_application_info('7f66ec') +>>> balena.models.device.get_application_info('7f66ec3c5da146c3b6a84aaed1c07581') ``` - -### Function: get_application_name(uuid_or_id) ⇒ str +## get_application_name Get application name by device uuid. -#### Args: +**Signature:** `balena.models.device.get_application_name(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: application name. - -### Function: get_by_name(name, options) ⇒ [List[TypeDevice]](#typedevice) +## get_by_name Get devices by device name. -#### Args: +**Signature:** `balena.models.device.get_by_name(name, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** name (str): device name. -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_by_name('floral-mountain') ``` - -### Function: get_dashboard_url(uuid) ⇒ None +## get_dashboard_url Get balena Dashboard URL for a specific device. -#### Args: +**Signature:** `balena.models.device.get_dashboard_url(uuid)` ⇒ None + +**Args:** uuid (str): device uuid. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_dashboard_url('19619a6317072b65a240b451f45f855d') ``` - -### Function: get_device_url(uuid_or_id) ⇒ str +## get_device_url Get a device url for a device. -#### Args: +**Signature:** `balena.models.device.get_device_url(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_device_url('8deb12a') +>>> balena.models.device.get_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: get_local_ip_address(uuid_or_id) ⇒ List[str] +## get_local_ip_address Get the local IP addresses of a device. -#### Args: +**Signature:** `balena.models.device.get_local_ip_address(uuid_or_id)` ⇒ List[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** List[str]: IP addresses of a device. - -### Function: get_local_mode_support(uuid_or_id) ⇒ LocalModeResponse +## get_local_mode_support Returns whether local mode is supported and a message describing the reason why local mode is not supported. -#### Args: +**Signature:** `balena.models.device.get_local_mode_support(uuid_or_id)` ⇒ LocalModeResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** dict: local mode support information ({'supported': True/False, 'message': '...'}). -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_local_mode_support('b6070f4') +>>> balena.models.device.get_local_mode_support('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_mac_address(uuid_or_id) ⇒ List[str] +## get_mac_address Get the MAC addresses of a device. -#### Args: +**Signature:** `balena.models.device.get_mac_address(uuid_or_id)` ⇒ List[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** List[str]: MAC addresses of a device. - -### Function: get_metrics(uuid_or_id) ⇒ [DeviceMetricsType](#devicemetricstype) +## get_metrics Gets the metrics related information for a device. -#### Args: +**Signature:** `balena.models.device.get_metrics(uuid_or_id)` ⇒ [DeviceMetricsType](#devicemetricstype) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** dict: metrics of the device. - -### Function: get_name(uuid_or_id) ⇒ str +## get_name Get device name by device uuid. -#### Args: +**Signature:** `balena.models.device.get_name(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: device name. - -### Function: get_os_update_status(uuid_or_id) ⇒ HUPStatusResponse +## get_os_update_status +***Deprecated*** Get the OS update status of a device. -#### Args: +**Signature:** `balena.models.device.get_os_update_status(uuid_or_id)` ⇒ HUPStatusResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** HUPStatusResponse: action response. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_os_update_status('b6070f4f') +>>> balena.models.device.get_os_update_status('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_status(uuid_or_id) ⇒ str +## get_status Get the status of a device. -#### Args: +**Signature:** `balena.models.device.get_status(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: status of a device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_status('8deb12') +>>> balena.models.device.get_status('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: get_supervisor_state(uuid_or_id) ⇒ SupervisorStateType +## get_supervisor_state Get the supervisor state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_state(uuid_or_id)` ⇒ SupervisorStateType + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Returns: +**Returns:** dict: supervisor state. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_supervisor_state('b6070f4fea') +>>> balena.models.device.get_supervisor_state('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_supervisor_target_state(uuid_or_id) ⇒ Any +## get_supervisor_target_state Get the supervisor target state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_target_state(uuid_or_id)` ⇒ Any + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int). -#### Returns: +**Returns:** DeviceStateType: supervisor target state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_target_state('b6070f4fea5edf808b576123157fe5ec') ``` - -### Function: get_supervisor_target_state_for_app(slug_or_uuid_or_id, release) ⇒ Any +## get_supervisor_target_state_for_app Get the supervisor target state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_target_state_for_app(slug_or_uuid_or_id, release)` ⇒ Any + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) release (Optional[Union[str, int]]): (optional) release uuid (default tracked) -#### Returns: +**Returns:** DeviceStateType: supervisor target state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_target_state_for_app('myorg/myapp') ``` - -### Function: get_with_service_details(uuid_or_id, options) ⇒ [TypeDeviceWithServices](#typedevicewithservices) +## get_with_service_details This method does not map exactly to the underlying model: it runs a larger prebuilt query, and reformats it into an easy to use and understand format. If you want more control, or to see the raw model directly, use `device.get(uuidOrId, options)` instead. -#### Args: +**Signature:** `balena.models.device.get_with_service_details(uuid_or_id, options)` ⇒ [TypeDeviceWithServices](#typedevicewithservices) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** dict: device info with associated services details. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_with_service_details('0fcd753af396247e035de53b4e43eec3') ``` - -### Function: grant_support_access(uuid_or_id_or_ids, expiry_timestamp) ⇒ None +## grant_support_access Grant support access to a device until a specified time. -#### Args: +**Signature:** `balena.models.device.grant_support_access(uuid_or_id_or_ids, expiry_timestamp)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Examples: +**Examples:** ```python ->>> balena.models.device.grant_support_access('49b2a7', 1511974999000) +>>> balena.models.device.grant_support_access('49b2a76e8a8d4a2b918c08a23b423580', 1511974999000) ``` - -### Function: has(uuid_or_id) ⇒ bool +## has Check if a device exists. -#### Args: +**Signature:** `balena.models.device.has(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if device exists, False otherwise. - -### Function: has_device_url(uuid_or_id) ⇒ bool +## has_device_url Check if a device is web accessible with device urls -#### Args: +**Signature:** `balena.models.device.has_device_url(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python ->>> balena.models.device.has_device_url('8deb12a') +>>> balena.models.device.has_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: has_lock_override(uuid_or_id) ⇒ bool +## has_lock_override Check if a device has the lock override enabled. -#### Args: +**Signature:** `balena.models.device.has_lock_override(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: lock override status. - -### Function: identify(uuid_or_id) ⇒ None +## identify Identify device. -#### Args: +**Signature:** `balena.models.device.identify(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.identify('8deb12a5') +>>> balena.models.device.identify('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: is_in_local_mode(uuid_or_id) ⇒ bool +## is_in_local_mode Check if local mode is enabled on the device. -#### Args: +**Signature:** `balena.models.device.is_in_local_mode(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if local mode enabled, otherwise False. -#### Examples: +**Examples:** ```python ->>> balena.models.device.is_in_local_mode('b6070f4f') +>>> balena.models.device.is_in_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: is_online(uuid_or_id) ⇒ bool +## is_online Check if a device is online. -#### Args: +**Signature:** `balena.models.device.is_online(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if the device is online, False otherwise. - -### Function: is_tracking_application_release(uuid_or_id) ⇒ bool +## is_tracking_application_release Get whether the device is configured to track the current application release. -#### Args: +**Signature:** `balena.models.device.is_tracking_application_release(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: is tracking the current application release. - -### Function: move(uuid_or_id, app_slug_or_uuid_or_id) ⇒ None +## move Move a device to another application. -#### Args: +**Signature:** `balena.models.device.move(uuid_or_id, app_slug_or_uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int). app_slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.device.move(123, 'RPI1Test') ``` - -### Function: pin_to_release(uuid_or_id, full_release_hash_or_id) ⇒ None +## pin_to_os_release + +Mark a specific device to be updated to a particular OS release + +**Signature:** `balena.models.device.pin_to_os_release(uuid_or_id, target_os_version)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int). + target_os_version (str): semver-compatible version for the target device. + Unsupported (unpublished) version will result in rejection. + The version **must** be the exact version number, a "prod" variant + and greater or equal to the one running on the device. + +**Examples:** +```python +>>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') +>>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') +``` + +## pin_to_release Configures the device to run a particular release and not get updated when the current application release changes. -#### Args: +**Signature:** `balena.models.device.pin_to_release(uuid_or_id, full_release_hash_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) full_release_hash_or_id (Union[str, int]) : the hash of a successful release (string) or id (number) -#### Examples: +**Examples:** ```python ->>> balena.models.device.set_to_release('49b2a', '45c90004de73557ded7274d4896a6db90ea61e36') +>>> balena.models.device.pin_to_release('49b2a', '45c90004de73557ded7274d4896a6db90ea61e36') ``` - -### Function: ping(uuid_or_id) ⇒ None +## pin_to_supervisor_release + +Set a specific device to run a particular supervisor release. +**Signature:** `balena.models.device.pin_to_supervisor_release(uuid_or_id, supervisor_version_or_id)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + supervisor_version_or_id (Union[str, int]): the version of a released supervisor (string) or id (number) +**Examples:** +```python +>>> balena.models.device.pin_to_supervisor_release('f55dcdd9ada04b11b4d05c1f1c3b4e72', 'v13.0.0') +``` + +## ping Ping a device. This is useful to signal that the supervisor is alive and responding. -#### Args: +**Signature:** `balena.models.device.ping(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.ping('8f66ec7') +>>> balena.models.device.ping('8f66ec7335dd4a97b7661faa131b1502') >>> balena.models.device.ping(1234) ``` - -### Function: purge(uuid_or_id) ⇒ None +## purge Purge device. This function clears the user application's `/data` directory. -#### Args: +**Signature:** `balena.models.device.purge(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.purge('8f66ec7') +>>> balena.models.device.purge('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: reboot(uuid_or_id, force) ⇒ None +## reboot Reboot the device. -#### Args: +**Signature:** `balena.models.device.reboot(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python ->>> balena.models.device.reboot('8f66ec7') +>>> balena.models.device.reboot('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: register(application_slug_or_uuid_or_id, uuid, device_type_slug) ⇒ RegisterResponse +## register Register a new device with a balena application. -#### Args: +**Signature:** `balena.models.device.register(application_slug_or_uuid_or_id, uuid, device_type_slug)` ⇒ RegisterResponse + +**Args:** application_slug_or_uuid_or_id (Union[int, str]): application slug (string), uuid (string) or id (number). uuid (str): device uuid. device_type_slug (Optional[str]): device type slug or alias. -#### Returns: +**Returns:** dict: dictionary contains device info. -#### Examples: +**Examples:** ```python >>> device_uuid = balena.models.device.generate_uuid() >>> balena.models.device.register('RPI1',device_uuid) ``` - -### Function: remove(uuid_or_id_or_ids) ⇒ None +## remove Remove device(s). -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) - -### Function: rename(uuid_or_id, new_name) ⇒ None +## rename Renames a device. -#### Args: +**Signature:** `balena.models.device.rename(uuid_or_id, new_name)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int) new_name (str): device new name. -#### Examples: +**Examples:** ```python >>> balena.models.device.rename(123, 'python-sdk-test-device') ``` - -### Function: restart_application(uuid_or_id) ⇒ None +## restart_application This function restarts the Docker container running the application on the device, but doesn't reboot the device itself. -#### Args: +**Signature:** `balena.models.device.restart_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.restart_application('8deb12a58') +>>> balena.models.device.restart_application('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.restart_application(1234) ``` - -### Function: restart_service(uuid_or_id, image_id) ⇒ None +## restart_service Restart a service on device. -#### Args: +**Signature:** `balena.models.device.restart_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to restart -#### Examples: +**Examples:** ```python ->>> balena.models.device.restart_service('f3887b', 392229) +>>> balena.models.device.restart_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) >>> balena.models.device.restart_service(None, 392229) # if running on the device ``` - -### Function: revoke_support_access(uuid_or_id_or_ids) ⇒ None +## revoke_support_access Revoke support access to a device. -#### Args: +**Signature:** `balena.models.device.revoke_support_access(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python ->>> balena.models.device.revoke_support_access('49b2a7') +>>> balena.models.device.revoke_support_access('49b2a76e8a8d4a2b918c08a23b423580') ``` - -### Function: set_custom_location(uuid_or_id_or_ids, location) ⇒ None +## set_custom_location Set a custom location for a device. -#### Args: +**Signature:** `balena.models.device.set_custom_location(uuid_or_id_or_ids, location)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) location (dict): device custom location { 'latitude': Union[int,, str], 'longitude': Union[int, str]}. -#### Examples: +**Examples:** ```python >>> balena.models.device.set_custom_location(123, {'latitude': '21.032777','longitude': '105.831586'}) ``` - -### Function: set_note(uuid_or_id_or_ids, note) ⇒ None +## set_note Note a device. -#### Args: +**Signature:** `balena.models.device.set_note(uuid_or_id_or_ids, note)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) note (str): device note. -#### Examples: +**Examples:** ```python >>> balena.models.device.note(123, 'test note') ``` - -### Function: set_supervisor_release(uuid_or_id, supervisor_version_or_id) ⇒ None - -Set a specific device to run a particular supervisor release. - -#### Args: - uuid_or_id (Union[str, int]): device uuid (string) or id (int) - supervisor_version_or_id (Union[str, int]): the version of a released supervisor (string) or id (number) - -#### Examples: -```python ->>> balena.models.device.set_supervisor_release('f55dcdd9ad', 'v13.0.0') -``` - - -### Function: shutdown(uuid_or_id, force) ⇒ None +## shutdown Shutdown the device. -#### Args: +**Signature:** `balena.models.device.shutdown(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python ->>> balena.models.device.shutdown('8f66ec7') +>>> balena.models.device.shutdown('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: start_application(uuid_or_id) ⇒ None +## start_application ***Deprecated*** Starts a user application container, usually after it has been stopped with `stop_application()`. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.start_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains started application container id. -#### Examples: +**Examples:** ```python ->>> balena.models.device.start_application('8f66ec7') +>>> balena.models.device.start_application('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: start_os_update(uuid_or_id, target_os_version) ⇒ HUPStatusResponse +## start_os_update Start an OS update on a device. -#### Args: +If using run_detached option, monitor progress with device.get() -- +status, provisioning_state and provisioning_progress entries. + +**Signature:** `balena.models.device.start_os_update(uuid_or_id, target_os_version)` ⇒ HUPStatusResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). target_os_version (str): semver-compatible version for the target device. Unsupported (unpublished) version will result in rejection. The version **must** be the exact version number, a "prod" variant and greater than the one running on the device. + run_detached (Optional[bool]): run the update in detached mode. + Default behaviour is run_detached=True for more reliable updates. -#### Returns: +**Returns:** HUPStatusResponse: action response. -#### Examples: +**Examples:** ```python ->>> balena.models.device.start_os_update('b6070f4', '2.29.2+rev1.prod') ->>> balena.models.device.start_os_update('b6070f4', '2.89.0+rev1') +>>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') +>>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') ``` - -### Function: start_service(uuid_or_id, image_id) ⇒ None +## start_service Start a service on device. -#### Args: +**Signature:** `balena.models.device.start_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to start -#### Examples: +**Examples:** ```python ->>> balena.models.device.start_service('f3887b1', 1234) +>>> balena.models.device.start_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 1234) >>> balena.models.device.start_service(None, 1234) # if running on the device ``` - -### Function: stop_application(uuid_or_id) ⇒ None +## stop_application ***Deprecated*** Temporarily stops a user application container. @@ -2029,438 +1876,466 @@ Application container will not be removed after invoking this function and a reboot or supervisor restart will cause the container to start again. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.stop_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains stopped application container id. -#### Examples: +**Examples:** ```python ->>> balena.models.device.stop_application('8f66ec') +>>> balena.models.device.stop_application('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: stop_service(uuid_or_id, image_id) ⇒ None +## stop_service Stop a service on device. -#### Args: +**Signature:** `balena.models.device.stop_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to stop -#### Examples: +**Examples:** ```python ->>> balena.models.device.stop_service('f3887b1', 392229) +>>> balena.models.device.stop_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) >>> balena.models.device.stop_service(None, 392229) # if running on the device ``` - -### Function: track_application_release(uuid_or_id_or_ids) ⇒ None +## track_application_release Configure a specific device to track the current application release. -#### Args: +**Signature:** `balena.models.device.track_application_release(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) - -### Function: unset_custom_location(uuid_or_id_or_ids) ⇒ None +## unset_custom_location Clear the custom location of a device. -#### Args: +**Signature:** `balena.models.device.unset_custom_location(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.unset_custom_location(123) ``` - -### Function: update(uuid_or_id, force) ⇒ None +## update update the device. -#### Args: +**Signature:** `balena.models.device.update(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python ->>> balena.models.device.update('8f66ec7') +>>> balena.models.device.update('8f66ec7335dd4a97b7661faa131b1502') ``` -## DeviceTag -This class implements device tag model for balena python SDK. +# DeviceTag - -### Function: get(uuid_or_id, tag_key) ⇒ Optional[str] +This class implements device tag model for balena python SDK. +## get Get a device tag (update tag value if it exists). ___Note___: Notice that when using the device ID rather than UUID, it will avoid one extra API roundtrip. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, tag_key)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. -#### Returns: +**Returns:** Optional[str]: tag value -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get('f5213eac0d63ac4', 'testtag') ``` - -### Function: get_all(options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all Get all device tags. -#### Args: +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_application Get all device tags for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all_by_application(1005160) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_device Get all device tags for a device. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python ->>> balena.models.device.tags.get_all_by_device('a03ab646c') +>>> balena.models.device.tags.get_all_by_device('a03ab646ca5a4f11b4d05c1f1c3b4e72') ``` - -### Function: remove(uuid_or_id, tag_key) ⇒ None +## remove Remove a device tag. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, tag_key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.remove('f5213eac0d63ac477', 'testtag') ``` - -### Function: set(uuid_or_id, tag_key, value) ⇒ None +## set Set a device tag (update tag value if it exists). ___Note___: Notice that when using the device ID rather than UUID, it will avoid one extra API roundtrip. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, tag_key, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test1') >>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test2') ``` -## DeviceConfigVariable -This class implements device config variable model for balena python SDK. +# DeviceConfigVariable - -### Function: get(uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements device config variable model for balena python SDK. +## get Get a device config variable. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.device.config_var.device.get('8deb12','test_env4') +>>> balena.models.device.config_var.device.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device config variables for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: list of device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.get_all_by_application(5780) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device config variables belong to a device. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device config variables. -#### Examples: +**Examples:** ```python ->>> balena.models.device.config_var.get_all_by_device('f5213ea') +>>> balena.models.device.config_var.get_all_by_device('f5213eac574a4fba8b9e32ab3a9cba12') ``` - -### Function: remove(uuid_or_id, key) ⇒ None +## remove Remove a device environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.remove(2184, 'test_env4') ``` - -### Function: set(uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a device config variable. +Note that config variables must start with BALENA_ and RESIN_ prefixes. +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None -#### Args: +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.device.config_var.device.set('8deb12','test_env4', 'testing1') +>>> balena.models.device.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','BALENA_test_env4', 'testing1') ``` -## DeviceEnvVariable -This class implements device environment variable model for balena python SDK. +# DeviceEnvVariable - -### Function: get(uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements device environment variable model for balena python SDK. +## get Get device environment variable. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.device.env_var.get('8deb12', 'test_env4') +>>> balena.models.device.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device environment variables for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: list of device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.get_all_by_application(5780) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device environment variables. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device environment variables. -#### Examples: +**Examples:** ```python ->>> balena.models.device.env_var.get_all_by_device('8deb12a') +>>> balena.models.device.env_var.get_all_by_device('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: remove(uuid_or_id, key) ⇒ None +## remove Remove a device environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.remove(2184, 'test_env4') ``` - -### Function: set(uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific environment variable. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.device.env_var.set('8deb12', 'test_env4', 'testing1') +>>> balena.models.device.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4', 'testing1') ``` -## DeviceServiceEnvVariable -This class implements device service variable model for balena python SDK. +# DeviceServiceEnvVariable - -### Function: get(uuid_or_id, service_name_or_id, key) ⇒ Optional[str] +This class implements device service variable model for balena python SDK. +## get Get the overriden value of a service variable on a device -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, service_name_or_id, key)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name -#### Returns: +**Returns:** Optional[str]: device service environment variables. -#### Examples: +**Examples:** ```python ->>> balena.models.device.service_var.get('8deb12a', 'myservice', 'VAR') ->>> balena.models.device.service_var.get('8deb12a', 1234', 'VAR') +>>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'myservice', 'VAR') +>>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 1234', 'VAR') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device service environment variables belong to an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get_all_by_application(1043050) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device environment variables. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get_all_by_device(8deb12a) ``` - -### Function: remove(uuid_or_id, service_name_or_id, key) ⇒ None +## remove Remove a device service environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, service_name_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name -#### Examples: +**Examples:** ```python ->>> balena.models.device.service_var.set('7cf02a6', 'myservice', 'VAR') ->>> balena.models.device.service_var.remove('7cf02a6', 28970, 'VAR') +>>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR') +>>> balena.models.device.service_var.remove('7cf02a6a016a4b3c9e3b7a8d5f46e127', 28970, 'VAR') ``` - -### Function: set(uuid_or_id, service_name_or_id, key, value) ⇒ None +## set Set the overriden value of a service variable on a device. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, service_name_or_id, key, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name value (str): variable value -#### Examples: +**Examples:** ```python ->>> balena.models.device.service_var.set('7cf02a6', 'myservice', 'VAR', 'override') ->>> balena.models.device.service_var.set('7cf02a6', 123, 'VAR', 'override') +>>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR', 'override') +>>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 123, 'VAR', 'override') ``` -## DeviceHistory -This class implements device history model for balena python SDK. +# DeviceHistory - -### Function: get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options) ⇒ [List[DeviceHistoryType]](#devicehistorytype) +This class implements device history model for balena python SDK. +## get_all_by_application Get all device history entries for an application. -#### Args: +**Signature:** `balena.models.history.get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago to_date (datetime): history entries younger or equal to this date. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[DeviceHistoryType]: device history entries. -#### Examples: +**Examples:** ```python >>> balena.models.device.history.get_all_by_application('myorg/myapp') >>> balena.models.device.history.get_all_by_application(11196426) @@ -2474,21 +2349,22 @@ Get all device history entries for an application. ... ) ``` - -### Function: get_all_by_device(uuid_or_id, from_date, to_date, options) ⇒ [List[DeviceHistoryType]](#devicehistorytype) +## get_all_by_device Get all device history entries for a device. -#### Args: +**Signature:** `balena.models.history.get_all_by_device(uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** uuid_or_id (str): device uuid (32 / 62 digits string) or id (number) __note__: No short IDs supported from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago to_date (datetime): history entries younger or equal to this date. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[DeviceHistoryType]: device history entries. -#### Examples: +**Examples:** ```python >>> balena.models.device.history.get_all_by_device('6046335305c8142883a4466d30abe211') >>> balena.models.device.history.get_all_by_device(11196426) @@ -2501,538 +2377,574 @@ Get all device history entries for a device. ... to_date=from_date = datetime.utcnow() + timedelta(days=-5)) ... ) ``` -## DeviceType -This class implements user API key model for balena python SDK. +# DeviceType - -### Function: get(id_or_slug, options) ⇒ [DeviceTypeType](#devicetypetype) +This class implements user API key model for balena python SDK. +## get Get a single device type. -#### Args: +**Signature:** `balena.models.device_type.get(id_or_slug, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** id_or_slug (Union[str, int]): device type slug or alias (string) or id (int). options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** DeviceTypeType: Returns the device type - -### Function: get_all(options) ⇒ [List[DeviceTypeType]](#devicetypetype) +## get_all Get all device types. -#### Args: +**Signature:** `balena.models.device_type.get_all(options)` ⇒ [List[DeviceTypeType]](#devicetypetype) + +**Args:** options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[DeviceTypeType]: list contains info of device types. - -### Function: get_all_supported(options) ⇒ None +## get_all_supported Get all supported device types. -#### Args: +**Signature:** `balena.models.device_type.get_all_supported(options)` ⇒ None + +**Args:** options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[DeviceTypeType]: list contains info of all supported device types. - -### Function: get_by_slug_or_name(slug_or_name, options) ⇒ [DeviceTypeType](#devicetypetype) +## get_by_slug_or_name Get a single device type by slug or name. -#### Args: +**Signature:** `balena.models.device_type.get_by_slug_or_name(slug_or_name, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** slug_or_name (str): device type slug or name. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** DeviceTypeType: Returns the device type - -### Function: get_name(slug) ⇒ str +## get_name Get display name for a device. -#### Args: +**Signature:** `balena.models.device_type.get_name(slug)` ⇒ str + +**Args:** slug (str): device type slug. - -### Function: get_slug_by_name(name) ⇒ str +## get_slug_by_name Get device slug. -#### Args: +**Signature:** `balena.models.device_type.get_slug_by_name(name)` ⇒ str + +**Args:** name (str): device type name. -## ApiKey -This class implements user API key model for balena python SDK. +# ApiKey - -### Function: create(name, description, expiry_date) ⇒ str +This class implements user API key model for balena python SDK. +## create This method registers a new api key for the current user with the name given. -#### Args: +**Signature:** `balena.models.api_key.create(name, description, expiry_date)` ⇒ str + +**Args:** name (str): the API key name description (Optional[str]): the API key description expiry_date (Optional[str]): the API key expiring date -#### Returns: +**Returns:** str: API key -#### Examples: +**Examples:** ```python >>> balena.models.api_key.create_api_key("myApiKey") >>> balena.models.api_key.create_api_key("myApiKey", "my api key description") >>> balena.models.api_key.create_api_key("myApiKey", "my descr", datetime.datetime.utcnow().isoformat()) ``` - -### Function: get_all(options) ⇒ [List[APIKeyType]](#apikeytype) +## get_all This function gets all API keys. -#### Args: +**Signature:** `balena.models.api_key.get_all(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[APIKeyType]: user API key -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_all() ``` - -### Function: get_all_named_user_api_keys(options) ⇒ [List[APIKeyType]](#apikeytype) +## get_all_named_user_api_keys Get all named user API keys of the current user. -#### Args: +**Signature:** `balena.models.api_key.get_all_named_user_api_keys(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_all_named_user_api_keys() ``` - -### Function: get_device_api_keys_by_device(uuid_or_id, options) ⇒ [List[APIKeyType]](#apikeytype) +## get_device_api_keys_by_device Get all API keys for a device. -#### Args: +**Signature:** `balena.models.api_key.get_device_api_keys_by_device(uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** device_uuid (Union[str, int]): device, uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_device_api_keys_by_device("44cc9d186") >>> balena.models.api_key.get_device_api_keys_by_device(1111386) ``` - -### Function: get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options) ⇒ [List[APIKeyType]](#apikeytype) +## get_provisioning_api_keys_by_application Get all provisioning API keys for an application. -#### Args: +**Signature:** `balena.models.api_key.get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_provisioning_api_keys_by_application(1296047) >>> balena.models.api_key.get_provisioning_api_keys_by_application("myorg/myapp") ``` - -### Function: revoke(id) ⇒ None +## revoke This function revokes an API key. -#### Args: +**Signature:** `balena.models.api_key.revoke(id)` ⇒ None + +**Args:** id (int): API key id. -#### Examples: +**Examples:** ```python >>> balena.models.api_key.revoke(1296047) ``` - -### Function: update(id, api_key_info) ⇒ None +## update This function updates details of an API key. -#### Args: +**Signature:** `balena.models.api_key.update(id, api_key_info)` ⇒ None + +**Args:** id (str): API key id. api_key_info (APIKeyInfoType): new API key info. -#### Examples: +**Examples:** ```python >>> balena.models.api_key.update(1296047, {"name":"new name"}) ``` -## Key -This class implements ssh key model for balena python SDK. +# Key - -### Function: create(title, key) ⇒ [SSHKeyType](#sshkeytype) +This class implements ssh key model for balena python SDK. +## create Create a ssh key. -#### Args: +**Signature:** `balena.models.key.create(title, key)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** title (str): key title. key (str): the public ssh key. -#### Returns: +**Returns:** SSHKeyType: new ssh key id. - -### Function: get(id) ⇒ [SSHKeyType](#sshkeytype) +## get Get a single ssh key. -#### Args: +**Signature:** `balena.models.key.get(id)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** id (int): key id. -#### Returns: +**Returns:** SSHKeyType: ssh key info. - -### Function: get_all(options) ⇒ [List[SSHKeyType]](#sshkeytype) +## get_all Get all ssh keys. -#### Args: +**Signature:** `balena.models.key.get_all(options)` ⇒ [List[SSHKeyType]](#sshkeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[SSHKeyType]: list of ssh keys. - -### Function: remove(id) ⇒ None +## remove Remove a ssh key. -#### Args: +**Signature:** `balena.models.key.remove(id)` ⇒ None + +**Args:** id (int): key id. -## Organization -This class implements organization model for balena python SDK. +# Organization - -### Function: create(name, handle, logo_image) ⇒ [OrganizationType](#organizationtype) +This class implements organization model for balena python SDK. +## create Creates a new organization. -#### Args: +**Signature:** `balena.models.organization.create(name, handle, logo_image)` ⇒ [OrganizationType](#organizationtype) + +**Args:** name (str): the name of the organization that will be created. handle (Optional[str]): The handle of the organization that will be created. logo_image (Optional[io.BufferedReader]): The organization logo to be used. -#### Returns: +**Returns:** dict: organization info. -#### Examples: +**Examples:** ```python >>> balena.models.organization.create('My Org', 'test_org') >>> with open('mypath/myfile.png', 'rb') as f: >>> org = sdk.models.organization.create("my-name", None, f) ``` - -### Function: get(handle_or_id, options) ⇒ [OrganizationType](#organizationtype) +## get Get a single organization. -#### Args: +**Signature:** `balena.models.organization.get(handle_or_id, options)` ⇒ [OrganizationType](#organizationtype) + +**Args:** handle_or_id (str): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** dict: organization info. -#### Raises: +**Raises:** OrganizationNotFound: if organization couldn't be found. -#### Examples: +**Examples:** ```python >>> balena.models.organization.get(26474) >>> balena.models.organization.get('myorg') ``` - -### Function: get_all(options) ⇒ [List[OrganizationType]](#organizationtype) +## get_all Get all organizations. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationType]](#organizationtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationType]: list contains information of organizations. -#### Examples: +**Examples:** ```python >>> balena.models.organization.get_all() ``` - -### Function: remove(handle_or_id) ⇒ None +## remove Remove an organization. -#### Args: +**Signature:** `balena.models.organization.remove(handle_or_id)` ⇒ None + +**Args:** handle_or_id (str): organization handle (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.organization.remove(148003) ``` -## OrganizationMembership -This class implements organization membership model for balena python SDK. +# OrganizationMembership - -### Function: get(membership_id, options) ⇒ [OrganizationMembershipType](#organizationmembershiptype) +This class implements organization membership model for balena python SDK. +## get Get a single organization membership. -#### Args: +**Signature:** `balena.models.organization.get(membership_id, options)` ⇒ [OrganizationMembershipType](#organizationmembershiptype) + +**Args:** membership_id (ResourceKey): the id (int) or an object with the unique `user` & `is_member_of__organization` numeric pair of the membership options (AnyObject): extra pine options to use -#### Returns: +**Returns:** Organization membership. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.get(17608) ``` - -### Function: get_all(options) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) +## get_all Get all organization memberships. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipType]: organization memberships. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) +## get_all_by_organization Get all memberships by organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipType]: organization memberships. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.get_all_by_organization(3014) ``` -## OrganizationMembershipTag -This class implements organization membership tag model for balena python SDK. +# OrganizationMembershipTag - -### Function: get(membership_id, tag_key) ⇒ Optional[str] +This class implements organization membership tag model for balena python SDK. +## get Get an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.get(membership_id, tag_key)` ⇒ Optional[str] + +**Args:** membership_id: organization membership id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get(17608, 'mTag1') ``` - -### Function: get_all(options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all Get all organization membership tags. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all_by_organization Get all organization membership tags for an organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipTagType]: organization membership tags. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all_by_organization(3014) ``` - -### Function: get_all_by_organization_membership(membership_id, options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all_by_organization_membership Get all organization membership tags for a memberships of an organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization_membership(membership_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** membership_id (int): organization membership id. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: organization membership tags. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all_by_organization_membership(17608) ``` - -### Function: remove(membership_id, tag_key) ⇒ None +## remove Remove an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.remove(membership_id, tag_key)` ⇒ None + +**Args:** membership_id: organization membership id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.remove(17608, 'mTag1') ``` - -### Function: set(membership_id, tag_key, value) ⇒ None +## set Set an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.set(membership_id, tag_key, value)` ⇒ None + +**Args:** membership_id: organization membership id. tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.set(17608, 'mTag1', 'Python SDK') ``` -## OrganizationInvite -This class implements organization invite model for balena python SDK. +# OrganizationInvite - -### Function: accept(invite_token) ⇒ None +This class implements organization invite model for balena python SDK. +## accept Accepts an invite. -#### Args: +**Signature:** `balena.models.organization.accept(invite_token)` ⇒ None + +**Args:** invite_token (str): invitation Token - invite token. - -### Function: create(handle_or_id, invitee, role_name, message) ⇒ [OrganizationInviteType](#organizationinvitetype) +## create Creates a new invite for an organization. -#### Args: +**Signature:** `balena.models.organization.create(handle_or_id, invitee, role_name, message)` ⇒ [OrganizationInviteType](#organizationinvitetype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string), or id (number). invitee (str): the email/balena_username of the invitee. role_name (Optional[str]): the role name to be granted to the invitee. message (Optional[str]): the message to send along with the invite. -#### Returns: +**Returns:** OrganizationInviteType: organization invite. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.create(26474, 'invitee@example.org', 'member', 'Test invite') ``` - -### Function: get_all(options) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) +## get_all Get all invites. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) +## get_all_by_organization Get all invites by organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string), or id (number). options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[OrganizationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.get_all_by_organization(26474) ``` - -### Function: revoke(invite_id) ⇒ None +## revoke Revoke an invite. -#### Args: +**Signature:** `balena.models.organization.revoke(invite_id)` ⇒ None + +**Args:** invite_id (int): organization invite id. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.revoke(2862) ``` -## DeviceOs -This class implements device os model for balena python SDK. +# DeviceOs - -### Function: download(device_type, version, options) ⇒ None +This class implements device os model for balena python SDK. +## download Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.download(device_type, version, options)` ⇒ None + +**Args:** device_type (str): device type slug. version (str): semver-compatible version or 'latest', defaults to 'latest'. * The version **must** be the exact version number. options (DownloadConfig): OS configuration options to use. -#### Returns: +**Returns:** float: OS image download size, in bytes. Example: @@ -3044,35 +2956,38 @@ Example: ... f.write(chunk) ``` - -### Function: get_all_os_versions(device_type, options) ⇒ None +## get_all_os_versions Get all OS versions for the provided device type(s), inlcuding invalidated ones -#### Args: +**Signature:** `balena.models.os.get_all_os_versions(device_type, options)` ⇒ None + +**Args:** device_type (Union[str, List[str]]): device type slug. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: balenaOS versions. - -### Function: get_available_os_versions(device_type) ⇒ None +## get_available_os_versions Get the supported OS versions for the provided device type(s) -#### Args: +**Signature:** `balena.models.os.get_available_os_versions(device_type)` ⇒ None + +**Args:** device_type (Union[str, List[str]]): device type slug. -#### Returns: +**Returns:** list: balenaOS versions. - -### Function: get_config(slug_or_uuid_or_id, options) ⇒ None +## get_config Download application config.json. -#### Args: +**Signature:** `balena.models.os.get_config(slug_or_uuid_or_id, options)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (ImgConfigOptions): OS configuration dict to use. The available options are listed below: @@ -3090,31 +3005,33 @@ Download application config.json. version (str): Required: the OS version of the image. developmentMode (Optional[bool]): If the device should be in development mode. -#### Returns: +**Returns:** dict: application config.json content. -#### Raises: +**Raises:** ApplicationNotFound: if application couldn't be found. - -### Function: get_download_size(device_type, version) ⇒ float +## get_download_size Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.get_download_size(device_type, version)` ⇒ float + +**Args:** device_type (str): device type slug. version (str): semver-compatible version or 'latest', defaults to 'latest'. * The version **must** be the exact version number. -#### Returns: +**Returns:** float: OS image download size, in bytes. - -### Function: get_max_satisfying_version(device_type, version_or_range, os_type) ⇒ Optional[str] +## get_max_satisfying_version Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.get_max_satisfying_version(device_type, version_or_range, os_type)` ⇒ Optional[str] + +**Args:** device_type (str): device type slug. version_or_range (str): can be one of the exact version number, in which case it is returned if the version is supported, @@ -3131,466 +3048,520 @@ Get OS download size estimate. Currently only the raw (uncompressed) size is rep Defaults to `'latest'` os_type (Optional[Literal["default", "esr"]]): The used OS type. -#### Returns: +**Returns:** float: OS image download size, in bytes. - -### Function: get_supported_os_update_versions(device_type, current_version) ⇒ None +## get_supervisor_releases_for_cpu_architecture + +Returns the Releases of the supervisor for the CPU Architecture + +**Signature:** `balena.models.os.get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** + cpu_architecture_slug_or_id (Union[str, int]): The slug (string) or id (number) for the CPU Architecture. + options (AnyObject): extra pine options to use. + +**Returns:** + ReleaseType: release info. + + +Example: + results = balena.models.os.get_supervisor_releases_for_cpu_architecture('aarch64'); + results = balena.models.os.get_supervisor_releases_for_cpu_architecture( + 'aarch64', + { $filter: { raw_version: '12.11.0' } }, + ); + +## get_supported_os_update_versions Get OS supported versions. -#### Args: +**Signature:** `balena.models.os.get_supported_os_update_versions(device_type, current_version)` ⇒ None + +**Args:** device_type (str): device type slug. current_version (str): device type slug. - -### Function: is_architecture_compatible_with(os_architecture, application_architecture) ⇒ None +## is_architecture_compatible_with Returns whether the specified OS architecture is compatible with the target architecture. -#### Args: +**Signature:** `balena.models.os.is_architecture_compatible_with(os_architecture, application_architecture)` ⇒ None + +**Args:** os_architecture (str): The OS's architecture as specified in its device type. application_architecture (str): The application's architecture as specified in its device type. -#### Returns: +**Returns:** bool: Whether the specified OS architecture is capable of running applications build for the target architecture. - -### Function: is_supported_os_update(device_type, current_version, target_version) ⇒ bool +## is_supported_os_update Returns the supported OS update targets for the provided device type. -#### Args: +**Signature:** `balena.models.os.is_supported_os_update(device_type, current_version, target_version)` ⇒ bool + +**Args:** device_type (str): device type slug. current_version (str): emver-compatible version for the starting OS version target_version (str): semver-compatible version for the target OS version -## Config -This class implements configuration model for balena python SDK. +# Config - -### Function: get_all() ⇒ ConfigType +This class implements configuration model for balena python SDK. +## get_all Get all configuration. -#### Returns: +**Signature:** `balena.models.config.get_all()` ⇒ ConfigType + +**Returns:** ConfigType: configuration information. -#### Examples: +**Examples:** ```python >>> balena.models.config.get_all() ``` -## Release -This class implements release model for balena python SDK. +# Release - -### Function: create_from_url(slug_or_uuid_or_id, url, flatten_tarball) ⇒ int +This class implements release model for balena python SDK. +## create_from_url Create a new release built from the source in the provided url. -#### Args: +**Signature:** `balena.models.release.create_from_url(slug_or_uuid_or_id, url, flatten_tarball)` ⇒ int + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). url (str): a url with a tarball of the project to build. flatten_tarball (bool): Should be true when the tarball includes an extra root folder with all the content. -#### Returns: +**Returns:** int: release Id. - -### Function: finalize(commit_or_id_or_raw_version) ⇒ None +## finalize Finalizes a draft release. -#### Args: +**Signature:** `balena.models.release.finalize(commit_or_id_or_raw_version)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) - -### Function: get(commit_or_id_or_raw_version, options) ⇒ [ReleaseType](#releasetype) +## get Get a specific release. -#### Args: +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, options)` ⇒ [ReleaseType](#releasetype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or id (number) or an object with the unique `application` (number or string) & `rawVersion` (string) pair of the release options options(AnyObject): extra pine options to use -#### Returns: +**Returns:** ReleaseType: release info. - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ReleaseType]](#releasetype) +## get_all_by_application Get all releases from an application. -#### Args: +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ReleaseType]: release info. - -### Function: get_latest_by_application(slug_or_uuid_or_id, options) ⇒ [Optional[ReleaseType]](#releasetype) +## get_latest_by_application Get the latest successful release for an application. -#### Args: +**Signature:** `balena.models.release.get_latest_by_application(slug_or_uuid_or_id, options)` ⇒ [Optional[ReleaseType]](#releasetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** Optional[ReleaseType]: release info. - -### Function: get_with_image_details(commit_or_id_or_raw_version, image_options, release_options) ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) +## get_with_image_details Get a specific release with the details of the images built. -#### Args: +**Signature:** `balena.models.release.get_with_image_details(commit_or_id_or_raw_version, image_options, release_options)` ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) image_options (AnyObject): extra pine options to use on image expand release_options (AnyObject): extra pine options to use on release expand -#### Returns: +**Returns:** dict: release info. -#### Raises: +**Raises:** ReleaseNotFound: if release couldn't be found. - -### Function: set_is_invalidated(commit_or_id_or_raw_version, is_invalidated) ⇒ None +## set_is_invalidated Set the is_invalidated property of a release to True or False. -#### Args: +**Signature:** `balena.models.release.set_is_invalidated(commit_or_id_or_raw_version, is_invalidated)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) is_invalidated (bool): True for invalidated, False for validated. - -### Function: set_known_issue_list(commit_or_id_or_raw_version, known_issue_list) ⇒ None +## set_known_issue_list Set a known issue list for a release. -#### Args: +**Signature:** `balena.models.release.set_known_issue_list(commit_or_id_or_raw_version, known_issue_list)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) known_issue_list (Optional[str]): the known issue list. - -### Function: set_note(commit_or_id_or_raw_version, note) ⇒ None +## set_note Set a note for a release. -#### Args: +**Signature:** `balena.models.release.set_note(commit_or_id_or_raw_version, note)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) note (Optional[str]): the note. - -### Function: set_release_version(commit_or_id, semver) ⇒ None +## set_release_version Set a direct semver for a given release. -#### Args: +**Signature:** `balena.models.release.set_release_version(commit_or_id, semver)` ⇒ None + +**Args:** commit_or_id(Union[str, int]): release commit (string) or id (int) semver (str): the version to be released, must be a valid semver -## ReleaseTag -This class implements release tag model for balena python SDK. +# ReleaseTag - -### Function: get(commit_or_id_or_raw_version, tag_key) ⇒ Optional[str] +This class implements release tag model for balena python SDK. +## get Get a single release tag. -#### Args: +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, tag_key)` ⇒ Optional[str] + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get(465307, 'releaseTag1') ``` - -### Function: get_all(options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all Get all release tags. -#### Args: +**Signature:** `balena.models.release.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_application Get all device tags for an application. -#### Args: +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all_by_application(1005160) ``` - -### Function: get_all_by_release(commit_or_id_or_raw_version, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_release Get all release tags for a release. -#### Args: +**Signature:** `balena.models.release.get_all_by_release(commit_or_id_or_raw_version, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all_by_release(135) ``` - -### Function: remove(commit_or_id_or_raw_version, tag_key) ⇒ None +## remove Remove a release tag. -#### Args: +**Signature:** `balena.models.release.remove(commit_or_id_or_raw_version, tag_key)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.remove(135, 'releaseTag1') ``` - -### Function: set(commit_or_id_or_raw_version, tag_key, value) ⇒ None +## set Set a release tag (update tag value if it exists). -#### Args: +**Signature:** `balena.models.release.set(commit_or_id_or_raw_version, tag_key, value)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.set(465307, 'releaseTag1', 'Python SDK') ``` -## Service -This class implements service model for balena python SDK. +# Service - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ServiceType]](#servicetype) +This class implements service model for balena python SDK. +## get_all_by_application Get all services from an application. -#### Args: +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ServiceType]](#servicetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ServiceType]: service info. -## ServiceEnvVariable -This class implements Service environment variable model for balena python SDK. +# ServiceEnvVariable - -### Function: get(service_id_or_natural_key, key) ⇒ Optional[str] +This class implements Service environment variable model for balena python SDK. +## get Get the value of a specific service variable -#### Args: +**Signature:** `balena.models.service.get(service_id_or_natural_key, key)` ⇒ Optional[str] + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get(1234,'test_env4') >>> balena.models.service.var.get({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all service variables by application. -#### Args: +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get_all_by_application(9020) >>> balena.models.service.var.get_all_by_application("myorg/myslug") ``` - -### Function: get_all_by_service(service_id_or_natural_key, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_service Get all variables for a service. -#### Args: +**Signature:** `balena.models.service.get_all_by_service(service_id_or_natural_key, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get_all_by_service(1234) >>> balena.models.service.var.get_all_by_service({'application': 'myorg/myapp', 'service_name': 'service'}) ``` - -### Function: remove(service_id_or_natural_key, key) ⇒ None +## remove Clear the value of a specific service variable -#### Args: +**Signature:** `balena.models.service.remove(service_id_or_natural_key, key)` ⇒ None + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.service.var.remove({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') >>> balena.models.service.var.remove(1234,'test_env4') ``` - -### Function: set(service_id_or_natural_key, key, value) ⇒ None +## set Set the value of a specific application environment variable. -#### Args: +**Signature:** `balena.models.service.set(service_id_or_natural_key, key, value)` ⇒ None + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.set({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR', 'value') >>> balena.models.service.var.set(1234,'test_env4', 'value') ``` -## Image -This class implements image model for balena python SDK. +# Image - -### Function: get(id, options) ⇒ [ImageType](#imagetype) +This class implements image model for balena python SDK. +## get Get a specific image. -#### Args: +**Signature:** `balena.models.image.get(id, options)` ⇒ [ImageType](#imagetype) + +**Args:** id (int): image id. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** ImageType: image info. - -### Function: get_logs(id) ⇒ str +## get_logs Get the build log from an image. -#### Args: +**Signature:** `balena.models.image.get_logs(id)` ⇒ str + +**Args:** id (str): image id. -#### Returns: +**Returns:** str: build log. -## Auth -This class implements all authentication functions for balena python SDK. +# Auth - -### Function: authenticate() ⇒ str +This class implements all authentication functions for balena python SDK. +## authenticate This function authenticates provided credentials information. You should use Auth.login when possible, as it takes care of saving the Auth Token and username as well. -#### Args: +**Signature:** `balena.auth.authenticate()` ⇒ str + +**Args:** **credentials: credentials keyword arguments. username (str): Balena username. password (str): Password. -#### Returns: +**Returns:** str: Auth Token, -#### Examples: +**Examples:** ```python >>> balena.auth.authenticate(username='', password='') ``` - -### Function: get_actor_id() ⇒ int +## get_actor_id Get current logged in actor id. -#### Returns: +**Signature:** `balena.auth.get_actor_id()` ⇒ int + +**Returns:** int: actor id -#### Examples: +**Examples:** ```python # If you are logged in. >>> balena.auth.get_actor_id() ``` - -### Function: get_token() ⇒ Optional[str] +## get_token This function retrieves Auth Token. -#### Returns: +**Signature:** `balena.auth.get_token()` ⇒ Optional[str] + +**Returns:** str: Auth Token. -#### Examples: +**Examples:** ```python >>> balena.auth.get_token() ``` - -### Function: get_user_info() ⇒ UserInfo +## get_user_info Get current logged in user's info -#### Returns: +**Signature:** `balena.auth.get_user_info()` ⇒ UserInfo + +**Returns:** UserInfo: user info. -#### Examples: +**Examples:** ```python # If you are logged in as a user. >>> balena.auth.get_user_info() ``` - -### Function: is_logged_in() ⇒ bool +## is_logged_in This function checks if you're logged in -#### Returns: +**Signature:** `balena.auth.is_logged_in()` ⇒ bool + +**Returns:** bool: True if logged in, False otherwise. -#### Examples: +**Examples:** ```python # Check if user logged in. >>> if balena.auth.is_logged_in(): @@ -3599,17 +3570,18 @@ This function checks if you're logged in ... print('You are not logged in!') ``` - -### Function: login() ⇒ None +## login This function is used for logging into balena using email and password. -#### Args: +**Signature:** `balena.auth.login()` ⇒ None + +**Args:** **credentials: credentials keyword arguments. username (str): Balena email. password (str): Password. -#### Examples: +**Examples:** ```python >>> from balena import Balena ... balena = Balena() @@ -3619,19 +3591,20 @@ This function is used for logging into balena using email and password. ... balena.auth.login(username='', password='') ``` - -### Function: login_with_token(token) ⇒ None +## login_with_token This function is used for logging into balena using Auth Token. Auth Token can be found in Preferences section on balena Dashboard. -#### Args: +**Signature:** `balena.auth.login_with_token(token)` ⇒ None + +**Args:** token (str): Auth Token. -#### Returns: +**Returns:** This functions saves Auth Token to Settings and returns nothing. -#### Examples: +**Examples:** ```python >>> from balena import Balena >>> balena = Balena() @@ -3639,63 +3612,67 @@ Auth Token can be found in Preferences section on balena Dashboard. >>> balena.auth.login_with_token(auth_token) ``` - -### Function: logout() ⇒ None +## logout This function is used for logging out from balena. -#### Examples: +**Signature:** `balena.auth.logout()` ⇒ None + +**Examples:** ```python # If you are logged in. >>> balena.auth.logout() ``` - -### Function: register() ⇒ str +## register This function is used for registering to balena. -#### Args: +**Signature:** `balena.auth.register()` ⇒ str + +**Args:** **credentials: credentials keyword arguments. email (str): email to register. password (str): Password. -#### Returns: +**Returns:** str: Auth Token for new account. -#### Examples: +**Examples:** ```python >>> credentials = {'email': '', 'password': ''} >>> balena.auth.register(**credentials) ``` - -### Function: whoami() ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] +## whoami Return current logged in username. -#### Returns: +**Signature:** `balena.auth.whoami()` ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] + +**Returns:** Optional[WhoamiResult]: current logged in information -#### Examples: +**Examples:** ```python >>> balena.auth.whoami() ``` -## TwoFactorAuth -This class implements basic 2FA functionalities for balena python SDK. +# TwoFactorAuth - -### Function: challenge(code) ⇒ None +This class implements basic 2FA functionalities for balena python SDK. +## challenge Challenge two-factor authentication. If your account has two-factor authentication enabled and logging in using credentials, you need to pass two-factor authentication before being allowed to use other functions. -#### Args: +**Signature:** `balena.twofactor_auth.challenge(code)` ⇒ None + +**Args:** code (str): two-factor authentication code. -#### Examples: +**Examples:** ```python # You need to enable two-factor authentication on dashboard first. # Check if two-factor authentication is passed for current session. @@ -3707,146 +3684,158 @@ False True ``` - -### Function: disable(password) ⇒ str +## disable Disable two factor authentication. __Note__: Disable will only work when using a token that has 2FA enabled. -#### Args: +**Signature:** `balena.twofactor_auth.disable(password)` ⇒ str + +**Args:** password (str): password. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.disable('your_password') ``` - -### Function: enable(code) ⇒ str +## enable Enable two factor authentication. -#### Args: +**Signature:** `balena.twofactor_auth.enable(code)` ⇒ str + +**Args:** code (str): two-factor authentication code. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.enable('123456') ``` - -### Function: get_setup_key() ⇒ str +## get_setup_key Retrieves a setup key for enabling two factor authentication. This value should be provided to your 2FA app in order to get a token. This function only works if you disable two-factor authentication or log in using Auth Token from dashboard. -#### Returns: +**Signature:** `balena.twofactor_auth.get_setup_key()` ⇒ str + +**Returns:** str: setup key. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.get_setup_key() ``` - -### Function: is_enabled() ⇒ bool +## is_enabled Check if two-factor authentication is enabled. -#### Returns: +**Signature:** `balena.twofactor_auth.is_enabled()` ⇒ bool + +**Returns:** bool: True if enabled. Otherwise False. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.is_enabled() ``` - -### Function: is_passed() ⇒ bool +## is_passed Check if two-factor authentication challenge was passed. If the user does not have 2FA enabled, this will be True. -#### Returns: +**Signature:** `balena.twofactor_auth.is_passed()` ⇒ bool + +**Returns:** bool: True if passed. Otherwise False. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.is_passed() ``` - -### Function: verify(code) ⇒ str +## verify Verifies two factor authentication. Note that this method not update the token automatically. You should use balena.twofactor_auth.challenge() when possible, as it takes care of that as well. -#### Args: +**Signature:** `balena.twofactor_auth.verify(code)` ⇒ str + +**Args:** code (str): two-factor authentication code. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.verify('123456') ``` -## Logs -This class implements functions that allow processing logs from device. +# Logs - -### Function: history(uuid_or_id, count) ⇒ List[Log] +This class implements functions that allow processing logs from device. +## history Get device logs history. -#### Args: +**Signature:** `balena.logs.history(uuid_or_id, count)` ⇒ List[Log] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. - -### Function: stop() ⇒ None +## stop Will grecefully unsubscribe from all devices and stop the consumer thread. +**Signature:** `balena.logs.stop()` ⇒ None + - -### Function: subscribe(uuid_or_id, callback, error, count) ⇒ None +## subscribe Subscribe to device logs. -#### Args: +**Signature:** `balena.logs.subscribe(uuid_or_id, callback, error, count)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) callback (Callable[[Log], None]): this callback is called on receiving a message. error (Optional[Callable[[Any], None]]): this callback is called on an error event. count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. - -### Function: unsubscribe(uuid_or_id) ⇒ None +## unsubscribe Unsubscribe from device logs for a specific device. -#### Args: +**Signature:** `balena.logs.unsubscribe(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: unsubscribe_all() ⇒ None +## unsubscribe_all Unsubscribe all subscribed devices. -## Settings +**Signature:** `balena.logs.unsubscribe_all()` ⇒ None + + +# Settings Create a module object. The name must be a string; the optional doc argument can have any type. -## Types -### APIKeyInfoType +# Types +## APIKeyInfoType ```python @@ -3858,7 +3847,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### APIKeyType +## APIKeyType ```python @@ -3873,7 +3862,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ActorType +## ActorType ```python @@ -3888,7 +3877,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationHostedOnApplication +## ApplicationHostedOnApplication ```python @@ -3899,7 +3888,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationInviteType +## ApplicationInviteType ```python @@ -3915,7 +3904,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationMembershipRoleType +## ApplicationMembershipRoleType ```python @@ -3926,7 +3915,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationMembershipType +## ApplicationMembershipType ```python @@ -3939,7 +3928,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationType +## ApplicationType ```python @@ -3958,7 +3947,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### BaseTagType +## BaseTagType ```python @@ -3970,7 +3959,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### BasicUserInfoType +## BasicUserInfoType ```python @@ -3981,7 +3970,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### CpuArchitectureType +## CpuArchitectureType ```python @@ -3993,7 +3982,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### CreditBundleType +## CreditBundleType ```python @@ -4013,7 +4002,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceFamilyType +## DeviceFamilyType ```python @@ -4028,7 +4017,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceHistoryType +## DeviceHistoryType ```python @@ -4054,7 +4043,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceManufacturerType +## DeviceManufacturerType ```python @@ -4068,7 +4057,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceMetricsType +## DeviceMetricsType ```python @@ -4086,7 +4075,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceTypeAliasType +## DeviceTypeAliasType ```python @@ -4098,7 +4087,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceTypeType +## DeviceTypeType ```python @@ -4119,7 +4108,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### EnvironmentVariableBase +## EnvironmentVariableBase ```python @@ -4131,7 +4120,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageBasicInfoType +## ImageBasicInfoType ```python @@ -4142,7 +4131,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageInstallType +## ImageInstallType ```python @@ -4158,7 +4147,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageType +## ImageType ```python @@ -4174,7 +4163,7 @@ The name must be a string; the optional doc argument can have any type. "start_timestamp": str, "end_timestamp": str, "push_timestamp": str, - "image_size": int, + "image_size": str, "dockerfile": str, "error_message": str, "is_a_build_of__service": Union[List[ServiceType], PineDeferred], @@ -4183,7 +4172,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### InviteeType +## InviteeType ```python @@ -4195,7 +4184,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationInviteType +## OrganizationInviteType ```python @@ -4211,7 +4200,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipRoleType +## OrganizationMembershipRoleType ```python @@ -4222,7 +4211,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipTagType +## OrganizationMembershipTagType ```python @@ -4232,7 +4221,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipType +## OrganizationMembershipType ```python @@ -4248,7 +4237,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationPrivateDeviceTypeAccess +## OrganizationPrivateDeviceTypeAccess ```python @@ -4260,7 +4249,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationType +## OrganizationType ```python @@ -4279,7 +4268,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PineDeferred +## PineDeferred ```python @@ -4289,7 +4278,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PublicDeviceType +## PublicDeviceType ```python @@ -4303,7 +4292,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PublicOrganizationType +## PublicOrganizationType ```python @@ -4315,7 +4304,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseImageType +## ReleaseImageType ```python @@ -4328,7 +4317,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseType +## ReleaseType ```python @@ -4366,13 +4355,15 @@ The name must be a string; the optional doc argument can have any type. "release_image": Optional[List[ReleaseImageType]], "should_be_running_on__application": Optional[List[TypeApplication]], "is_running_on__device": Optional[List[TypeDevice]], - "should_be_running_on__device": Optional[List[TypeDevice]], + "is_pinned_to__device": Optional[List[TypeDevice]], + "should_operate__device": Optional[List[TypeDevice]], + "should_manage__device": Optional[List[TypeDevice]], "release_tag": Optional[List[BaseTagType]] } ``` -### ReleaseVersion +## ReleaseVersion ```python @@ -4388,7 +4379,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseWithImageDetailsType +## ReleaseWithImageDetailsType ```python @@ -4426,7 +4417,9 @@ The name must be a string; the optional doc argument can have any type. "release_image": Optional[List[ReleaseImageType]], "should_be_running_on__application": Optional[List[TypeApplication]], "is_running_on__device": Optional[List[TypeDevice]], - "should_be_running_on__device": Optional[List[TypeDevice]], + "is_pinned_to__device": Optional[List[TypeDevice]], + "should_operate__device": Optional[List[TypeDevice]], + "should_manage__device": Optional[List[TypeDevice]], "release_tag": Optional[List[BaseTagType]], "images": List[ImageBasicInfoType], "user": BasicUserInfoType @@ -4434,7 +4427,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### SSHKeyType +## SSHKeyType ```python @@ -4448,7 +4441,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ServiceInstanceType +## ServiceInstanceType ```python @@ -4462,7 +4455,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ServiceType +## ServiceType ```python @@ -4478,23 +4471,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### SupervisorReleaseType - - -```python -{ - "created_at": str, - "id": int, - "supervisor_version": str, - "image_name": str, - "is_public": bool, - "note": Optional[str], - "is_for__device_type": Union[List[DeviceTypeType], PineDeferred] -} -``` - - -### TeamApplicationAccessType +## TeamApplicationAccessType ```python @@ -4507,7 +4484,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamMembershipType +## TeamMembershipType ```python @@ -4520,7 +4497,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamType +## TeamType ```python @@ -4535,7 +4512,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeApplication +## TypeApplication ```python @@ -4543,7 +4520,7 @@ The name must be a string; the optional doc argument can have any type. "id": int, "created_at": str, "app_name": str, - "actor": Union[List[ActorType], int], + "actor": Union[List[ActorType], PineDeferred], "slug": str, "uuid": str, "is_accessible_by_support_until__date": str, @@ -4577,7 +4554,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeApplicationWithDeviceServiceDetails +## TypeApplicationWithDeviceServiceDetails ```python @@ -4585,7 +4562,7 @@ The name must be a string; the optional doc argument can have any type. "id": int, "created_at": str, "app_name": str, - "actor": Union[List[ActorType], int], + "actor": Union[List[ActorType], PineDeferred], "slug": str, "uuid": str, "is_accessible_by_support_until__date": str, @@ -4619,7 +4596,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeCurrentService +## TypeCurrentService ```python @@ -4634,13 +4611,13 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeDevice +## TypeDevice ```python { "id": int, - "actor": Union[List[ActorType], int], + "actor": Union[List[ActorType], PineDeferred], "created_at": str, "modified_at": str, "custom_latitude": str, @@ -4668,12 +4645,9 @@ The name must be a string; the optional doc argument can have any type. "os_version": str, "provisioning_progress": int, "provisioning_state": str, - "state": TypeDeviceState, "status": str, - "status_sort_index": int, "supervisor_version": str, "uuid": str, - "vpn_address": str, "api_heartbeat_state": Literal["online", "offline", "timeout", "unknown"], "memory_usage": int, "memory_total": int, @@ -4684,15 +4658,16 @@ The name must be a string; the optional doc argument can have any type. "cpu_temp": int, "cpu_id": str, "is_undervolted": bool, - "overall_status": Any, + "overall_status": Literal["configuring", "inactive", "post-provisioning", "updating", "operational", "disconnected", "reduced-functionality"], "overall_progress": int, "is_of__device_type": Union[List[DeviceTypeType], PineDeferred], "belongs_to__application": Union[List[TypeApplication], PineDeferred], "belongs_to__user": Union[List[UserType], PineDeferred, None], "is_running__release": Union[List[ReleaseType], PineDeferred, None], - "should_be_running__release": Union[List[ReleaseType], PineDeferred, None], + "is_pinned_on__release": Union[List[ReleaseType], PineDeferred, None], "is_managed_by__service_instance": Union[List[ServiceInstanceType], PineDeferred, None], - "should_be_managed_by__supervisor_release": Union[List[SupervisorReleaseType], PineDeferred, None], + "should_be_operated_by__release": Union[List[ReleaseType], PineDeferred, None], + "should_be_managed_by__release": Union[List[ReleaseType], PineDeferred, None], "device_config_variable": Optional[List[EnvironmentVariableBase]], "device_environment_variable": Optional[List[EnvironmentVariableBase]], "device_tag": Optional[List[BaseTagType]], @@ -4702,24 +4677,13 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeDeviceState - - -```python -{ - "key": str, - "name": str -} -``` - - -### TypeDeviceWithServices +## TypeDeviceWithServices ```python { "id": int, - "actor": Union[List[ActorType], int], + "actor": Union[List[ActorType], PineDeferred], "created_at": str, "modified_at": str, "custom_latitude": str, @@ -4747,12 +4711,9 @@ The name must be a string; the optional doc argument can have any type. "os_version": str, "provisioning_progress": int, "provisioning_state": str, - "state": TypeDeviceState, "status": str, - "status_sort_index": int, "supervisor_version": str, "uuid": str, - "vpn_address": str, "api_heartbeat_state": Literal["online", "offline", "timeout", "unknown"], "memory_usage": int, "memory_total": int, @@ -4763,15 +4724,16 @@ The name must be a string; the optional doc argument can have any type. "cpu_temp": int, "cpu_id": str, "is_undervolted": bool, - "overall_status": Any, + "overall_status": Literal["configuring", "inactive", "post-provisioning", "updating", "operational", "disconnected", "reduced-functionality"], "overall_progress": int, "is_of__device_type": Union[List[DeviceTypeType], PineDeferred], "belongs_to__application": Union[List[TypeApplication], PineDeferred], "belongs_to__user": Union[List[UserType], PineDeferred, None], "is_running__release": Union[List[ReleaseType], PineDeferred, None], - "should_be_running__release": Union[List[ReleaseType], PineDeferred, None], + "is_pinned_on__release": Union[List[ReleaseType], PineDeferred, None], "is_managed_by__service_instance": Union[List[ServiceInstanceType], PineDeferred, None], - "should_be_managed_by__supervisor_release": Union[List[SupervisorReleaseType], PineDeferred, None], + "should_be_operated_by__release": Union[List[ReleaseType], PineDeferred, None], + "should_be_managed_by__release": Union[List[ReleaseType], PineDeferred, None], "device_config_variable": Optional[List[EnvironmentVariableBase]], "device_environment_variable": Optional[List[EnvironmentVariableBase]], "device_tag": Optional[List[BaseTagType]], @@ -4782,7 +4744,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeVar +## TypeVar ```python @@ -4792,7 +4754,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypedDict +## TypedDict ```python @@ -4802,13 +4764,13 @@ The name must be a string; the optional doc argument can have any type. ``` -### UserType +## UserType ```python { "id": int, - "actor": Union[List[ActorType], int], + "actor": Union[List[ActorType], PineDeferred], "created_at": str, "username": str, "organization_membership": Optional[List[OrganizationMembershipType]], @@ -4819,7 +4781,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### WebResource +## WebResource ```python diff --git a/pages/external-docs/sdk/python-sdk/v15.1.5.md b/pages/external-docs/sdk/python-sdk/v15.1.5.md index 511955ffeb..08a691bc6b 100644 --- a/pages/external-docs/sdk/python-sdk/v15.1.5.md +++ b/pages/external-docs/sdk/python-sdk/v15.1.5.md @@ -77,1078 +77,863 @@ balena = Balena({"retry_rate_limited_request": True}) If you feel something is missing, not clear or could be improved, [please don't hesitate to open an issue in GitHub](https://github.com/balena-io/balena-sdk-python/issues), we'll be happy to help. -## Table of Contents -- [balena](#balena) - - [.models](#models) - - [.application](#application) - - [create(name, device_type, organization, application_class)](#application.create) ⇒ [TypeApplication](#typeapplication) - - [disable_device_urls(slug_or_uuid_or_id)](#application.disable_device_urls) ⇒ None - - [enable_device_urls(slug_or_uuid_or_id)](#application.enable_device_urls) ⇒ None - - [generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date)](#application.generate_provisioning_key) ⇒ str - - [get(slug_or_uuid_or_id, options, context)](#application.get) ⇒ [TypeApplication](#typeapplication) - - [get_all(options, context)](#application.get_all) ⇒ [List[TypeApplication]](#typeapplication) - - [get_all_by_organization(org_handle_or_id, options)](#application.get_all_by_organization) ⇒ [List[TypeApplication]](#typeapplication) - - [get_all_directly_accessible(options)](#application.get_all_directly_accessible) ⇒ [List[TypeApplication]](#typeapplication) - - [get_by_name(app_name, options, context)](#application.get_by_name) ⇒ [TypeApplication](#typeapplication) - - [get_dashboard_url(app_id)](#application.get_dashboard_url) ⇒ str - - [get_directly_accessible(slug_or_uuid_or_id, options)](#application.get_directly_accessible) ⇒ [TypeApplication](#typeapplication) - - [get_id(slug_or_uuid_or_id)](#application.get_id) ⇒ int - - [get_target_release_hash(slug_or_uuid_or_id)](#application.get_target_release_hash) ⇒ Optional[str] - - [get_with_device_service_details(slug_or_uuid_or_id, options)](#application.get_with_device_service_details) ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) - - [grant_support_access(slug_or_uuid_or_id, expiry_timestamp)](#application.grant_support_access) ⇒ None - - [has(slug_or_uuid_or_id)](#application.has) ⇒ bool - - [has_any()](#application.has_any) ⇒ bool - - [is_tracking_latest_release(slug_or_uuid_or_id)](#application.is_tracking_latest_release) ⇒ bool - - [pin_to_release(slug_or_uuid_or_id, full_release_hash)](#application.pin_to_release) ⇒ None - - [purge(app_id)](#application.purge) ⇒ None - - [reboot(app_id, options)](#application.reboot) ⇒ None - - [remove(slug_or_uuid_or_id)](#application.remove) ⇒ None - - [rename(slug_or_uuid_or_id, new_name)](#application.rename) ⇒ None - - [restart(slug_or_uuid_or_id)](#application.restart) ⇒ None - - [revoke_support_access(slug_or_uuid_or_id)](#application.revoke_support_access) ⇒ None - - [shutdown(app_id, options)](#application.shutdown) ⇒ None - - [track_latest_release(slug_or_uuid_or_id)](#application.track_latest_release) ⇒ None - - [will_track_new_releases(slug_or_uuid_or_id)](#application.will_track_new_releases) ⇒ bool - - [.tags](#applicationtag) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationtag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(slug_or_uuid_or_id, tag_key)](#applicationtag.remove) ⇒ None - - [set(slug_or_uuid_or_id, tag_key, value)](#applicationtag.set) ⇒ None - - [.config_var](#applicationconfigvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#applicationconfigvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationconfigvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#applicationconfigvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#applicationconfigvariable.set) ⇒ None - - [.env_var](#applicationenvvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#applicationenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#applicationenvvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#applicationenvvariable.set) ⇒ None - - [.build_var](#buildenvvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#buildenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#buildenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#buildenvvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#buildenvvariable.set) ⇒ None - - [.membership](#applicationmembership) - - [change_role(membership_id, role_name)](#applicationmembership.change_role) ⇒ None - - [create(slug_or_uuid_or_id, username, role_name)](#applicationmembership.create) ⇒ [ApplicationMembershipType](#applicationmembershiptype) - - [get(membership_id, options)](#applicationmembership.get) ⇒ [ApplicationMembershipType](#applicationmembershiptype) - - [get_all(options)](#applicationmembership.get_all) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationmembership.get_all_by_application) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) - - [remove(membership_id)](#applicationmembership.remove) ⇒ None - - [.invite](#applicationinvite) - - [accept(invite_token)](#applicationinvite.accept) ⇒ None - - [create(slug_or_uuid_or_id, options)](#applicationinvite.create) ⇒ [ApplicationInviteType](#applicationinvitetype) - - [get_all(options)](#applicationinvite.get_all) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationinvite.get_all_by_application) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) - - [revoke(invite_id)](#applicationinvite.revoke) ⇒ None - - [.device](#device) - - [deactivate(uuid_or_id_or_ids)](#device.deactivate) ⇒ None - - [disable_device_url(uuid_or_id_or_ids)](#device.disable_device_url) ⇒ None - - [disable_local_mode(uuid_or_id)](#device.disable_local_mode) ⇒ None - - [disable_lock_override(uuid_or_id)](#device.disable_lock_override) ⇒ None - - [enable_device_url(uuid_or_id_or_ids)](#device.enable_device_url) ⇒ None - - [enable_local_mode(uuid_or_id)](#device.enable_local_mode) ⇒ None - - [enable_lock_override(uuid_or_id)](#device.enable_lock_override) ⇒ None - - [generate_device_key(uuid_or_id, name, description, expiry_date)](#device.generate_device_key) ⇒ str - - [generate_uuid()](#device.generate_uuid) ⇒ str - - [get(uuid_or_id, options)](#device.get) ⇒ [TypeDevice](#typedevice) - - [get_all(options)](#device.get_all) ⇒ [List[TypeDevice]](#typedevice) - - [get_all_by_application(slug_or_uuid_or_id, options)](#device.get_all_by_application) ⇒ [List[TypeDevice]](#typedevice) - - [get_all_by_organization(handle_or_id, options)](#device.get_all_by_organization) ⇒ [List[TypeDevice]](#typedevice) - - [get_application_info(uuid_or_id)](#device.get_application_info) ⇒ Any - - [get_application_name(uuid_or_id)](#device.get_application_name) ⇒ str - - [get_by_name(name, options)](#device.get_by_name) ⇒ [List[TypeDevice]](#typedevice) - - [get_dashboard_url(uuid)](#device.get_dashboard_url) ⇒ None - - [get_device_url(uuid_or_id)](#device.get_device_url) ⇒ str - - [get_local_ip_address(uuid_or_id)](#device.get_local_ip_address) ⇒ List[str] - - [get_local_mode_support(uuid_or_id)](#device.get_local_mode_support) ⇒ LocalModeResponse - - [get_mac_address(uuid_or_id)](#device.get_mac_address) ⇒ List[str] - - [get_metrics(uuid_or_id)](#device.get_metrics) ⇒ [DeviceMetricsType](#devicemetricstype) - - [get_name(uuid_or_id)](#device.get_name) ⇒ str - - [get_os_update_status(uuid_or_id)](#device.get_os_update_status) ⇒ HUPStatusResponse - - [get_status(uuid_or_id)](#device.get_status) ⇒ str - - [get_supervisor_state(uuid_or_id)](#device.get_supervisor_state) ⇒ SupervisorStateType - - [get_supervisor_target_state(uuid_or_id)](#device.get_supervisor_target_state) ⇒ Any - - [get_supervisor_target_state_for_app(slug_or_uuid_or_id, release)](#device.get_supervisor_target_state_for_app) ⇒ Any - - [get_with_service_details(uuid_or_id, options)](#device.get_with_service_details) ⇒ [TypeDeviceWithServices](#typedevicewithservices) - - [grant_support_access(uuid_or_id_or_ids, expiry_timestamp)](#device.grant_support_access) ⇒ None - - [has(uuid_or_id)](#device.has) ⇒ bool - - [has_device_url(uuid_or_id)](#device.has_device_url) ⇒ bool - - [has_lock_override(uuid_or_id)](#device.has_lock_override) ⇒ bool - - [identify(uuid_or_id)](#device.identify) ⇒ None - - [is_in_local_mode(uuid_or_id)](#device.is_in_local_mode) ⇒ bool - - [is_online(uuid_or_id)](#device.is_online) ⇒ bool - - [is_tracking_application_release(uuid_or_id)](#device.is_tracking_application_release) ⇒ bool - - [move(uuid_or_id, app_slug_or_uuid_or_id)](#device.move) ⇒ None - - [pin_to_release(uuid_or_id, full_release_hash_or_id)](#device.pin_to_release) ⇒ None - - [ping(uuid_or_id)](#device.ping) ⇒ None - - [purge(uuid_or_id)](#device.purge) ⇒ None - - [reboot(uuid_or_id, force)](#device.reboot) ⇒ None - - [register(application_slug_or_uuid_or_id, uuid, device_type_slug)](#device.register) ⇒ RegisterResponse - - [remove(uuid_or_id_or_ids)](#device.remove) ⇒ None - - [rename(uuid_or_id, new_name)](#device.rename) ⇒ None - - [restart_application(uuid_or_id)](#device.restart_application) ⇒ None - - [restart_service(uuid_or_id, image_id)](#device.restart_service) ⇒ None - - [revoke_support_access(uuid_or_id_or_ids)](#device.revoke_support_access) ⇒ None - - [set_custom_location(uuid_or_id_or_ids, location)](#device.set_custom_location) ⇒ None - - [set_note(uuid_or_id_or_ids, note)](#device.set_note) ⇒ None - - [set_supervisor_release(uuid_or_id, supervisor_version_or_id)](#device.set_supervisor_release) ⇒ None - - [shutdown(uuid_or_id, force)](#device.shutdown) ⇒ None - - [start_application(uuid_or_id)](#device.start_application) ⇒ None - - [start_os_update(uuid_or_id, target_os_version)](#device.start_os_update) ⇒ HUPStatusResponse - - [start_service(uuid_or_id, image_id)](#device.start_service) ⇒ None - - [stop_application(uuid_or_id)](#device.stop_application) ⇒ None - - [stop_service(uuid_or_id, image_id)](#device.stop_service) ⇒ None - - [track_application_release(uuid_or_id_or_ids)](#device.track_application_release) ⇒ None - - [unset_custom_location(uuid_or_id_or_ids)](#device.unset_custom_location) ⇒ None - - [update(uuid_or_id, force)](#device.update) ⇒ None - - [.tags](#devicetag) - - [get(uuid_or_id, tag_key)](#devicetag.get) ⇒ Optional[str] - - [get_all(options)](#devicetag.get_all) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#devicetag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_device(uuid_or_id, options)](#devicetag.get_all_by_device) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(uuid_or_id, tag_key)](#devicetag.remove) ⇒ None - - [set(uuid_or_id, tag_key, value)](#devicetag.set) ⇒ None - - [.config_var](#deviceconfigvariable) - - [get(uuid_or_id, env_var_name)](#deviceconfigvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceconfigvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceconfigvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, key)](#deviceconfigvariable.remove) ⇒ None - - [set(uuid_or_id, env_var_name, value)](#deviceconfigvariable.set) ⇒ None - - [.env_var](#deviceenvvariable) - - [get(uuid_or_id, env_var_name)](#deviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceenvvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, key)](#deviceenvvariable.remove) ⇒ None - - [set(uuid_or_id, env_var_name, value)](#deviceenvvariable.set) ⇒ None - - [.service_var](#deviceserviceenvvariable) - - [get(uuid_or_id, service_name_or_id, key)](#deviceserviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceserviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceserviceenvvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, service_name_or_id, key)](#deviceserviceenvvariable.remove) ⇒ None - - [set(uuid_or_id, service_name_or_id, key, value)](#deviceserviceenvvariable.set) ⇒ None - - [.history](#devicehistory) - - [get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options)](#devicehistory.get_all_by_application) ⇒ [List[DeviceHistoryType]](#devicehistorytype) - - [get_all_by_device(uuid_or_id, from_date, to_date, options)](#devicehistory.get_all_by_device) ⇒ [List[DeviceHistoryType]](#devicehistorytype) - - [.device_type](#devicetype) - - [get(id_or_slug, options)](#devicetype.get) ⇒ [DeviceTypeType](#devicetypetype) - - [get_all(options)](#devicetype.get_all) ⇒ [List[DeviceTypeType]](#devicetypetype) - - [get_all_supported(options)](#devicetype.get_all_supported) ⇒ None - - [get_by_slug_or_name(slug_or_name, options)](#devicetype.get_by_slug_or_name) ⇒ [DeviceTypeType](#devicetypetype) - - [get_name(slug)](#devicetype.get_name) ⇒ str - - [get_slug_by_name(name)](#devicetype.get_slug_by_name) ⇒ str - - [.api_key](#apikey) - - [create(name, description, expiry_date)](#apikey.create) ⇒ str - - [get_all(options)](#apikey.get_all) ⇒ [List[APIKeyType]](#apikeytype) - - [get_all_named_user_api_keys(options)](#apikey.get_all_named_user_api_keys) ⇒ [List[APIKeyType]](#apikeytype) - - [get_device_api_keys_by_device(uuid_or_id, options)](#apikey.get_device_api_keys_by_device) ⇒ [List[APIKeyType]](#apikeytype) - - [get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options)](#apikey.get_provisioning_api_keys_by_application) ⇒ [List[APIKeyType]](#apikeytype) - - [revoke(id)](#apikey.revoke) ⇒ None - - [update(id, api_key_info)](#apikey.update) ⇒ None - - [.key](#key) - - [create(title, key)](#key.create) ⇒ [SSHKeyType](#sshkeytype) - - [get(id)](#key.get) ⇒ [SSHKeyType](#sshkeytype) - - [get_all(options)](#key.get_all) ⇒ [List[SSHKeyType]](#sshkeytype) - - [remove(id)](#key.remove) ⇒ None - - [.organization](#organization) - - [create(name, handle, logo_image)](#organization.create) ⇒ [OrganizationType](#organizationtype) - - [get(handle_or_id, options)](#organization.get) ⇒ [OrganizationType](#organizationtype) - - [get_all(options)](#organization.get_all) ⇒ [List[OrganizationType]](#organizationtype) - - [remove(handle_or_id)](#organization.remove) ⇒ None - - [.membership](#organizationmembership) - - [get(membership_id, options)](#organizationmembership.get) ⇒ [OrganizationMembershipType](#organizationmembershiptype) - - [get_all(options)](#organizationmembership.get_all) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) - - [get_all_by_organization(handle_or_id, options)](#organizationmembership.get_all_by_organization) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) - - [.tags](#organizationmembershiptag) - - [get(membership_id, tag_key)](#organizationmembershiptag.get) ⇒ Optional[str] - - [get_all(options)](#organizationmembershiptag.get_all) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [get_all_by_organization(handle_or_id, options)](#organizationmembershiptag.get_all_by_organization) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [get_all_by_organization_membership(membership_id, options)](#organizationmembershiptag.get_all_by_organization_membership) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [remove(membership_id, tag_key)](#organizationmembershiptag.remove) ⇒ None - - [set(membership_id, tag_key, value)](#organizationmembershiptag.set) ⇒ None - - [.invite](#organizationinvite) - - [accept(invite_token)](#organizationinvite.accept) ⇒ None - - [create(handle_or_id, invitee, role_name, message)](#organizationinvite.create) ⇒ [OrganizationInviteType](#organizationinvitetype) - - [get_all(options)](#organizationinvite.get_all) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) - - [get_all_by_organization(handle_or_id, options)](#organizationinvite.get_all_by_organization) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) - - [revoke(invite_id)](#organizationinvite.revoke) ⇒ None - - [.os](#deviceos) - - [download(device_type, version, options)](#deviceos.download) ⇒ None - - [get_all_os_versions(device_type, options)](#deviceos.get_all_os_versions) ⇒ None - - [get_available_os_versions(device_type)](#deviceos.get_available_os_versions) ⇒ None - - [get_config(slug_or_uuid_or_id, options)](#deviceos.get_config) ⇒ None - - [get_download_size(device_type, version)](#deviceos.get_download_size) ⇒ float - - [get_max_satisfying_version(device_type, version_or_range, os_type)](#deviceos.get_max_satisfying_version) ⇒ Optional[str] - - [get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options)](#deviceos.get_supervisor_releases_for_cpu_architecture) ⇒ [List[ReleaseType]](#releasetype) - - [get_supported_os_update_versions(device_type, current_version)](#deviceos.get_supported_os_update_versions) ⇒ None - - [is_architecture_compatible_with(os_architecture, application_architecture)](#deviceos.is_architecture_compatible_with) ⇒ None - - [is_supported_os_update(device_type, current_version, target_version)](#deviceos.is_supported_os_update) ⇒ bool - - [.config](#config) - - [get_all()](#config.get_all) ⇒ ConfigType - - [.release](#release) - - [create_from_url(slug_or_uuid_or_id, url, flatten_tarball)](#release.create_from_url) ⇒ int - - [finalize(commit_or_id_or_raw_version)](#release.finalize) ⇒ None - - [get(commit_or_id_or_raw_version, options)](#release.get) ⇒ [ReleaseType](#releasetype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#release.get_all_by_application) ⇒ [List[ReleaseType]](#releasetype) - - [get_latest_by_application(slug_or_uuid_or_id, options)](#release.get_latest_by_application) ⇒ [Optional[ReleaseType]](#releasetype) - - [get_with_image_details(commit_or_id_or_raw_version, image_options, release_options)](#release.get_with_image_details) ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) - - [set_is_invalidated(commit_or_id_or_raw_version, is_invalidated)](#release.set_is_invalidated) ⇒ None - - [set_known_issue_list(commit_or_id_or_raw_version, known_issue_list)](#release.set_known_issue_list) ⇒ None - - [set_note(commit_or_id_or_raw_version, note)](#release.set_note) ⇒ None - - [set_release_version(commit_or_id, semver)](#release.set_release_version) ⇒ None - - [.tags](#releasetag) - - [get(commit_or_id_or_raw_version, tag_key)](#releasetag.get) ⇒ Optional[str] - - [get_all(options)](#releasetag.get_all) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#releasetag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_release(commit_or_id_or_raw_version, options)](#releasetag.get_all_by_release) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(commit_or_id_or_raw_version, tag_key)](#releasetag.remove) ⇒ None - - [set(commit_or_id_or_raw_version, tag_key, value)](#releasetag.set) ⇒ None - - [.service](#service) - - [get_all_by_application(slug_or_uuid_or_id, options)](#service.get_all_by_application) ⇒ [List[ServiceType]](#servicetype) - - [.var](#serviceenvvariable) - - [get(service_id_or_natural_key, key)](#serviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#serviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_service(service_id_or_natural_key, options)](#serviceenvvariable.get_all_by_service) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(service_id_or_natural_key, key)](#serviceenvvariable.remove) ⇒ None - - [set(service_id_or_natural_key, key, value)](#serviceenvvariable.set) ⇒ None - - [.image](#image) - - [get(id, options)](#image.get) ⇒ [ImageType](#imagetype) - - [get_logs(id)](#image.get_logs) ⇒ str - - [.auth](#auth) - - [authenticate()](#auth.authenticate) ⇒ str - - [get_actor_id()](#auth.get_actor_id) ⇒ int - - [get_token()](#auth.get_token) ⇒ Optional[str] - - [get_user_info()](#auth.get_user_info) ⇒ UserInfo - - [is_logged_in()](#auth.is_logged_in) ⇒ bool - - [login()](#auth.login) ⇒ None - - [login_with_token(token)](#auth.login_with_token) ⇒ None - - [logout()](#auth.logout) ⇒ None - - [register()](#auth.register) ⇒ str - - [whoami()](#auth.whoami) ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] - - [.two_factor](#twofactorauth) - - [challenge(code)](#twofactorauth.challenge) ⇒ None - - [disable(password)](#twofactorauth.disable) ⇒ str - - [enable(code)](#twofactorauth.enable) ⇒ str - - [get_setup_key()](#twofactorauth.get_setup_key) ⇒ str - - [is_enabled()](#twofactorauth.is_enabled) ⇒ bool - - [is_passed()](#twofactorauth.is_passed) ⇒ bool - - [verify(code)](#twofactorauth.verify) ⇒ str - - [.logs](#logs) - - [history(uuid_or_id, count)](#logs.history) ⇒ List[Log] - - [stop()](#logs.stop) ⇒ None - - [subscribe(uuid_or_id, callback, error, count)](#logs.subscribe) ⇒ None - - [unsubscribe(uuid_or_id)](#logs.unsubscribe) ⇒ None - - [unsubscribe_all()](#logs.unsubscribe_all) ⇒ None - - [.settings](#module) - - [.types](#types) - -## Models +# Models This module implements all models for balena python SDK. -## Application +# Application This class implements application model for balena python SDK. - - -### Function: create(name, device_type, organization, application_class) ⇒ [TypeApplication](#typeapplication) +## create Create an application. -#### Args: +**Signature:** `balena.models.application.create(name, device_type, organization, application_class)` ⇒ [TypeApplication](#typeapplication) + +**Args:** name (str): application name. device_type (str): device type (slug). organization (Union[str, int]): handle or id of the organization that the application will belong to. application_class (Optional[Literal["app", "fleet", "block"]]): application class. -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.create('foo', 'raspberry-pi', 12345) >>> balena.models.application.create('foo', 'raspberry-pi', 12345, 'block') ``` - -### Function: disable_device_urls(slug_or_uuid_or_id) ⇒ None +## disable_device_urls Disable device urls for all devices that belong to an application. -#### Args: +**Signature:** `balena.models.application.disable_device_urls(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.disable_device_urls(5685) ``` - -### Function: enable_device_urls(slug_or_uuid_or_id) ⇒ None +## enable_device_urls Enable device urls for all devices that belong to an application -#### Args: +**Signature:** `balena.models.application.enable_device_urls(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.enable_device_urls(5685) ``` - -### Function: generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date) ⇒ str +## generate_provisioning_key Generate a device provisioning key for a specific application. -#### Args: +**Signature:** `balena.models.application.generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date)` ⇒ str + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) key_name (Optional[str]): provisioning key name. description (Optional[str]): description for provisioning key. expiry_date (Optional[str]): expiry date for provisioning key, for example: `2030-01-01T00:00:00Z`. -#### Returns: +**Returns:** str: device provisioning key. -#### Examples: +**Examples:** ```python >>> balena.models.application.generate_provisioning_key(5685) ``` - -### Function: get(slug_or_uuid_or_id, options, context) ⇒ [TypeApplication](#typeapplication) +## get Get a single application. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, options, context)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get("myorganization/myapp") >>> balena.models.application.get(123) ``` - -### Function: get_all(options, context) ⇒ [List[TypeApplication]](#typeapplication) +## get_all Get all applications -#### Args: +**Signature:** `balena.models.application.get_all(options, context)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all() ``` - -### Function: get_all_by_organization(org_handle_or_id, options) ⇒ [List[TypeApplication]](#typeapplication) +## get_all_by_organization Get all applications of an organization. -#### Args: +**Signature:** `balena.models.application.get_all_by_organization(org_handle_or_id, options)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** org_handle_or_id (Union[str, int]): handle or id of the organization. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all_by_organization('myorg') ``` - -### Function: get_all_directly_accessible(options) ⇒ [List[TypeApplication]](#typeapplication) +## get_all_directly_accessible Get all applications directly accessible by the user -#### Args: +**Signature:** `balena.models.application.get_all_directly_accessible(options)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[APIKeyType]: user API key -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all_directly_accessible() ``` - -### Function: get_by_name(app_name, options, context) ⇒ [TypeApplication](#typeapplication) +## get_by_name Get a single application using the appname. -#### Args: +**Signature:** `balena.models.application.get_by_name(app_name, options, context)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get("myapp") ``` - -### Function: get_dashboard_url(app_id) ⇒ str +## get_dashboard_url Get Dashboard URL for a specific application. -#### Args: +**Signature:** `balena.models.application.get_dashboard_url(app_id)` ⇒ str + +**Args:** app_id (int): application id. -#### Returns: +**Returns:** str: Dashboard URL for the specific application. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_dashboard_url(1476418) ``` - -### Function: get_directly_accessible(slug_or_uuid_or_id, options) ⇒ [TypeApplication](#typeapplication) +## get_directly_accessible Get a single application directly accessible by the user -#### Args: +**Signature:** `balena.models.application.get_directly_accessible(slug_or_uuid_or_id, options)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_directly_accessible("myorganization/myapp") >>> balena.models.application.get_directly_accessible(123) ``` - -### Function: get_id(slug_or_uuid_or_id) ⇒ int +## get_id Given an application slug or uuid or id, returns it numeric id. -#### Args: +**Signature:** `balena.models.application.get_id(slug_or_uuid_or_id)` ⇒ int + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** int: The id. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_dashboard_url(1476418) ``` - -### Function: get_target_release_hash(slug_or_uuid_or_id) ⇒ Optional[str] +## get_target_release_hash Get the hash of the current release for a specific application. -#### Args: +**Signature:** `balena.models.application.get_target_release_hash(slug_or_uuid_or_id)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** Optional[str]: The release hash of the current release or None. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_target_release_hash(5685) ``` - -### Function: get_with_device_service_details(slug_or_uuid_or_id, options) ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) +## get_with_device_service_details This method does not map exactly to the underlying model: it runs a larger prebuilt query, and reformats it into an easy to use and understand format. If you want more control, or to see the raw model directly, use `application.get(uuidOrId, options)` instead. -#### Args: +**Signature:** `balena.models.application.get_with_device_service_details(slug_or_uuid_or_id, options)` ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_with_device_service_details('my_org_handle/my_app_name') ``` - -### Function: grant_support_access(slug_or_uuid_or_id, expiry_timestamp) ⇒ None +## grant_support_access Grant support access to an application until a specified time. -#### Args: +**Signature:** `balena.models.application.grant_support_access(slug_or_uuid_or_id, expiry_timestamp)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Examples: +**Examples:** ```python >>> balena.models.application.grant_support_access(5685, 1511974999000) ``` - -### Function: has(slug_or_uuid_or_id) ⇒ bool +## has Check if an application exists. -#### Args: +**Signature:** `balena.models.application.has(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** bool: True if application exists, False otherwise. -#### Examples: +**Examples:** ```python >>> balena.models.application.has('my_org/foo') ``` - -### Function: has_any() ⇒ bool +## has_any Check if the user has any applications. -#### Returns: +**Signature:** `balena.models.application.has_any()` ⇒ bool + +**Returns:** bool: True if user has any applications, False otherwise. -#### Examples: +**Examples:** ```python >>> balena.models.application.has_any() ``` - -### Function: is_tracking_latest_release(slug_or_uuid_or_id) ⇒ bool +## is_tracking_latest_release Get whether the application is up to date and is tracking the latest finalized release for updates -#### Args: +**Signature:** `balena.models.application.is_tracking_latest_release(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Returns: +**Returns:** bool: is tracking the latest release. -#### Examples: +**Examples:** ```python >>> balena.models.application.is_tracking_latest_release(5685) ``` - -### Function: pin_to_release(slug_or_uuid_or_id, full_release_hash) ⇒ None +## pin_to_release Configures the application to run a particular release and not get updated when the latest release changes. -#### Args: +**Signature:** `balena.models.application.pin_to_release(slug_or_uuid_or_id, full_release_hash)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). full_release_hash (str) : the hash of a successful release (string) -#### Examples: +**Examples:** ```python >>> balena.models.application.set_to_release(5685, '7dba4e0c461215374edad74a5b78f470b894b5b7') ``` - -### Function: purge(app_id) ⇒ None +## purge Purge devices by application id -#### Args: +**Signature:** `balena.models.application.purge(app_id)` ⇒ None + +**Args:** app_id (int): application id (number) -#### Examples: +**Examples:** ```python >>> balena.models.application.purge(5685) ``` - -### Function: reboot(app_id, options) ⇒ None +## reboot Reboots devices by application id -#### Args: +**Signature:** `balena.models.application.reboot(app_id, options)` ⇒ None + +**Args:** app_id (int): application id (number) options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python >>> balena.models.application.reboot(5685) >>> balena.models.application.reboot(5685, {"force": True}) ``` - -### Function: remove(slug_or_uuid_or_id) ⇒ None +## remove Remove application. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.remove('my_org/my_app') >>> balena.models.application.remove('c184556293854781aea71b0bdae10e45') >>> balena.models.application.remove(123) ``` - -### Function: rename(slug_or_uuid_or_id, new_name) ⇒ None +## rename Rename application. -#### Args: +**Signature:** `balena.models.application.rename(slug_or_uuid_or_id, new_name)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). new_name (str): new application name. -#### Examples: +**Examples:** ```python >>> balena.models.application.rename(1681618, 'py-test-app') ``` - -### Function: restart(slug_or_uuid_or_id) ⇒ None +## restart Restart application. -#### Args: +**Signature:** `balena.models.application.restart(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.restart('myorg/RPI1') ``` - -### Function: revoke_support_access(slug_or_uuid_or_id) ⇒ None +## revoke_support_access Revoke support access to an application. -#### Args: +**Signature:** `balena.models.application.revoke_support_access(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.revoke_support_access(5685) ``` - -### Function: shutdown(app_id, options) ⇒ None +## shutdown Shutdown devices by application id -#### Args: +**Signature:** `balena.models.application.shutdown(app_id, options)` ⇒ None + +**Args:** app_id (int): application id (number) options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python >>> balena.models.application.shutdown(5685) >>> balena.models.application.shutdown(5685, {"force": True}) ``` - -### Function: track_latest_release(slug_or_uuid_or_id) ⇒ None +## track_latest_release Configure a specific application to track the latest available release. -#### Args: +**Signature:** `balena.models.application.track_latest_release(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Examples: +**Examples:** ```python >>> balena.models.application.track_latest_release(5685) ``` - -### Function: will_track_new_releases(slug_or_uuid_or_id) ⇒ bool +## will_track_new_releases Get whether the application is configured to receive updates whenever a new release is available. -#### Args: +**Signature:** `balena.models.application.will_track_new_releases(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Returns: +**Returns:** bool: is tracking the latest release. -#### Examples: +**Examples:** ```python >>> balena.models.application.will_track_new_releases(5685) ``` -## ApplicationTag -This class implements application tag model for balena python SDK. +# ApplicationTag - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +This class implements application tag model for balena python SDK. +## get_all_by_application Get all application tags for an application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.get_all_by_application(1005160) ``` - -### Function: remove(slug_or_uuid_or_id, tag_key) ⇒ None +## remove Remove an application tag. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, tag_key)` ⇒ None + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.remove(1005767, 'tag1') ``` - -### Function: set(slug_or_uuid_or_id, tag_key, value) ⇒ None +## set Set an application tag (update tag value if it exists). -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, tag_key, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) tag_key (str): tag key. value (str): tag value. -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.set(1005767, 'tag1', 'Python SDK') ``` -## ApplicationConfigVariable -This class implements application config variable model for balena python SDK. +# ApplicationConfigVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements application config variable model for balena python SDK. +## get Get application config variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.application.config_var.get('8deb12','test_env4') +>>> balena.models.application.config_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all application config variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application config variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.get_all_by_application(9020) ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an application config variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.remove(2184, 'test_env') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific application config variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.application.config_var.set('8deb12','test_env', 'testing1') +>>> balena.models.application.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env', 'testing1') ``` -## ApplicationEnvVariable -This class implements application environment variable model for balena python SDK. +# ApplicationEnvVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements application environment variable model for balena python SDK. +## get Get application environment variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.application.env_var.get('8deb12','test_env4') +>>> balena.models.application.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all application environment variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.get_all_by_application(9020) >>> balena.models.application.env_var.get_all_by_application("myorg/myslug") ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an application environment variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.remove(2184,'test_env4') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific application environment variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.application.env_var.set('8deb12','test_env4', 'testing1') +>>> balena.models.application.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') ``` -## BuildEnvVariable -This class implements build environment variable model for balena python SDK. +# BuildEnvVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements build environment variable model for balena python SDK. +## get Get build environment variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.application.build_var.get('8deb12','test_env4') +>>> balena.models.application.build_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all build environment variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: build environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.get_all_by_application(9020) >>> balena.models.application.build_var.get_all_by_application("myorg/myslug") ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an build environment variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.remove(2184, 'test_env4') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific build environment variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.application.build_var.set('8deb12','test_env4', 'testing1') +>>> balena.models.application.build_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') ``` -## ApplicationMembership -This class implements application membership model for balena python SDK. +# ApplicationMembership - -### Function: change_role(membership_id, role_name) ⇒ None +This class implements application membership model for balena python SDK. +## change_role Changes the role of an application member. -#### Args: +**Signature:** `balena.models.application.change_role(membership_id, role_name)` ⇒ None + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` numeric pair of the membership role_name (str): the role name to be granted to the membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.change_role(55074, 'observer') ``` - -### Function: create(slug_or_uuid_or_id, username, role_name) ⇒ [ApplicationMembershipType](#applicationmembershiptype) +## create Creates a new membership for an application. -#### Args: +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, username, role_name)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). username (str): the username of the balena user that will become a member. role_name (Optional[str]): the role name to be granted to the membership. -#### Returns: +**Returns:** ApplicationMembershipType: application membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.create(1681618, 'testuser') ``` - -### Function: get(membership_id, options) ⇒ [ApplicationMembershipType](#applicationmembershiptype) +## get Get a single application membership. -#### Args: +**Signature:** `balena.models.application.get(membership_id, options)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` numeric pair of the membership options (AnyObject): extra pine options to use -#### Returns: +**Returns:** ApplicationMembershipType: application membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get(55074) >>> balena.models.application.membership.get({"user": 123, "is_member_of__application": 125}) ``` - -### Function: get_all(options) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) +## get_all Get all application memberships. -#### Args: +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationMembershipType]: list contains info of application memberships. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) +## get_all_by_application Get all memberships by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: list contains info of application memberships. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get_all_by_application(1681618) ``` - -### Function: remove(membership_id) ⇒ None +## remove Remove a membership. -#### Args: +**Signature:** `balena.models.application.remove(membership_id)` ⇒ None + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` -## ApplicationInvite -This class implements application invite model for balena python SDK. +# ApplicationInvite - -### Function: accept(invite_token) ⇒ None +This class implements application invite model for balena python SDK. +## accept Accepts an invite. -#### Args: +**Signature:** `balena.models.application.accept(invite_token)` ⇒ None + +**Args:** invite_token (str): invitationToken - invite token. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.accept("qwerty-invitation-token") ``` - -### Function: create(slug_or_uuid_or_id, options) ⇒ [ApplicationInviteType](#applicationinvitetype) +## create Creates a new invite for an application. -#### Args: +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, options)` ⇒ [ApplicationInviteType](#applicationinvitetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (ApplicationInviteOptions): Application Invite options dict to use. invitee (str): the email/balena_username of the invitee. @@ -1156,200 +941,212 @@ Creates a new invite for an application. One of "observer", "developer", "operator". Defaults to "developer" message (Optional[str]): the message to send along with the invite. -#### Returns: +**Returns:** dict: application invite. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.create(1681618, 'invitee@example.org', 'developer', 'Test invite') ``` - -### Function: get_all(options) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) +## get_all Get all invites. -#### Args: +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) +## get_all_by_application Get all invites by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.get_all_by_application(1681618) ``` - -### Function: revoke(invite_id) ⇒ None +## revoke Revoke an invite. -#### Args: +**Signature:** `balena.models.application.revoke(invite_id)` ⇒ None + +**Args:** invite_id (int): application invite id. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.revoke(5860) ``` -## Device -This class implements device model for balena python SDK. +# Device - -### Function: deactivate(uuid_or_id_or_ids) ⇒ None +This class implements device model for balena python SDK. +## deactivate Deactivates a device. -#### Args: +**Signature:** `balena.models.device.deactivate(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.deactivate('44cc9d1861b9f992808c506276e5d31c') >>> balena.models.device.deactivate([123, 234]) ``` - -### Function: disable_device_url(uuid_or_id_or_ids) ⇒ None +## disable_device_url Disable device url for a device. -#### Args: +**Signature:** `balena.models.device.disable_device_url(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Examples: +**Examples:** ```python ->>> balena.models.device.disable_device_url('8deb12a58') +>>> balena.models.device.disable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.disable_device_url([123, 345]) ``` - -### Function: disable_local_mode(uuid_or_id) ⇒ None +## disable_local_mode Disable local mode. -#### Args: +**Signature:** `balena.models.device.disable_local_mode(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** None. -#### Examples: +**Examples:** ```python ->>> balena.models.device.disable_local_mode('b6070f4f') +>>> balena.models.device.disable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: disable_lock_override(uuid_or_id) ⇒ None +## disable_lock_override Disable lock override. -#### Args: +**Signature:** `balena.models.device.disable_lock_override(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: enable_device_url(uuid_or_id_or_ids) ⇒ None +## enable_device_url Enable device url for a device. -#### Args: +**Signature:** `balena.models.device.enable_device_url(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Examples: +**Examples:** ```python ->>> balena.models.device.enable_device_url('8deb12a58') +>>> balena.models.device.enable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.enable_device_url([123, 345]) ``` - -### Function: enable_local_mode(uuid_or_id) ⇒ None +## enable_local_mode Enable local mode. -#### Args: +**Signature:** `balena.models.device.enable_local_mode(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python ->>> balena.models.device.enable_local_mode('b6070f4f') +>>> balena.models.device.enable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: enable_lock_override(uuid_or_id) ⇒ None +## enable_lock_override Enable lock override. -#### Args: +**Signature:** `balena.models.device.enable_lock_override(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: generate_device_key(uuid_or_id, name, description, expiry_date) ⇒ str +## generate_device_key Generate a device key. -#### Args: +**Signature:** `balena.models.device.generate_device_key(uuid_or_id, name, description, expiry_date)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) name (Optional[str]): device key name. description (Optional[str]): description for device key. expiry_date (Optional[str]): expiry date for device key, for example: `2030-01-01T00:00:00Z`. -#### Examples: +**Examples:** ```python ->>> balena.models.device.generate_device_key('df0926') +>>> balena.models.device.generate_device_key('df0926d8a5cf4293a1b3742c98a500a1') ``` - -### Function: generate_uuid() ⇒ str +## generate_uuid Generate a random device UUID. -#### Returns: +**Signature:** `balena.models.device.generate_uuid()` ⇒ str + +**Returns:** str: a generated UUID. -#### Examples: +**Examples:** ```python >>> balena.models.device.generate_uuid() ``` - -### Function: get(uuid_or_id, options) ⇒ [TypeDevice](#typedevice) +## get This method returns a single device by id or uuid. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, options)` ⇒ [TypeDevice](#typedevice) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeDevice: device info. -#### Examples: +**Examples:** ```python >>> balena.models.device.get('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') ->>> balena.models.device.get('8deb12') +>>> balena.models.device.get('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.get(12345) ``` - -### Function: get_all(options) ⇒ [List[TypeDevice]](#typedevice) +## get_all This method returns all devices that the current user can access. In order to have the following computed properties in the result @@ -1358,658 +1155,720 @@ you have to explicitly define them in a `$select` in the extra options: - overall_progress - is_frozen -#### Args: +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[TypeDevice]](#typedevice) + +** Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[TypeDevice]](#typedevice) +## get_all_by_application Get devices by application slug, uuid or id. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all_by_application('my_org/RPI1') ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[TypeDevice]](#typedevice) +## get_all_by_organization Get devices by organization slug, uuid or id. -#### Args: +**Signature:** `balena.models.device.get_all_by_organization(handle_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all_by_organization('my_org') >>> balena.models.device.get_all_by_organization(123) ``` - -### Function: get_application_info(uuid_or_id) ⇒ Any +## get_application_info ***Deprecated*** Return information about the application running on the device. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.get_application_info(uuid_or_id)` ⇒ Any + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains application information. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_application_info('7f66ec') +>>> balena.models.device.get_application_info('7f66ec3c5da146c3b6a84aaed1c07581') ``` - -### Function: get_application_name(uuid_or_id) ⇒ str +## get_application_name Get application name by device uuid. -#### Args: +**Signature:** `balena.models.device.get_application_name(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: application name. - -### Function: get_by_name(name, options) ⇒ [List[TypeDevice]](#typedevice) +## get_by_name Get devices by device name. -#### Args: +**Signature:** `balena.models.device.get_by_name(name, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** name (str): device name. -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_by_name('floral-mountain') ``` - -### Function: get_dashboard_url(uuid) ⇒ None +## get_dashboard_url Get balena Dashboard URL for a specific device. -#### Args: +**Signature:** `balena.models.device.get_dashboard_url(uuid)` ⇒ None + +**Args:** uuid (str): device uuid. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_dashboard_url('19619a6317072b65a240b451f45f855d') ``` - -### Function: get_device_url(uuid_or_id) ⇒ str +## get_device_url Get a device url for a device. -#### Args: +**Signature:** `balena.models.device.get_device_url(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_device_url('8deb12a') +>>> balena.models.device.get_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: get_local_ip_address(uuid_or_id) ⇒ List[str] +## get_local_ip_address Get the local IP addresses of a device. -#### Args: +**Signature:** `balena.models.device.get_local_ip_address(uuid_or_id)` ⇒ List[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** List[str]: IP addresses of a device. - -### Function: get_local_mode_support(uuid_or_id) ⇒ LocalModeResponse +## get_local_mode_support Returns whether local mode is supported and a message describing the reason why local mode is not supported. -#### Args: +**Signature:** `balena.models.device.get_local_mode_support(uuid_or_id)` ⇒ LocalModeResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** dict: local mode support information ({'supported': True/False, 'message': '...'}). -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_local_mode_support('b6070f4') +>>> balena.models.device.get_local_mode_support('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_mac_address(uuid_or_id) ⇒ List[str] +## get_mac_address Get the MAC addresses of a device. -#### Args: +**Signature:** `balena.models.device.get_mac_address(uuid_or_id)` ⇒ List[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** List[str]: MAC addresses of a device. - -### Function: get_metrics(uuid_or_id) ⇒ [DeviceMetricsType](#devicemetricstype) +## get_metrics Gets the metrics related information for a device. -#### Args: +**Signature:** `balena.models.device.get_metrics(uuid_or_id)` ⇒ [DeviceMetricsType](#devicemetricstype) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** dict: metrics of the device. - -### Function: get_name(uuid_or_id) ⇒ str +## get_name Get device name by device uuid. -#### Args: +**Signature:** `balena.models.device.get_name(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: device name. - -### Function: get_os_update_status(uuid_or_id) ⇒ HUPStatusResponse +## get_os_update_status ***Deprecated*** Get the OS update status of a device. -#### Args: +**Signature:** `balena.models.device.get_os_update_status(uuid_or_id)` ⇒ HUPStatusResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** HUPStatusResponse: action response. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_os_update_status('b6070f4f') +>>> balena.models.device.get_os_update_status('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_status(uuid_or_id) ⇒ str +## get_status Get the status of a device. -#### Args: +**Signature:** `balena.models.device.get_status(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: status of a device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_status('8deb12') +>>> balena.models.device.get_status('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: get_supervisor_state(uuid_or_id) ⇒ SupervisorStateType +## get_supervisor_state Get the supervisor state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_state(uuid_or_id)` ⇒ SupervisorStateType + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Returns: +**Returns:** dict: supervisor state. -#### Examples: +**Examples:** ```python ->>> balena.models.device.get_supervisor_state('b6070f4fea') +>>> balena.models.device.get_supervisor_state('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_supervisor_target_state(uuid_or_id) ⇒ Any +## get_supervisor_target_state Get the supervisor target state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_target_state(uuid_or_id)` ⇒ Any + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int). -#### Returns: +**Returns:** DeviceStateType: supervisor target state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_target_state('b6070f4fea5edf808b576123157fe5ec') ``` - -### Function: get_supervisor_target_state_for_app(slug_or_uuid_or_id, release) ⇒ Any +## get_supervisor_target_state_for_app Get the supervisor target state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_target_state_for_app(slug_or_uuid_or_id, release)` ⇒ Any + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) release (Optional[Union[str, int]]): (optional) release uuid (default tracked) -#### Returns: +**Returns:** DeviceStateType: supervisor target state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_target_state_for_app('myorg/myapp') ``` - -### Function: get_with_service_details(uuid_or_id, options) ⇒ [TypeDeviceWithServices](#typedevicewithservices) +## get_with_service_details This method does not map exactly to the underlying model: it runs a larger prebuilt query, and reformats it into an easy to use and understand format. If you want more control, or to see the raw model directly, use `device.get(uuidOrId, options)` instead. -#### Args: +**Signature:** `balena.models.device.get_with_service_details(uuid_or_id, options)` ⇒ [TypeDeviceWithServices](#typedevicewithservices) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** dict: device info with associated services details. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_with_service_details('0fcd753af396247e035de53b4e43eec3') ``` - -### Function: grant_support_access(uuid_or_id_or_ids, expiry_timestamp) ⇒ None +## grant_support_access Grant support access to a device until a specified time. -#### Args: +**Signature:** `balena.models.device.grant_support_access(uuid_or_id_or_ids, expiry_timestamp)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Examples: +**Examples:** ```python ->>> balena.models.device.grant_support_access('49b2a7', 1511974999000) +>>> balena.models.device.grant_support_access('49b2a76e8a8d4a2b918c08a23b423580', 1511974999000) ``` - -### Function: has(uuid_or_id) ⇒ bool +## has Check if a device exists. -#### Args: +**Signature:** `balena.models.device.has(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if device exists, False otherwise. - -### Function: has_device_url(uuid_or_id) ⇒ bool +## has_device_url Check if a device is web accessible with device urls -#### Args: +**Signature:** `balena.models.device.has_device_url(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python ->>> balena.models.device.has_device_url('8deb12a') +>>> balena.models.device.has_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: has_lock_override(uuid_or_id) ⇒ bool +## has_lock_override Check if a device has the lock override enabled. -#### Args: +**Signature:** `balena.models.device.has_lock_override(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: lock override status. - -### Function: identify(uuid_or_id) ⇒ None +## identify Identify device. -#### Args: +**Signature:** `balena.models.device.identify(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.identify('8deb12a5') +>>> balena.models.device.identify('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: is_in_local_mode(uuid_or_id) ⇒ bool +## is_in_local_mode Check if local mode is enabled on the device. -#### Args: +**Signature:** `balena.models.device.is_in_local_mode(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if local mode enabled, otherwise False. -#### Examples: +**Examples:** ```python ->>> balena.models.device.is_in_local_mode('b6070f4f') +>>> balena.models.device.is_in_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: is_online(uuid_or_id) ⇒ bool +## is_online Check if a device is online. -#### Args: +**Signature:** `balena.models.device.is_online(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if the device is online, False otherwise. - -### Function: is_tracking_application_release(uuid_or_id) ⇒ bool +## is_tracking_application_release Get whether the device is configured to track the current application release. -#### Args: +**Signature:** `balena.models.device.is_tracking_application_release(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: is tracking the current application release. - -### Function: move(uuid_or_id, app_slug_or_uuid_or_id) ⇒ None +## move Move a device to another application. -#### Args: +**Signature:** `balena.models.device.move(uuid_or_id, app_slug_or_uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int). app_slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.device.move(123, 'RPI1Test') ``` - -### Function: pin_to_release(uuid_or_id, full_release_hash_or_id) ⇒ None +## pin_to_os_release + +Mark a specific device to be updated to a particular OS release + +**Signature:** `balena.models.device.pin_to_os_release(uuid_or_id, target_os_version)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int). + target_os_version (str): semver-compatible version for the target device. + Unsupported (unpublished) version will result in rejection. + The version **must** be the exact version number, a "prod" variant + and greater or equal to the one running on the device. + +**Examples:** +```python +>>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') +>>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') +``` + +## pin_to_release Configures the device to run a particular release and not get updated when the current application release changes. -#### Args: +**Signature:** `balena.models.device.pin_to_release(uuid_or_id, full_release_hash_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) full_release_hash_or_id (Union[str, int]) : the hash of a successful release (string) or id (number) -#### Examples: +**Examples:** +```python +>>> balena.models.device.pin_to_release('49b2a', '45c90004de73557ded7274d4896a6db90ea61e36') +``` + +## pin_to_supervisor_release + +Set a specific device to run a particular supervisor release. +**Signature:** `balena.models.device.pin_to_supervisor_release(uuid_or_id, supervisor_version_or_id)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + supervisor_version_or_id (Union[str, int]): the version of a released supervisor (string) or id (number) +**Examples:** ```python ->>> balena.models.device.set_to_release('49b2a', '45c90004de73557ded7274d4896a6db90ea61e36') +>>> balena.models.device.pin_to_supervisor_release('f55dcdd9ada04b11b4d05c1f1c3b4e72', 'v13.0.0') ``` - -### Function: ping(uuid_or_id) ⇒ None +## ping Ping a device. This is useful to signal that the supervisor is alive and responding. -#### Args: +**Signature:** `balena.models.device.ping(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.ping('8f66ec7') +>>> balena.models.device.ping('8f66ec7335dd4a97b7661faa131b1502') >>> balena.models.device.ping(1234) ``` - -### Function: purge(uuid_or_id) ⇒ None +## purge Purge device. This function clears the user application's `/data` directory. -#### Args: +**Signature:** `balena.models.device.purge(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.purge('8f66ec7') +>>> balena.models.device.purge('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: reboot(uuid_or_id, force) ⇒ None +## reboot Reboot the device. -#### Args: +**Signature:** `balena.models.device.reboot(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python ->>> balena.models.device.reboot('8f66ec7') +>>> balena.models.device.reboot('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: register(application_slug_or_uuid_or_id, uuid, device_type_slug) ⇒ RegisterResponse +## register Register a new device with a balena application. -#### Args: +**Signature:** `balena.models.device.register(application_slug_or_uuid_or_id, uuid, device_type_slug)` ⇒ RegisterResponse + +**Args:** application_slug_or_uuid_or_id (Union[int, str]): application slug (string), uuid (string) or id (number). uuid (str): device uuid. device_type_slug (Optional[str]): device type slug or alias. -#### Returns: +**Returns:** dict: dictionary contains device info. -#### Examples: +**Examples:** ```python >>> device_uuid = balena.models.device.generate_uuid() >>> balena.models.device.register('RPI1',device_uuid) ``` - -### Function: remove(uuid_or_id_or_ids) ⇒ None +## remove Remove device(s). -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) - -### Function: rename(uuid_or_id, new_name) ⇒ None +## rename Renames a device. -#### Args: +**Signature:** `balena.models.device.rename(uuid_or_id, new_name)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int) new_name (str): device new name. -#### Examples: +**Examples:** ```python >>> balena.models.device.rename(123, 'python-sdk-test-device') ``` - -### Function: restart_application(uuid_or_id) ⇒ None +## restart_application This function restarts the Docker container running the application on the device, but doesn't reboot the device itself. -#### Args: +**Signature:** `balena.models.device.restart_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python ->>> balena.models.device.restart_application('8deb12a58') +>>> balena.models.device.restart_application('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.restart_application(1234) ``` - -### Function: restart_service(uuid_or_id, image_id) ⇒ None +## restart_service Restart a service on device. -#### Args: +**Signature:** `balena.models.device.restart_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to restart -#### Examples: +**Examples:** ```python ->>> balena.models.device.restart_service('f3887b', 392229) +>>> balena.models.device.restart_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) >>> balena.models.device.restart_service(None, 392229) # if running on the device ``` - -### Function: revoke_support_access(uuid_or_id_or_ids) ⇒ None +## revoke_support_access Revoke support access to a device. -#### Args: +**Signature:** `balena.models.device.revoke_support_access(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python ->>> balena.models.device.revoke_support_access('49b2a7') +>>> balena.models.device.revoke_support_access('49b2a76e8a8d4a2b918c08a23b423580') ``` - -### Function: set_custom_location(uuid_or_id_or_ids, location) ⇒ None +## set_custom_location Set a custom location for a device. -#### Args: +**Signature:** `balena.models.device.set_custom_location(uuid_or_id_or_ids, location)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) location (dict): device custom location { 'latitude': Union[int,, str], 'longitude': Union[int, str]}. -#### Examples: +**Examples:** ```python >>> balena.models.device.set_custom_location(123, {'latitude': '21.032777','longitude': '105.831586'}) ``` - -### Function: set_note(uuid_or_id_or_ids, note) ⇒ None +## set_note Note a device. -#### Args: +**Signature:** `balena.models.device.set_note(uuid_or_id_or_ids, note)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) note (str): device note. -#### Examples: +**Examples:** ```python >>> balena.models.device.note(123, 'test note') ``` - -### Function: set_supervisor_release(uuid_or_id, supervisor_version_or_id) ⇒ None - -Set a specific device to run a particular supervisor release. -#### Args: - uuid_or_id (Union[str, int]): device uuid (string) or id (int) - supervisor_version_or_id (Union[str, int]): the version of a released supervisor (string) or id (number) -#### Examples: -```python ->>> balena.models.device.set_supervisor_release('f55dcdd9ad', 'v13.0.0') -``` - - -### Function: shutdown(uuid_or_id, force) ⇒ None +## shutdown Shutdown the device. -#### Args: +**Signature:** `balena.models.device.shutdown(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python ->>> balena.models.device.shutdown('8f66ec7') +>>> balena.models.device.shutdown('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: start_application(uuid_or_id) ⇒ None +## start_application ***Deprecated*** Starts a user application container, usually after it has been stopped with `stop_application()`. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.start_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains started application container id. -#### Examples: +**Examples:** ```python ->>> balena.models.device.start_application('8f66ec7') +>>> balena.models.device.start_application('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: start_os_update(uuid_or_id, target_os_version) ⇒ HUPStatusResponse +## start_os_update Start an OS update on a device. If using run_detached option, monitor progress with device.get() -- status, provisioning_state and provisioning_progress entries. -#### Args: +**Signature:** `balena.models.device.start_os_update(uuid_or_id, target_os_version)` ⇒ HUPStatusResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). target_os_version (str): semver-compatible version for the target device. Unsupported (unpublished) version will result in rejection. The version **must** be the exact version number, a "prod" variant and greater than the one running on the device. run_detached (Optional[bool]): run the update in detached mode. - Default behaviour is run_detached=False but is DEPRECATED and will be - removed in a future release. Use run_detached=True for more reliable updates. + Default behaviour is run_detached=True for more reliable updates. -#### Returns: +**Returns:** HUPStatusResponse: action response. -#### Examples: +**Examples:** ```python ->>> balena.models.device.start_os_update('b6070f4', '2.29.2+rev1.prod') ->>> balena.models.device.start_os_update('b6070f4', '2.89.0+rev1') ->>> balena.models.device.start_os_update('b6070f4', '2.89.0+rev1', run_detached=True) +>>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') +>>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') ``` - -### Function: start_service(uuid_or_id, image_id) ⇒ None +## start_service Start a service on device. -#### Args: +**Signature:** `balena.models.device.start_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to start -#### Examples: +**Examples:** ```python ->>> balena.models.device.start_service('f3887b1', 1234) +>>> balena.models.device.start_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 1234) >>> balena.models.device.start_service(None, 1234) # if running on the device ``` - -### Function: stop_application(uuid_or_id) ⇒ None +## stop_application ***Deprecated*** Temporarily stops a user application container. @@ -2017,438 +1876,466 @@ Application container will not be removed after invoking this function and a reboot or supervisor restart will cause the container to start again. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.stop_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains stopped application container id. -#### Examples: +**Examples:** ```python ->>> balena.models.device.stop_application('8f66ec') +>>> balena.models.device.stop_application('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: stop_service(uuid_or_id, image_id) ⇒ None +## stop_service Stop a service on device. -#### Args: +**Signature:** `balena.models.device.stop_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to stop -#### Examples: +**Examples:** ```python ->>> balena.models.device.stop_service('f3887b1', 392229) +>>> balena.models.device.stop_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) >>> balena.models.device.stop_service(None, 392229) # if running on the device ``` - -### Function: track_application_release(uuid_or_id_or_ids) ⇒ None +## track_application_release Configure a specific device to track the current application release. -#### Args: +**Signature:** `balena.models.device.track_application_release(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) - -### Function: unset_custom_location(uuid_or_id_or_ids) ⇒ None +## unset_custom_location Clear the custom location of a device. -#### Args: +**Signature:** `balena.models.device.unset_custom_location(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.unset_custom_location(123) ``` - -### Function: update(uuid_or_id, force) ⇒ None +## update update the device. -#### Args: +**Signature:** `balena.models.device.update(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python ->>> balena.models.device.update('8f66ec7') +>>> balena.models.device.update('8f66ec7335dd4a97b7661faa131b1502') ``` -## DeviceTag -This class implements device tag model for balena python SDK. +# DeviceTag - -### Function: get(uuid_or_id, tag_key) ⇒ Optional[str] +This class implements device tag model for balena python SDK. +## get Get a device tag (update tag value if it exists). ___Note___: Notice that when using the device ID rather than UUID, it will avoid one extra API roundtrip. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, tag_key)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. -#### Returns: +**Returns:** Optional[str]: tag value -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get('f5213eac0d63ac4', 'testtag') ``` - -### Function: get_all(options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all Get all device tags. -#### Args: +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_application Get all device tags for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all_by_application(1005160) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_device Get all device tags for a device. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python ->>> balena.models.device.tags.get_all_by_device('a03ab646c') +>>> balena.models.device.tags.get_all_by_device('a03ab646ca5a4f11b4d05c1f1c3b4e72') ``` - -### Function: remove(uuid_or_id, tag_key) ⇒ None +## remove Remove a device tag. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, tag_key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.remove('f5213eac0d63ac477', 'testtag') ``` - -### Function: set(uuid_or_id, tag_key, value) ⇒ None +## set Set a device tag (update tag value if it exists). ___Note___: Notice that when using the device ID rather than UUID, it will avoid one extra API roundtrip. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, tag_key, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test1') >>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test2') ``` -## DeviceConfigVariable -This class implements device config variable model for balena python SDK. +# DeviceConfigVariable - -### Function: get(uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements device config variable model for balena python SDK. +## get Get a device config variable. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.device.config_var.device.get('8deb12','test_env4') +>>> balena.models.device.config_var.device.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device config variables for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: list of device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.get_all_by_application(5780) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device config variables belong to a device. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device config variables. -#### Examples: +**Examples:** ```python ->>> balena.models.device.config_var.get_all_by_device('f5213ea') +>>> balena.models.device.config_var.get_all_by_device('f5213eac574a4fba8b9e32ab3a9cba12') ``` - -### Function: remove(uuid_or_id, key) ⇒ None +## remove Remove a device environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.remove(2184, 'test_env4') ``` - -### Function: set(uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a device config variable. Note that config variables must start with BALENA_ and RESIN_ prefixes. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.device.config_var.set('8deb12','BALENA_test_env4', 'testing1') +>>> balena.models.device.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','BALENA_test_env4', 'testing1') ``` -## DeviceEnvVariable -This class implements device environment variable model for balena python SDK. +# DeviceEnvVariable - -### Function: get(uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements device environment variable model for balena python SDK. +## get Get device environment variable. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python ->>> balena.models.device.env_var.get('8deb12', 'test_env4') +>>> balena.models.device.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device environment variables for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: list of device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.get_all_by_application(5780) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device environment variables. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device environment variables. -#### Examples: +**Examples:** ```python ->>> balena.models.device.env_var.get_all_by_device('8deb12a') +>>> balena.models.device.env_var.get_all_by_device('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: remove(uuid_or_id, key) ⇒ None +## remove Remove a device environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.remove(2184, 'test_env4') ``` - -### Function: set(uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific environment variable. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python ->>> balena.models.device.env_var.set('8deb12', 'test_env4', 'testing1') +>>> balena.models.device.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4', 'testing1') ``` -## DeviceServiceEnvVariable -This class implements device service variable model for balena python SDK. +# DeviceServiceEnvVariable - -### Function: get(uuid_or_id, service_name_or_id, key) ⇒ Optional[str] +This class implements device service variable model for balena python SDK. +## get Get the overriden value of a service variable on a device -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, service_name_or_id, key)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name -#### Returns: +**Returns:** Optional[str]: device service environment variables. -#### Examples: +**Examples:** ```python ->>> balena.models.device.service_var.get('8deb12a', 'myservice', 'VAR') ->>> balena.models.device.service_var.get('8deb12a', 1234', 'VAR') +>>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'myservice', 'VAR') +>>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 1234', 'VAR') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device service environment variables belong to an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get_all_by_application(1043050) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device environment variables. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get_all_by_device(8deb12a) ``` - -### Function: remove(uuid_or_id, service_name_or_id, key) ⇒ None +## remove Remove a device service environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, service_name_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name -#### Examples: +**Examples:** ```python ->>> balena.models.device.service_var.set('7cf02a6', 'myservice', 'VAR') ->>> balena.models.device.service_var.remove('7cf02a6', 28970, 'VAR') +>>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR') +>>> balena.models.device.service_var.remove('7cf02a6a016a4b3c9e3b7a8d5f46e127', 28970, 'VAR') ``` - -### Function: set(uuid_or_id, service_name_or_id, key, value) ⇒ None +## set Set the overriden value of a service variable on a device. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, service_name_or_id, key, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name value (str): variable value -#### Examples: +**Examples:** ```python ->>> balena.models.device.service_var.set('7cf02a6', 'myservice', 'VAR', 'override') ->>> balena.models.device.service_var.set('7cf02a6', 123, 'VAR', 'override') +>>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR', 'override') +>>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 123, 'VAR', 'override') ``` -## DeviceHistory -This class implements device history model for balena python SDK. +# DeviceHistory - -### Function: get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options) ⇒ [List[DeviceHistoryType]](#devicehistorytype) +This class implements device history model for balena python SDK. +## get_all_by_application Get all device history entries for an application. -#### Args: +**Signature:** `balena.models.history.get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago to_date (datetime): history entries younger or equal to this date. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[DeviceHistoryType]: device history entries. -#### Examples: +**Examples:** ```python >>> balena.models.device.history.get_all_by_application('myorg/myapp') >>> balena.models.device.history.get_all_by_application(11196426) @@ -2462,21 +2349,22 @@ Get all device history entries for an application. ... ) ``` - -### Function: get_all_by_device(uuid_or_id, from_date, to_date, options) ⇒ [List[DeviceHistoryType]](#devicehistorytype) +## get_all_by_device Get all device history entries for a device. -#### Args: +**Signature:** `balena.models.history.get_all_by_device(uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** uuid_or_id (str): device uuid (32 / 62 digits string) or id (number) __note__: No short IDs supported from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago to_date (datetime): history entries younger or equal to this date. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[DeviceHistoryType]: device history entries. -#### Examples: +**Examples:** ```python >>> balena.models.device.history.get_all_by_device('6046335305c8142883a4466d30abe211') >>> balena.models.device.history.get_all_by_device(11196426) @@ -2489,538 +2377,574 @@ Get all device history entries for a device. ... to_date=from_date = datetime.utcnow() + timedelta(days=-5)) ... ) ``` -## DeviceType -This class implements user API key model for balena python SDK. +# DeviceType - -### Function: get(id_or_slug, options) ⇒ [DeviceTypeType](#devicetypetype) +This class implements user API key model for balena python SDK. +## get Get a single device type. -#### Args: +**Signature:** `balena.models.device_type.get(id_or_slug, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** id_or_slug (Union[str, int]): device type slug or alias (string) or id (int). options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** DeviceTypeType: Returns the device type - -### Function: get_all(options) ⇒ [List[DeviceTypeType]](#devicetypetype) +## get_all Get all device types. -#### Args: +**Signature:** `balena.models.device_type.get_all(options)` ⇒ [List[DeviceTypeType]](#devicetypetype) + +**Args:** options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[DeviceTypeType]: list contains info of device types. - -### Function: get_all_supported(options) ⇒ None +## get_all_supported Get all supported device types. -#### Args: +**Signature:** `balena.models.device_type.get_all_supported(options)` ⇒ None + +**Args:** options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[DeviceTypeType]: list contains info of all supported device types. - -### Function: get_by_slug_or_name(slug_or_name, options) ⇒ [DeviceTypeType](#devicetypetype) +## get_by_slug_or_name Get a single device type by slug or name. -#### Args: +**Signature:** `balena.models.device_type.get_by_slug_or_name(slug_or_name, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** slug_or_name (str): device type slug or name. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** DeviceTypeType: Returns the device type - -### Function: get_name(slug) ⇒ str +## get_name Get display name for a device. -#### Args: +**Signature:** `balena.models.device_type.get_name(slug)` ⇒ str + +**Args:** slug (str): device type slug. - -### Function: get_slug_by_name(name) ⇒ str +## get_slug_by_name Get device slug. -#### Args: +**Signature:** `balena.models.device_type.get_slug_by_name(name)` ⇒ str + +**Args:** name (str): device type name. -## ApiKey -This class implements user API key model for balena python SDK. +# ApiKey - -### Function: create(name, description, expiry_date) ⇒ str +This class implements user API key model for balena python SDK. +## create This method registers a new api key for the current user with the name given. -#### Args: +**Signature:** `balena.models.api_key.create(name, description, expiry_date)` ⇒ str + +**Args:** name (str): the API key name description (Optional[str]): the API key description expiry_date (Optional[str]): the API key expiring date -#### Returns: +**Returns:** str: API key -#### Examples: +**Examples:** ```python >>> balena.models.api_key.create_api_key("myApiKey") >>> balena.models.api_key.create_api_key("myApiKey", "my api key description") >>> balena.models.api_key.create_api_key("myApiKey", "my descr", datetime.datetime.utcnow().isoformat()) ``` - -### Function: get_all(options) ⇒ [List[APIKeyType]](#apikeytype) +## get_all This function gets all API keys. -#### Args: +**Signature:** `balena.models.api_key.get_all(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[APIKeyType]: user API key -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_all() ``` - -### Function: get_all_named_user_api_keys(options) ⇒ [List[APIKeyType]](#apikeytype) +## get_all_named_user_api_keys Get all named user API keys of the current user. -#### Args: +**Signature:** `balena.models.api_key.get_all_named_user_api_keys(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_all_named_user_api_keys() ``` - -### Function: get_device_api_keys_by_device(uuid_or_id, options) ⇒ [List[APIKeyType]](#apikeytype) +## get_device_api_keys_by_device Get all API keys for a device. -#### Args: +**Signature:** `balena.models.api_key.get_device_api_keys_by_device(uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** device_uuid (Union[str, int]): device, uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_device_api_keys_by_device("44cc9d186") >>> balena.models.api_key.get_device_api_keys_by_device(1111386) ``` - -### Function: get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options) ⇒ [List[APIKeyType]](#apikeytype) +## get_provisioning_api_keys_by_application Get all provisioning API keys for an application. -#### Args: +**Signature:** `balena.models.api_key.get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_provisioning_api_keys_by_application(1296047) >>> balena.models.api_key.get_provisioning_api_keys_by_application("myorg/myapp") ``` - -### Function: revoke(id) ⇒ None +## revoke This function revokes an API key. -#### Args: +**Signature:** `balena.models.api_key.revoke(id)` ⇒ None + +**Args:** id (int): API key id. -#### Examples: +**Examples:** ```python >>> balena.models.api_key.revoke(1296047) ``` - -### Function: update(id, api_key_info) ⇒ None +## update This function updates details of an API key. -#### Args: +**Signature:** `balena.models.api_key.update(id, api_key_info)` ⇒ None + +**Args:** id (str): API key id. api_key_info (APIKeyInfoType): new API key info. -#### Examples: +**Examples:** ```python >>> balena.models.api_key.update(1296047, {"name":"new name"}) ``` -## Key -This class implements ssh key model for balena python SDK. +# Key - -### Function: create(title, key) ⇒ [SSHKeyType](#sshkeytype) +This class implements ssh key model for balena python SDK. +## create Create a ssh key. -#### Args: +**Signature:** `balena.models.key.create(title, key)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** title (str): key title. key (str): the public ssh key. -#### Returns: +**Returns:** SSHKeyType: new ssh key id. - -### Function: get(id) ⇒ [SSHKeyType](#sshkeytype) +## get Get a single ssh key. -#### Args: +**Signature:** `balena.models.key.get(id)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** id (int): key id. -#### Returns: +**Returns:** SSHKeyType: ssh key info. - -### Function: get_all(options) ⇒ [List[SSHKeyType]](#sshkeytype) +## get_all Get all ssh keys. -#### Args: +**Signature:** `balena.models.key.get_all(options)` ⇒ [List[SSHKeyType]](#sshkeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[SSHKeyType]: list of ssh keys. - -### Function: remove(id) ⇒ None +## remove Remove a ssh key. -#### Args: +**Signature:** `balena.models.key.remove(id)` ⇒ None + +**Args:** id (int): key id. -## Organization -This class implements organization model for balena python SDK. +# Organization - -### Function: create(name, handle, logo_image) ⇒ [OrganizationType](#organizationtype) +This class implements organization model for balena python SDK. +## create Creates a new organization. -#### Args: +**Signature:** `balena.models.organization.create(name, handle, logo_image)` ⇒ [OrganizationType](#organizationtype) + +**Args:** name (str): the name of the organization that will be created. handle (Optional[str]): The handle of the organization that will be created. logo_image (Optional[io.BufferedReader]): The organization logo to be used. -#### Returns: +**Returns:** dict: organization info. -#### Examples: +**Examples:** ```python >>> balena.models.organization.create('My Org', 'test_org') >>> with open('mypath/myfile.png', 'rb') as f: >>> org = sdk.models.organization.create("my-name", None, f) ``` - -### Function: get(handle_or_id, options) ⇒ [OrganizationType](#organizationtype) +## get Get a single organization. -#### Args: +**Signature:** `balena.models.organization.get(handle_or_id, options)` ⇒ [OrganizationType](#organizationtype) + +**Args:** handle_or_id (str): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** dict: organization info. -#### Raises: +**Raises:** OrganizationNotFound: if organization couldn't be found. -#### Examples: +**Examples:** ```python >>> balena.models.organization.get(26474) >>> balena.models.organization.get('myorg') ``` - -### Function: get_all(options) ⇒ [List[OrganizationType]](#organizationtype) +## get_all Get all organizations. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationType]](#organizationtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationType]: list contains information of organizations. -#### Examples: +**Examples:** ```python >>> balena.models.organization.get_all() ``` - -### Function: remove(handle_or_id) ⇒ None +## remove Remove an organization. -#### Args: +**Signature:** `balena.models.organization.remove(handle_or_id)` ⇒ None + +**Args:** handle_or_id (str): organization handle (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.organization.remove(148003) ``` -## OrganizationMembership -This class implements organization membership model for balena python SDK. +# OrganizationMembership - -### Function: get(membership_id, options) ⇒ [OrganizationMembershipType](#organizationmembershiptype) +This class implements organization membership model for balena python SDK. +## get Get a single organization membership. -#### Args: +**Signature:** `balena.models.organization.get(membership_id, options)` ⇒ [OrganizationMembershipType](#organizationmembershiptype) + +**Args:** membership_id (ResourceKey): the id (int) or an object with the unique `user` & `is_member_of__organization` numeric pair of the membership options (AnyObject): extra pine options to use -#### Returns: +**Returns:** Organization membership. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.get(17608) ``` - -### Function: get_all(options) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) +## get_all Get all organization memberships. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipType]: organization memberships. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) +## get_all_by_organization Get all memberships by organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipType]: organization memberships. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.get_all_by_organization(3014) ``` -## OrganizationMembershipTag -This class implements organization membership tag model for balena python SDK. +# OrganizationMembershipTag - -### Function: get(membership_id, tag_key) ⇒ Optional[str] +This class implements organization membership tag model for balena python SDK. +## get Get an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.get(membership_id, tag_key)` ⇒ Optional[str] + +**Args:** membership_id: organization membership id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get(17608, 'mTag1') ``` - -### Function: get_all(options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all Get all organization membership tags. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all_by_organization Get all organization membership tags for an organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipTagType]: organization membership tags. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all_by_organization(3014) ``` - -### Function: get_all_by_organization_membership(membership_id, options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all_by_organization_membership Get all organization membership tags for a memberships of an organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization_membership(membership_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** membership_id (int): organization membership id. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: organization membership tags. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all_by_organization_membership(17608) ``` - -### Function: remove(membership_id, tag_key) ⇒ None +## remove Remove an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.remove(membership_id, tag_key)` ⇒ None + +**Args:** membership_id: organization membership id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.remove(17608, 'mTag1') ``` - -### Function: set(membership_id, tag_key, value) ⇒ None +## set Set an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.set(membership_id, tag_key, value)` ⇒ None + +**Args:** membership_id: organization membership id. tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.set(17608, 'mTag1', 'Python SDK') ``` -## OrganizationInvite -This class implements organization invite model for balena python SDK. +# OrganizationInvite - -### Function: accept(invite_token) ⇒ None +This class implements organization invite model for balena python SDK. +## accept Accepts an invite. -#### Args: +**Signature:** `balena.models.organization.accept(invite_token)` ⇒ None + +**Args:** invite_token (str): invitation Token - invite token. - -### Function: create(handle_or_id, invitee, role_name, message) ⇒ [OrganizationInviteType](#organizationinvitetype) +## create Creates a new invite for an organization. -#### Args: +**Signature:** `balena.models.organization.create(handle_or_id, invitee, role_name, message)` ⇒ [OrganizationInviteType](#organizationinvitetype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string), or id (number). invitee (str): the email/balena_username of the invitee. role_name (Optional[str]): the role name to be granted to the invitee. message (Optional[str]): the message to send along with the invite. -#### Returns: +**Returns:** OrganizationInviteType: organization invite. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.create(26474, 'invitee@example.org', 'member', 'Test invite') ``` - -### Function: get_all(options) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) +## get_all Get all invites. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) +## get_all_by_organization Get all invites by organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string), or id (number). options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[OrganizationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.get_all_by_organization(26474) ``` - -### Function: revoke(invite_id) ⇒ None +## revoke Revoke an invite. -#### Args: +**Signature:** `balena.models.organization.revoke(invite_id)` ⇒ None + +**Args:** invite_id (int): organization invite id. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.revoke(2862) ``` -## DeviceOs -This class implements device os model for balena python SDK. +# DeviceOs - -### Function: download(device_type, version, options) ⇒ None +This class implements device os model for balena python SDK. +## download Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.download(device_type, version, options)` ⇒ None + +**Args:** device_type (str): device type slug. version (str): semver-compatible version or 'latest', defaults to 'latest'. * The version **must** be the exact version number. options (DownloadConfig): OS configuration options to use. -#### Returns: +**Returns:** float: OS image download size, in bytes. Example: @@ -3032,35 +2956,38 @@ Example: ... f.write(chunk) ``` - -### Function: get_all_os_versions(device_type, options) ⇒ None +## get_all_os_versions Get all OS versions for the provided device type(s), inlcuding invalidated ones -#### Args: +**Signature:** `balena.models.os.get_all_os_versions(device_type, options)` ⇒ None + +**Args:** device_type (Union[str, List[str]]): device type slug. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: balenaOS versions. - -### Function: get_available_os_versions(device_type) ⇒ None +## get_available_os_versions Get the supported OS versions for the provided device type(s) -#### Args: +**Signature:** `balena.models.os.get_available_os_versions(device_type)` ⇒ None + +**Args:** device_type (Union[str, List[str]]): device type slug. -#### Returns: +**Returns:** list: balenaOS versions. - -### Function: get_config(slug_or_uuid_or_id, options) ⇒ None +## get_config Download application config.json. -#### Args: +**Signature:** `balena.models.os.get_config(slug_or_uuid_or_id, options)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (ImgConfigOptions): OS configuration dict to use. The available options are listed below: @@ -3078,31 +3005,33 @@ Download application config.json. version (str): Required: the OS version of the image. developmentMode (Optional[bool]): If the device should be in development mode. -#### Returns: +**Returns:** dict: application config.json content. -#### Raises: +**Raises:** ApplicationNotFound: if application couldn't be found. - -### Function: get_download_size(device_type, version) ⇒ float +## get_download_size Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.get_download_size(device_type, version)` ⇒ float + +**Args:** device_type (str): device type slug. version (str): semver-compatible version or 'latest', defaults to 'latest'. * The version **must** be the exact version number. -#### Returns: +**Returns:** float: OS image download size, in bytes. - -### Function: get_max_satisfying_version(device_type, version_or_range, os_type) ⇒ Optional[str] +## get_max_satisfying_version Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.get_max_satisfying_version(device_type, version_or_range, os_type)` ⇒ Optional[str] + +**Args:** device_type (str): device type slug. version_or_range (str): can be one of the exact version number, in which case it is returned if the version is supported, @@ -3119,19 +3048,20 @@ Get OS download size estimate. Currently only the raw (uncompressed) size is rep Defaults to `'latest'` os_type (Optional[Literal["default", "esr"]]): The used OS type. -#### Returns: +**Returns:** float: OS image download size, in bytes. - -### Function: get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options) ⇒ [List[ReleaseType]](#releasetype) +## get_supervisor_releases_for_cpu_architecture Returns the Releases of the supervisor for the CPU Architecture -#### Args: +**Signature:** `balena.models.os.get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** cpu_architecture_slug_or_id (Union[str, int]): The slug (string) or id (number) for the CPU Architecture. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** ReleaseType: release info. @@ -3142,463 +3072,496 @@ Example: { $filter: { raw_version: '12.11.0' } }, ); - -### Function: get_supported_os_update_versions(device_type, current_version) ⇒ None +## get_supported_os_update_versions Get OS supported versions. -#### Args: +**Signature:** `balena.models.os.get_supported_os_update_versions(device_type, current_version)` ⇒ None + +**Args:** device_type (str): device type slug. current_version (str): device type slug. - -### Function: is_architecture_compatible_with(os_architecture, application_architecture) ⇒ None +## is_architecture_compatible_with Returns whether the specified OS architecture is compatible with the target architecture. -#### Args: +**Signature:** `balena.models.os.is_architecture_compatible_with(os_architecture, application_architecture)` ⇒ None + +**Args:** os_architecture (str): The OS's architecture as specified in its device type. application_architecture (str): The application's architecture as specified in its device type. -#### Returns: +**Returns:** bool: Whether the specified OS architecture is capable of running applications build for the target architecture. - -### Function: is_supported_os_update(device_type, current_version, target_version) ⇒ bool +## is_supported_os_update Returns the supported OS update targets for the provided device type. -#### Args: +**Signature:** `balena.models.os.is_supported_os_update(device_type, current_version, target_version)` ⇒ bool + +**Args:** device_type (str): device type slug. current_version (str): emver-compatible version for the starting OS version target_version (str): semver-compatible version for the target OS version -## Config -This class implements configuration model for balena python SDK. +# Config - -### Function: get_all() ⇒ ConfigType +This class implements configuration model for balena python SDK. +## get_all Get all configuration. -#### Returns: +**Signature:** `balena.models.config.get_all()` ⇒ ConfigType + +**Returns:** ConfigType: configuration information. -#### Examples: +**Examples:** ```python >>> balena.models.config.get_all() ``` -## Release -This class implements release model for balena python SDK. +# Release - -### Function: create_from_url(slug_or_uuid_or_id, url, flatten_tarball) ⇒ int +This class implements release model for balena python SDK. +## create_from_url Create a new release built from the source in the provided url. -#### Args: +**Signature:** `balena.models.release.create_from_url(slug_or_uuid_or_id, url, flatten_tarball)` ⇒ int + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). url (str): a url with a tarball of the project to build. flatten_tarball (bool): Should be true when the tarball includes an extra root folder with all the content. -#### Returns: +**Returns:** int: release Id. - -### Function: finalize(commit_or_id_or_raw_version) ⇒ None +## finalize Finalizes a draft release. -#### Args: +**Signature:** `balena.models.release.finalize(commit_or_id_or_raw_version)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) - -### Function: get(commit_or_id_or_raw_version, options) ⇒ [ReleaseType](#releasetype) +## get Get a specific release. -#### Args: +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, options)` ⇒ [ReleaseType](#releasetype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or id (number) or an object with the unique `application` (number or string) & `rawVersion` (string) pair of the release options options(AnyObject): extra pine options to use -#### Returns: +**Returns:** ReleaseType: release info. - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ReleaseType]](#releasetype) +## get_all_by_application Get all releases from an application. -#### Args: +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ReleaseType]: release info. - -### Function: get_latest_by_application(slug_or_uuid_or_id, options) ⇒ [Optional[ReleaseType]](#releasetype) +## get_latest_by_application Get the latest successful release for an application. -#### Args: +**Signature:** `balena.models.release.get_latest_by_application(slug_or_uuid_or_id, options)` ⇒ [Optional[ReleaseType]](#releasetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** Optional[ReleaseType]: release info. - -### Function: get_with_image_details(commit_or_id_or_raw_version, image_options, release_options) ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) +## get_with_image_details Get a specific release with the details of the images built. -#### Args: +**Signature:** `balena.models.release.get_with_image_details(commit_or_id_or_raw_version, image_options, release_options)` ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) image_options (AnyObject): extra pine options to use on image expand release_options (AnyObject): extra pine options to use on release expand -#### Returns: +**Returns:** dict: release info. -#### Raises: +**Raises:** ReleaseNotFound: if release couldn't be found. - -### Function: set_is_invalidated(commit_or_id_or_raw_version, is_invalidated) ⇒ None +## set_is_invalidated Set the is_invalidated property of a release to True or False. -#### Args: +**Signature:** `balena.models.release.set_is_invalidated(commit_or_id_or_raw_version, is_invalidated)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) is_invalidated (bool): True for invalidated, False for validated. - -### Function: set_known_issue_list(commit_or_id_or_raw_version, known_issue_list) ⇒ None +## set_known_issue_list Set a known issue list for a release. -#### Args: +**Signature:** `balena.models.release.set_known_issue_list(commit_or_id_or_raw_version, known_issue_list)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) known_issue_list (Optional[str]): the known issue list. - -### Function: set_note(commit_or_id_or_raw_version, note) ⇒ None +## set_note Set a note for a release. -#### Args: +**Signature:** `balena.models.release.set_note(commit_or_id_or_raw_version, note)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) note (Optional[str]): the note. - -### Function: set_release_version(commit_or_id, semver) ⇒ None +## set_release_version Set a direct semver for a given release. -#### Args: +**Signature:** `balena.models.release.set_release_version(commit_or_id, semver)` ⇒ None + +**Args:** commit_or_id(Union[str, int]): release commit (string) or id (int) semver (str): the version to be released, must be a valid semver -## ReleaseTag -This class implements release tag model for balena python SDK. +# ReleaseTag - -### Function: get(commit_or_id_or_raw_version, tag_key) ⇒ Optional[str] +This class implements release tag model for balena python SDK. +## get Get a single release tag. -#### Args: +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, tag_key)` ⇒ Optional[str] + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get(465307, 'releaseTag1') ``` - -### Function: get_all(options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all Get all release tags. -#### Args: +**Signature:** `balena.models.release.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_application Get all device tags for an application. -#### Args: +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all_by_application(1005160) ``` - -### Function: get_all_by_release(commit_or_id_or_raw_version, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_release Get all release tags for a release. -#### Args: +**Signature:** `balena.models.release.get_all_by_release(commit_or_id_or_raw_version, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all_by_release(135) ``` - -### Function: remove(commit_or_id_or_raw_version, tag_key) ⇒ None +## remove Remove a release tag. -#### Args: +**Signature:** `balena.models.release.remove(commit_or_id_or_raw_version, tag_key)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.remove(135, 'releaseTag1') ``` - -### Function: set(commit_or_id_or_raw_version, tag_key, value) ⇒ None +## set Set a release tag (update tag value if it exists). -#### Args: +**Signature:** `balena.models.release.set(commit_or_id_or_raw_version, tag_key, value)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.set(465307, 'releaseTag1', 'Python SDK') ``` -## Service -This class implements service model for balena python SDK. +# Service - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ServiceType]](#servicetype) +This class implements service model for balena python SDK. +## get_all_by_application Get all services from an application. -#### Args: +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ServiceType]](#servicetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ServiceType]: service info. -## ServiceEnvVariable -This class implements Service environment variable model for balena python SDK. +# ServiceEnvVariable - -### Function: get(service_id_or_natural_key, key) ⇒ Optional[str] +This class implements Service environment variable model for balena python SDK. +## get Get the value of a specific service variable -#### Args: +**Signature:** `balena.models.service.get(service_id_or_natural_key, key)` ⇒ Optional[str] + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get(1234,'test_env4') >>> balena.models.service.var.get({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all service variables by application. -#### Args: +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get_all_by_application(9020) >>> balena.models.service.var.get_all_by_application("myorg/myslug") ``` - -### Function: get_all_by_service(service_id_or_natural_key, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_service Get all variables for a service. -#### Args: +**Signature:** `balena.models.service.get_all_by_service(service_id_or_natural_key, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get_all_by_service(1234) >>> balena.models.service.var.get_all_by_service({'application': 'myorg/myapp', 'service_name': 'service'}) ``` - -### Function: remove(service_id_or_natural_key, key) ⇒ None +## remove Clear the value of a specific service variable -#### Args: +**Signature:** `balena.models.service.remove(service_id_or_natural_key, key)` ⇒ None + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.service.var.remove({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') >>> balena.models.service.var.remove(1234,'test_env4') ``` - -### Function: set(service_id_or_natural_key, key, value) ⇒ None +## set Set the value of a specific application environment variable. -#### Args: +**Signature:** `balena.models.service.set(service_id_or_natural_key, key, value)` ⇒ None + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.set({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR', 'value') >>> balena.models.service.var.set(1234,'test_env4', 'value') ``` -## Image -This class implements image model for balena python SDK. +# Image - -### Function: get(id, options) ⇒ [ImageType](#imagetype) +This class implements image model for balena python SDK. +## get Get a specific image. -#### Args: +**Signature:** `balena.models.image.get(id, options)` ⇒ [ImageType](#imagetype) + +**Args:** id (int): image id. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** ImageType: image info. - -### Function: get_logs(id) ⇒ str +## get_logs Get the build log from an image. -#### Args: +**Signature:** `balena.models.image.get_logs(id)` ⇒ str + +**Args:** id (str): image id. -#### Returns: +**Returns:** str: build log. -## Auth -This class implements all authentication functions for balena python SDK. +# Auth - -### Function: authenticate() ⇒ str +This class implements all authentication functions for balena python SDK. +## authenticate This function authenticates provided credentials information. You should use Auth.login when possible, as it takes care of saving the Auth Token and username as well. -#### Args: +**Signature:** `balena.auth.authenticate()` ⇒ str + +**Args:** **credentials: credentials keyword arguments. username (str): Balena username. password (str): Password. -#### Returns: +**Returns:** str: Auth Token, -#### Examples: +**Examples:** ```python >>> balena.auth.authenticate(username='', password='') ``` - -### Function: get_actor_id() ⇒ int +## get_actor_id Get current logged in actor id. -#### Returns: +**Signature:** `balena.auth.get_actor_id()` ⇒ int + +**Returns:** int: actor id -#### Examples: +**Examples:** ```python # If you are logged in. >>> balena.auth.get_actor_id() ``` - -### Function: get_token() ⇒ Optional[str] +## get_token This function retrieves Auth Token. -#### Returns: +**Signature:** `balena.auth.get_token()` ⇒ Optional[str] + +**Returns:** str: Auth Token. -#### Examples: +**Examples:** ```python >>> balena.auth.get_token() ``` - -### Function: get_user_info() ⇒ UserInfo +## get_user_info Get current logged in user's info -#### Returns: +**Signature:** `balena.auth.get_user_info()` ⇒ UserInfo + +**Returns:** UserInfo: user info. -#### Examples: +**Examples:** ```python # If you are logged in as a user. >>> balena.auth.get_user_info() ``` - -### Function: is_logged_in() ⇒ bool +## is_logged_in This function checks if you're logged in -#### Returns: +**Signature:** `balena.auth.is_logged_in()` ⇒ bool + +**Returns:** bool: True if logged in, False otherwise. -#### Examples: +**Examples:** ```python # Check if user logged in. >>> if balena.auth.is_logged_in(): @@ -3607,17 +3570,18 @@ This function checks if you're logged in ... print('You are not logged in!') ``` - -### Function: login() ⇒ None +## login This function is used for logging into balena using email and password. -#### Args: +**Signature:** `balena.auth.login()` ⇒ None + +**Args:** **credentials: credentials keyword arguments. username (str): Balena email. password (str): Password. -#### Examples: +**Examples:** ```python >>> from balena import Balena ... balena = Balena() @@ -3627,19 +3591,20 @@ This function is used for logging into balena using email and password. ... balena.auth.login(username='', password='') ``` - -### Function: login_with_token(token) ⇒ None +## login_with_token This function is used for logging into balena using Auth Token. Auth Token can be found in Preferences section on balena Dashboard. -#### Args: +**Signature:** `balena.auth.login_with_token(token)` ⇒ None + +**Args:** token (str): Auth Token. -#### Returns: +**Returns:** This functions saves Auth Token to Settings and returns nothing. -#### Examples: +**Examples:** ```python >>> from balena import Balena >>> balena = Balena() @@ -3647,63 +3612,67 @@ Auth Token can be found in Preferences section on balena Dashboard. >>> balena.auth.login_with_token(auth_token) ``` - -### Function: logout() ⇒ None +## logout This function is used for logging out from balena. -#### Examples: +**Signature:** `balena.auth.logout()` ⇒ None + +**Examples:** ```python # If you are logged in. >>> balena.auth.logout() ``` - -### Function: register() ⇒ str +## register This function is used for registering to balena. -#### Args: +**Signature:** `balena.auth.register()` ⇒ str + +**Args:** **credentials: credentials keyword arguments. email (str): email to register. password (str): Password. -#### Returns: +**Returns:** str: Auth Token for new account. -#### Examples: +**Examples:** ```python >>> credentials = {'email': '', 'password': ''} >>> balena.auth.register(**credentials) ``` - -### Function: whoami() ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] +## whoami Return current logged in username. -#### Returns: +**Signature:** `balena.auth.whoami()` ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] + +**Returns:** Optional[WhoamiResult]: current logged in information -#### Examples: +**Examples:** ```python >>> balena.auth.whoami() ``` -## TwoFactorAuth -This class implements basic 2FA functionalities for balena python SDK. +# TwoFactorAuth - -### Function: challenge(code) ⇒ None +This class implements basic 2FA functionalities for balena python SDK. +## challenge Challenge two-factor authentication. If your account has two-factor authentication enabled and logging in using credentials, you need to pass two-factor authentication before being allowed to use other functions. -#### Args: +**Signature:** `balena.twofactor_auth.challenge(code)` ⇒ None + +**Args:** code (str): two-factor authentication code. -#### Examples: +**Examples:** ```python # You need to enable two-factor authentication on dashboard first. # Check if two-factor authentication is passed for current session. @@ -3715,146 +3684,158 @@ False True ``` - -### Function: disable(password) ⇒ str +## disable Disable two factor authentication. __Note__: Disable will only work when using a token that has 2FA enabled. -#### Args: +**Signature:** `balena.twofactor_auth.disable(password)` ⇒ str + +**Args:** password (str): password. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.disable('your_password') ``` - -### Function: enable(code) ⇒ str +## enable Enable two factor authentication. -#### Args: +**Signature:** `balena.twofactor_auth.enable(code)` ⇒ str + +**Args:** code (str): two-factor authentication code. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.enable('123456') ``` - -### Function: get_setup_key() ⇒ str +## get_setup_key Retrieves a setup key for enabling two factor authentication. This value should be provided to your 2FA app in order to get a token. This function only works if you disable two-factor authentication or log in using Auth Token from dashboard. -#### Returns: +**Signature:** `balena.twofactor_auth.get_setup_key()` ⇒ str + +**Returns:** str: setup key. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.get_setup_key() ``` - -### Function: is_enabled() ⇒ bool +## is_enabled Check if two-factor authentication is enabled. -#### Returns: +**Signature:** `balena.twofactor_auth.is_enabled()` ⇒ bool + +**Returns:** bool: True if enabled. Otherwise False. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.is_enabled() ``` - -### Function: is_passed() ⇒ bool +## is_passed Check if two-factor authentication challenge was passed. If the user does not have 2FA enabled, this will be True. -#### Returns: +**Signature:** `balena.twofactor_auth.is_passed()` ⇒ bool + +**Returns:** bool: True if passed. Otherwise False. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.is_passed() ``` - -### Function: verify(code) ⇒ str +## verify Verifies two factor authentication. Note that this method not update the token automatically. You should use balena.twofactor_auth.challenge() when possible, as it takes care of that as well. -#### Args: +**Signature:** `balena.twofactor_auth.verify(code)` ⇒ str + +**Args:** code (str): two-factor authentication code. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.verify('123456') ``` -## Logs -This class implements functions that allow processing logs from device. +# Logs - -### Function: history(uuid_or_id, count) ⇒ List[Log] +This class implements functions that allow processing logs from device. +## history Get device logs history. -#### Args: +**Signature:** `balena.logs.history(uuid_or_id, count)` ⇒ List[Log] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. - -### Function: stop() ⇒ None +## stop Will grecefully unsubscribe from all devices and stop the consumer thread. +**Signature:** `balena.logs.stop()` ⇒ None + - -### Function: subscribe(uuid_or_id, callback, error, count) ⇒ None +## subscribe Subscribe to device logs. -#### Args: +**Signature:** `balena.logs.subscribe(uuid_or_id, callback, error, count)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) callback (Callable[[Log], None]): this callback is called on receiving a message. error (Optional[Callable[[Any], None]]): this callback is called on an error event. count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. - -### Function: unsubscribe(uuid_or_id) ⇒ None +## unsubscribe Unsubscribe from device logs for a specific device. -#### Args: +**Signature:** `balena.logs.unsubscribe(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: unsubscribe_all() ⇒ None +## unsubscribe_all Unsubscribe all subscribed devices. -## Settings +**Signature:** `balena.logs.unsubscribe_all()` ⇒ None + + +# Settings Create a module object. The name must be a string; the optional doc argument can have any type. -## Types -### APIKeyInfoType +# Types +## APIKeyInfoType ```python @@ -3866,7 +3847,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### APIKeyType +## APIKeyType ```python @@ -3881,7 +3862,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ActorType +## ActorType ```python @@ -3896,7 +3877,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationHostedOnApplication +## ApplicationHostedOnApplication ```python @@ -3907,7 +3888,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationInviteType +## ApplicationInviteType ```python @@ -3923,7 +3904,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationMembershipRoleType +## ApplicationMembershipRoleType ```python @@ -3934,7 +3915,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationMembershipType +## ApplicationMembershipType ```python @@ -3947,7 +3928,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationType +## ApplicationType ```python @@ -3966,7 +3947,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### BaseTagType +## BaseTagType ```python @@ -3978,7 +3959,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### BasicUserInfoType +## BasicUserInfoType ```python @@ -3989,7 +3970,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### CpuArchitectureType +## CpuArchitectureType ```python @@ -4001,7 +3982,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### CreditBundleType +## CreditBundleType ```python @@ -4021,7 +4002,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceFamilyType +## DeviceFamilyType ```python @@ -4036,7 +4017,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceHistoryType +## DeviceHistoryType ```python @@ -4062,7 +4043,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceManufacturerType +## DeviceManufacturerType ```python @@ -4076,7 +4057,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceMetricsType +## DeviceMetricsType ```python @@ -4094,7 +4075,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceTypeAliasType +## DeviceTypeAliasType ```python @@ -4106,7 +4087,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceTypeType +## DeviceTypeType ```python @@ -4127,7 +4108,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### EnvironmentVariableBase +## EnvironmentVariableBase ```python @@ -4139,7 +4120,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageBasicInfoType +## ImageBasicInfoType ```python @@ -4150,7 +4131,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageInstallType +## ImageInstallType ```python @@ -4166,7 +4147,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageType +## ImageType ```python @@ -4191,7 +4172,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### InviteeType +## InviteeType ```python @@ -4203,7 +4184,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationInviteType +## OrganizationInviteType ```python @@ -4219,7 +4200,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipRoleType +## OrganizationMembershipRoleType ```python @@ -4230,7 +4211,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipTagType +## OrganizationMembershipTagType ```python @@ -4240,7 +4221,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipType +## OrganizationMembershipType ```python @@ -4256,7 +4237,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationPrivateDeviceTypeAccess +## OrganizationPrivateDeviceTypeAccess ```python @@ -4268,7 +4249,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationType +## OrganizationType ```python @@ -4287,7 +4268,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PineDeferred +## PineDeferred ```python @@ -4297,7 +4278,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PublicDeviceType +## PublicDeviceType ```python @@ -4311,7 +4292,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PublicOrganizationType +## PublicOrganizationType ```python @@ -4323,7 +4304,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseImageType +## ReleaseImageType ```python @@ -4336,7 +4317,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseType +## ReleaseType ```python @@ -4382,7 +4363,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseVersion +## ReleaseVersion ```python @@ -4398,7 +4379,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseWithImageDetailsType +## ReleaseWithImageDetailsType ```python @@ -4446,7 +4427,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### SSHKeyType +## SSHKeyType ```python @@ -4460,7 +4441,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ServiceInstanceType +## ServiceInstanceType ```python @@ -4474,7 +4455,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ServiceType +## ServiceType ```python @@ -4490,7 +4471,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamApplicationAccessType +## TeamApplicationAccessType ```python @@ -4503,7 +4484,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamMembershipType +## TeamMembershipType ```python @@ -4516,7 +4497,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamType +## TeamType ```python @@ -4531,7 +4512,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeApplication +## TypeApplication ```python @@ -4573,7 +4554,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeApplicationWithDeviceServiceDetails +## TypeApplicationWithDeviceServiceDetails ```python @@ -4615,7 +4596,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeCurrentService +## TypeCurrentService ```python @@ -4630,7 +4611,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeDevice +## TypeDevice ```python @@ -4696,7 +4677,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeDeviceWithServices +## TypeDeviceWithServices ```python @@ -4763,7 +4744,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeVar +## TypeVar ```python @@ -4773,7 +4754,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypedDict +## TypedDict ```python @@ -4783,7 +4764,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### UserType +## UserType ```python @@ -4800,7 +4781,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### WebResource +## WebResource ```python diff --git a/pages/external-docs/sdk/python-sdk/v16.0.0.md b/pages/external-docs/sdk/python-sdk/v16.0.0.md index d5709ffca8..08a691bc6b 100644 --- a/pages/external-docs/sdk/python-sdk/v16.0.0.md +++ b/pages/external-docs/sdk/python-sdk/v16.0.0.md @@ -77,1078 +77,863 @@ balena = Balena({"retry_rate_limited_request": True}) If you feel something is missing, not clear or could be improved, [please don't hesitate to open an issue in GitHub](https://github.com/balena-io/balena-sdk-python/issues), we'll be happy to help. -## Table of Contents -- [balena](#balena) - - [.models](#models) - - [.application](#application) - - [create(name, device_type, organization, application_class)](#application.create) ⇒ [TypeApplication](#typeapplication) - - [disable_device_urls(slug_or_uuid_or_id)](#application.disable_device_urls) ⇒ None - - [enable_device_urls(slug_or_uuid_or_id)](#application.enable_device_urls) ⇒ None - - [generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date)](#application.generate_provisioning_key) ⇒ str - - [get(slug_or_uuid_or_id, options, context)](#application.get) ⇒ [TypeApplication](#typeapplication) - - [get_all(options, context)](#application.get_all) ⇒ [List[TypeApplication]](#typeapplication) - - [get_all_by_organization(org_handle_or_id, options)](#application.get_all_by_organization) ⇒ [List[TypeApplication]](#typeapplication) - - [get_all_directly_accessible(options)](#application.get_all_directly_accessible) ⇒ [List[TypeApplication]](#typeapplication) - - [get_by_name(app_name, options, context)](#application.get_by_name) ⇒ [TypeApplication](#typeapplication) - - [get_dashboard_url(app_id)](#application.get_dashboard_url) ⇒ str - - [get_directly_accessible(slug_or_uuid_or_id, options)](#application.get_directly_accessible) ⇒ [TypeApplication](#typeapplication) - - [get_id(slug_or_uuid_or_id)](#application.get_id) ⇒ int - - [get_target_release_hash(slug_or_uuid_or_id)](#application.get_target_release_hash) ⇒ Optional[str] - - [get_with_device_service_details(slug_or_uuid_or_id, options)](#application.get_with_device_service_details) ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) - - [grant_support_access(slug_or_uuid_or_id, expiry_timestamp)](#application.grant_support_access) ⇒ None - - [has(slug_or_uuid_or_id)](#application.has) ⇒ bool - - [has_any()](#application.has_any) ⇒ bool - - [is_tracking_latest_release(slug_or_uuid_or_id)](#application.is_tracking_latest_release) ⇒ bool - - [pin_to_release(slug_or_uuid_or_id, full_release_hash)](#application.pin_to_release) ⇒ None - - [purge(app_id)](#application.purge) ⇒ None - - [reboot(app_id, options)](#application.reboot) ⇒ None - - [remove(slug_or_uuid_or_id)](#application.remove) ⇒ None - - [rename(slug_or_uuid_or_id, new_name)](#application.rename) ⇒ None - - [restart(slug_or_uuid_or_id)](#application.restart) ⇒ None - - [revoke_support_access(slug_or_uuid_or_id)](#application.revoke_support_access) ⇒ None - - [shutdown(app_id, options)](#application.shutdown) ⇒ None - - [track_latest_release(slug_or_uuid_or_id)](#application.track_latest_release) ⇒ None - - [will_track_new_releases(slug_or_uuid_or_id)](#application.will_track_new_releases) ⇒ bool - - [.tags](#applicationtag) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationtag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(slug_or_uuid_or_id, tag_key)](#applicationtag.remove) ⇒ None - - [set(slug_or_uuid_or_id, tag_key, value)](#applicationtag.set) ⇒ None - - [.config_var](#applicationconfigvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#applicationconfigvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationconfigvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#applicationconfigvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#applicationconfigvariable.set) ⇒ None - - [.env_var](#applicationenvvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#applicationenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#applicationenvvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#applicationenvvariable.set) ⇒ None - - [.build_var](#buildenvvariable) - - [get(slug_or_uuid_or_id, env_var_name)](#buildenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#buildenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(slug_or_uuid_or_id, key)](#buildenvvariable.remove) ⇒ None - - [set(slug_or_uuid_or_id, env_var_name, value)](#buildenvvariable.set) ⇒ None - - [.membership](#applicationmembership) - - [change_role(membership_id, role_name)](#applicationmembership.change_role) ⇒ None - - [create(slug_or_uuid_or_id, username, role_name)](#applicationmembership.create) ⇒ [ApplicationMembershipType](#applicationmembershiptype) - - [get(membership_id, options)](#applicationmembership.get) ⇒ [ApplicationMembershipType](#applicationmembershiptype) - - [get_all(options)](#applicationmembership.get_all) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationmembership.get_all_by_application) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) - - [remove(membership_id)](#applicationmembership.remove) ⇒ None - - [.invite](#applicationinvite) - - [accept(invite_token)](#applicationinvite.accept) ⇒ None - - [create(slug_or_uuid_or_id, options)](#applicationinvite.create) ⇒ [ApplicationInviteType](#applicationinvitetype) - - [get_all(options)](#applicationinvite.get_all) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#applicationinvite.get_all_by_application) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) - - [revoke(invite_id)](#applicationinvite.revoke) ⇒ None - - [.device](#device) - - [deactivate(uuid_or_id_or_ids)](#device.deactivate) ⇒ None - - [disable_device_url(uuid_or_id_or_ids)](#device.disable_device_url) ⇒ None - - [disable_local_mode(uuid_or_id)](#device.disable_local_mode) ⇒ None - - [disable_lock_override(uuid_or_id)](#device.disable_lock_override) ⇒ None - - [enable_device_url(uuid_or_id_or_ids)](#device.enable_device_url) ⇒ None - - [enable_local_mode(uuid_or_id)](#device.enable_local_mode) ⇒ None - - [enable_lock_override(uuid_or_id)](#device.enable_lock_override) ⇒ None - - [generate_device_key(uuid_or_id, name, description, expiry_date)](#device.generate_device_key) ⇒ str - - [generate_uuid()](#device.generate_uuid) ⇒ str - - [get(uuid_or_id, options)](#device.get) ⇒ [TypeDevice](#typedevice) - - [get_all(options)](#device.get_all) ⇒ [List[TypeDevice]](#typedevice) - - [get_all_by_application(slug_or_uuid_or_id, options)](#device.get_all_by_application) ⇒ [List[TypeDevice]](#typedevice) - - [get_all_by_organization(handle_or_id, options)](#device.get_all_by_organization) ⇒ [List[TypeDevice]](#typedevice) - - [get_application_info(uuid_or_id)](#device.get_application_info) ⇒ Any - - [get_application_name(uuid_or_id)](#device.get_application_name) ⇒ str - - [get_by_name(name, options)](#device.get_by_name) ⇒ [List[TypeDevice]](#typedevice) - - [get_dashboard_url(uuid)](#device.get_dashboard_url) ⇒ None - - [get_device_url(uuid_or_id)](#device.get_device_url) ⇒ str - - [get_local_ip_address(uuid_or_id)](#device.get_local_ip_address) ⇒ List[str] - - [get_local_mode_support(uuid_or_id)](#device.get_local_mode_support) ⇒ LocalModeResponse - - [get_mac_address(uuid_or_id)](#device.get_mac_address) ⇒ List[str] - - [get_metrics(uuid_or_id)](#device.get_metrics) ⇒ [DeviceMetricsType](#devicemetricstype) - - [get_name(uuid_or_id)](#device.get_name) ⇒ str - - [get_os_update_status(uuid_or_id)](#device.get_os_update_status) ⇒ HUPStatusResponse - - [get_status(uuid_or_id)](#device.get_status) ⇒ str - - [get_supervisor_state(uuid_or_id)](#device.get_supervisor_state) ⇒ SupervisorStateType - - [get_supervisor_target_state(uuid_or_id)](#device.get_supervisor_target_state) ⇒ Any - - [get_supervisor_target_state_for_app(slug_or_uuid_or_id, release)](#device.get_supervisor_target_state_for_app) ⇒ Any - - [get_with_service_details(uuid_or_id, options)](#device.get_with_service_details) ⇒ [TypeDeviceWithServices](#typedevicewithservices) - - [grant_support_access(uuid_or_id_or_ids, expiry_timestamp)](#device.grant_support_access) ⇒ None - - [has(uuid_or_id)](#device.has) ⇒ bool - - [has_device_url(uuid_or_id)](#device.has_device_url) ⇒ bool - - [has_lock_override(uuid_or_id)](#device.has_lock_override) ⇒ bool - - [identify(uuid_or_id)](#device.identify) ⇒ None - - [is_in_local_mode(uuid_or_id)](#device.is_in_local_mode) ⇒ bool - - [is_online(uuid_or_id)](#device.is_online) ⇒ bool - - [is_tracking_application_release(uuid_or_id)](#device.is_tracking_application_release) ⇒ bool - - [move(uuid_or_id, app_slug_or_uuid_or_id)](#device.move) ⇒ None - - [pin_to_release(uuid_or_id, full_release_hash_or_id)](#device.pin_to_release) ⇒ None - - [ping(uuid_or_id)](#device.ping) ⇒ None - - [purge(uuid_or_id)](#device.purge) ⇒ None - - [reboot(uuid_or_id, force)](#device.reboot) ⇒ None - - [register(application_slug_or_uuid_or_id, uuid, device_type_slug)](#device.register) ⇒ RegisterResponse - - [remove(uuid_or_id_or_ids)](#device.remove) ⇒ None - - [rename(uuid_or_id, new_name)](#device.rename) ⇒ None - - [restart_application(uuid_or_id)](#device.restart_application) ⇒ None - - [restart_service(uuid_or_id, image_id)](#device.restart_service) ⇒ None - - [revoke_support_access(uuid_or_id_or_ids)](#device.revoke_support_access) ⇒ None - - [set_custom_location(uuid_or_id_or_ids, location)](#device.set_custom_location) ⇒ None - - [set_note(uuid_or_id_or_ids, note)](#device.set_note) ⇒ None - - [set_supervisor_release(uuid_or_id, supervisor_version_or_id)](#device.set_supervisor_release) ⇒ None - - [shutdown(uuid_or_id, force)](#device.shutdown) ⇒ None - - [start_application(uuid_or_id)](#device.start_application) ⇒ None - - [start_os_update(uuid_or_id, target_os_version)](#device.start_os_update) ⇒ HUPStatusResponse - - [start_service(uuid_or_id, image_id)](#device.start_service) ⇒ None - - [stop_application(uuid_or_id)](#device.stop_application) ⇒ None - - [stop_service(uuid_or_id, image_id)](#device.stop_service) ⇒ None - - [track_application_release(uuid_or_id_or_ids)](#device.track_application_release) ⇒ None - - [unset_custom_location(uuid_or_id_or_ids)](#device.unset_custom_location) ⇒ None - - [update(uuid_or_id, force)](#device.update) ⇒ None - - [.tags](#devicetag) - - [get(uuid_or_id, tag_key)](#devicetag.get) ⇒ Optional[str] - - [get_all(options)](#devicetag.get_all) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#devicetag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_device(uuid_or_id, options)](#devicetag.get_all_by_device) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(uuid_or_id, tag_key)](#devicetag.remove) ⇒ None - - [set(uuid_or_id, tag_key, value)](#devicetag.set) ⇒ None - - [.config_var](#deviceconfigvariable) - - [get(uuid_or_id, env_var_name)](#deviceconfigvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceconfigvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceconfigvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, key)](#deviceconfigvariable.remove) ⇒ None - - [set(uuid_or_id, env_var_name, value)](#deviceconfigvariable.set) ⇒ None - - [.env_var](#deviceenvvariable) - - [get(uuid_or_id, env_var_name)](#deviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceenvvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, key)](#deviceenvvariable.remove) ⇒ None - - [set(uuid_or_id, env_var_name, value)](#deviceenvvariable.set) ⇒ None - - [.service_var](#deviceserviceenvvariable) - - [get(uuid_or_id, service_name_or_id, key)](#deviceserviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#deviceserviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_device(uuid_or_id, options)](#deviceserviceenvvariable.get_all_by_device) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(uuid_or_id, service_name_or_id, key)](#deviceserviceenvvariable.remove) ⇒ None - - [set(uuid_or_id, service_name_or_id, key, value)](#deviceserviceenvvariable.set) ⇒ None - - [.history](#devicehistory) - - [get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options)](#devicehistory.get_all_by_application) ⇒ [List[DeviceHistoryType]](#devicehistorytype) - - [get_all_by_device(uuid_or_id, from_date, to_date, options)](#devicehistory.get_all_by_device) ⇒ [List[DeviceHistoryType]](#devicehistorytype) - - [.device_type](#devicetype) - - [get(id_or_slug, options)](#devicetype.get) ⇒ [DeviceTypeType](#devicetypetype) - - [get_all(options)](#devicetype.get_all) ⇒ [List[DeviceTypeType]](#devicetypetype) - - [get_all_supported(options)](#devicetype.get_all_supported) ⇒ None - - [get_by_slug_or_name(slug_or_name, options)](#devicetype.get_by_slug_or_name) ⇒ [DeviceTypeType](#devicetypetype) - - [get_name(slug)](#devicetype.get_name) ⇒ str - - [get_slug_by_name(name)](#devicetype.get_slug_by_name) ⇒ str - - [.api_key](#apikey) - - [create(name, description, expiry_date)](#apikey.create) ⇒ str - - [get_all(options)](#apikey.get_all) ⇒ [List[APIKeyType]](#apikeytype) - - [get_all_named_user_api_keys(options)](#apikey.get_all_named_user_api_keys) ⇒ [List[APIKeyType]](#apikeytype) - - [get_device_api_keys_by_device(uuid_or_id, options)](#apikey.get_device_api_keys_by_device) ⇒ [List[APIKeyType]](#apikeytype) - - [get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options)](#apikey.get_provisioning_api_keys_by_application) ⇒ [List[APIKeyType]](#apikeytype) - - [revoke(id)](#apikey.revoke) ⇒ None - - [update(id, api_key_info)](#apikey.update) ⇒ None - - [.key](#key) - - [create(title, key)](#key.create) ⇒ [SSHKeyType](#sshkeytype) - - [get(id)](#key.get) ⇒ [SSHKeyType](#sshkeytype) - - [get_all(options)](#key.get_all) ⇒ [List[SSHKeyType]](#sshkeytype) - - [remove(id)](#key.remove) ⇒ None - - [.organization](#organization) - - [create(name, handle, logo_image)](#organization.create) ⇒ [OrganizationType](#organizationtype) - - [get(handle_or_id, options)](#organization.get) ⇒ [OrganizationType](#organizationtype) - - [get_all(options)](#organization.get_all) ⇒ [List[OrganizationType]](#organizationtype) - - [remove(handle_or_id)](#organization.remove) ⇒ None - - [.membership](#organizationmembership) - - [get(membership_id, options)](#organizationmembership.get) ⇒ [OrganizationMembershipType](#organizationmembershiptype) - - [get_all(options)](#organizationmembership.get_all) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) - - [get_all_by_organization(handle_or_id, options)](#organizationmembership.get_all_by_organization) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) - - [.tags](#organizationmembershiptag) - - [get(membership_id, tag_key)](#organizationmembershiptag.get) ⇒ Optional[str] - - [get_all(options)](#organizationmembershiptag.get_all) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [get_all_by_organization(handle_or_id, options)](#organizationmembershiptag.get_all_by_organization) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [get_all_by_organization_membership(membership_id, options)](#organizationmembershiptag.get_all_by_organization_membership) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) - - [remove(membership_id, tag_key)](#organizationmembershiptag.remove) ⇒ None - - [set(membership_id, tag_key, value)](#organizationmembershiptag.set) ⇒ None - - [.invite](#organizationinvite) - - [accept(invite_token)](#organizationinvite.accept) ⇒ None - - [create(handle_or_id, invitee, role_name, message)](#organizationinvite.create) ⇒ [OrganizationInviteType](#organizationinvitetype) - - [get_all(options)](#organizationinvite.get_all) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) - - [get_all_by_organization(handle_or_id, options)](#organizationinvite.get_all_by_organization) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) - - [revoke(invite_id)](#organizationinvite.revoke) ⇒ None - - [.os](#deviceos) - - [download(device_type, version, options)](#deviceos.download) ⇒ None - - [get_all_os_versions(device_type, options)](#deviceos.get_all_os_versions) ⇒ None - - [get_available_os_versions(device_type)](#deviceos.get_available_os_versions) ⇒ None - - [get_config(slug_or_uuid_or_id, options)](#deviceos.get_config) ⇒ None - - [get_download_size(device_type, version)](#deviceos.get_download_size) ⇒ float - - [get_max_satisfying_version(device_type, version_or_range, os_type)](#deviceos.get_max_satisfying_version) ⇒ Optional[str] - - [get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options)](#deviceos.get_supervisor_releases_for_cpu_architecture) ⇒ [List[ReleaseType]](#releasetype) - - [get_supported_os_update_versions(device_type, current_version)](#deviceos.get_supported_os_update_versions) ⇒ None - - [is_architecture_compatible_with(os_architecture, application_architecture)](#deviceos.is_architecture_compatible_with) ⇒ None - - [is_supported_os_update(device_type, current_version, target_version)](#deviceos.is_supported_os_update) ⇒ bool - - [.config](#config) - - [get_all()](#config.get_all) ⇒ ConfigType - - [.release](#release) - - [create_from_url(slug_or_uuid_or_id, url, flatten_tarball)](#release.create_from_url) ⇒ int - - [finalize(commit_or_id_or_raw_version)](#release.finalize) ⇒ None - - [get(commit_or_id_or_raw_version, options)](#release.get) ⇒ [ReleaseType](#releasetype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#release.get_all_by_application) ⇒ [List[ReleaseType]](#releasetype) - - [get_latest_by_application(slug_or_uuid_or_id, options)](#release.get_latest_by_application) ⇒ [Optional[ReleaseType]](#releasetype) - - [get_with_image_details(commit_or_id_or_raw_version, image_options, release_options)](#release.get_with_image_details) ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) - - [set_is_invalidated(commit_or_id_or_raw_version, is_invalidated)](#release.set_is_invalidated) ⇒ None - - [set_known_issue_list(commit_or_id_or_raw_version, known_issue_list)](#release.set_known_issue_list) ⇒ None - - [set_note(commit_or_id_or_raw_version, note)](#release.set_note) ⇒ None - - [set_release_version(commit_or_id, semver)](#release.set_release_version) ⇒ None - - [.tags](#releasetag) - - [get(commit_or_id_or_raw_version, tag_key)](#releasetag.get) ⇒ Optional[str] - - [get_all(options)](#releasetag.get_all) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_application(slug_or_uuid_or_id, options)](#releasetag.get_all_by_application) ⇒ [List[BaseTagType]](#basetagtype) - - [get_all_by_release(commit_or_id_or_raw_version, options)](#releasetag.get_all_by_release) ⇒ [List[BaseTagType]](#basetagtype) - - [remove(commit_or_id_or_raw_version, tag_key)](#releasetag.remove) ⇒ None - - [set(commit_or_id_or_raw_version, tag_key, value)](#releasetag.set) ⇒ None - - [.service](#service) - - [get_all_by_application(slug_or_uuid_or_id, options)](#service.get_all_by_application) ⇒ [List[ServiceType]](#servicetype) - - [.var](#serviceenvvariable) - - [get(service_id_or_natural_key, key)](#serviceenvvariable.get) ⇒ Optional[str] - - [get_all_by_application(slug_or_uuid_or_id, options)](#serviceenvvariable.get_all_by_application) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [get_all_by_service(service_id_or_natural_key, options)](#serviceenvvariable.get_all_by_service) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) - - [remove(service_id_or_natural_key, key)](#serviceenvvariable.remove) ⇒ None - - [set(service_id_or_natural_key, key, value)](#serviceenvvariable.set) ⇒ None - - [.image](#image) - - [get(id, options)](#image.get) ⇒ [ImageType](#imagetype) - - [get_logs(id)](#image.get_logs) ⇒ str - - [.auth](#auth) - - [authenticate()](#auth.authenticate) ⇒ str - - [get_actor_id()](#auth.get_actor_id) ⇒ int - - [get_token()](#auth.get_token) ⇒ Optional[str] - - [get_user_info()](#auth.get_user_info) ⇒ UserInfo - - [is_logged_in()](#auth.is_logged_in) ⇒ bool - - [login()](#auth.login) ⇒ None - - [login_with_token(token)](#auth.login_with_token) ⇒ None - - [logout()](#auth.logout) ⇒ None - - [register()](#auth.register) ⇒ str - - [whoami()](#auth.whoami) ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] - - [.two_factor](#twofactorauth) - - [challenge(code)](#twofactorauth.challenge) ⇒ None - - [disable(password)](#twofactorauth.disable) ⇒ str - - [enable(code)](#twofactorauth.enable) ⇒ str - - [get_setup_key()](#twofactorauth.get_setup_key) ⇒ str - - [is_enabled()](#twofactorauth.is_enabled) ⇒ bool - - [is_passed()](#twofactorauth.is_passed) ⇒ bool - - [verify(code)](#twofactorauth.verify) ⇒ str - - [.logs](#logs) - - [history(uuid_or_id, count)](#logs.history) ⇒ List[Log] - - [stop()](#logs.stop) ⇒ None - - [subscribe(uuid_or_id, callback, error, count)](#logs.subscribe) ⇒ None - - [unsubscribe(uuid_or_id)](#logs.unsubscribe) ⇒ None - - [unsubscribe_all()](#logs.unsubscribe_all) ⇒ None - - [.settings](#module) - - [.types](#types) - -## Models +# Models This module implements all models for balena python SDK. -## Application +# Application This class implements application model for balena python SDK. - - -### Function: create(name, device_type, organization, application_class) ⇒ [TypeApplication](#typeapplication) +## create Create an application. -#### Args: +**Signature:** `balena.models.application.create(name, device_type, organization, application_class)` ⇒ [TypeApplication](#typeapplication) + +**Args:** name (str): application name. device_type (str): device type (slug). organization (Union[str, int]): handle or id of the organization that the application will belong to. application_class (Optional[Literal["app", "fleet", "block"]]): application class. -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.create('foo', 'raspberry-pi', 12345) >>> balena.models.application.create('foo', 'raspberry-pi', 12345, 'block') ``` - -### Function: disable_device_urls(slug_or_uuid_or_id) ⇒ None +## disable_device_urls Disable device urls for all devices that belong to an application. -#### Args: +**Signature:** `balena.models.application.disable_device_urls(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.disable_device_urls(5685) ``` - -### Function: enable_device_urls(slug_or_uuid_or_id) ⇒ None +## enable_device_urls Enable device urls for all devices that belong to an application -#### Args: +**Signature:** `balena.models.application.enable_device_urls(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.enable_device_urls(5685) ``` - -### Function: generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date) ⇒ str +## generate_provisioning_key Generate a device provisioning key for a specific application. -#### Args: +**Signature:** `balena.models.application.generate_provisioning_key(slug_or_uuid_or_id, key_name, description, expiry_date)` ⇒ str + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) key_name (Optional[str]): provisioning key name. description (Optional[str]): description for provisioning key. expiry_date (Optional[str]): expiry date for provisioning key, for example: `2030-01-01T00:00:00Z`. -#### Returns: +**Returns:** str: device provisioning key. -#### Examples: +**Examples:** ```python >>> balena.models.application.generate_provisioning_key(5685) ``` - -### Function: get(slug_or_uuid_or_id, options, context) ⇒ [TypeApplication](#typeapplication) +## get Get a single application. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, options, context)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get("myorganization/myapp") >>> balena.models.application.get(123) ``` - -### Function: get_all(options, context) ⇒ [List[TypeApplication]](#typeapplication) +## get_all Get all applications -#### Args: +**Signature:** `balena.models.application.get_all(options, context)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all() ``` - -### Function: get_all_by_organization(org_handle_or_id, options) ⇒ [List[TypeApplication]](#typeapplication) +## get_all_by_organization Get all applications of an organization. -#### Args: +**Signature:** `balena.models.application.get_all_by_organization(org_handle_or_id, options)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** org_handle_or_id (Union[str, int]): handle or id of the organization. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[TypeApplication]: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all_by_organization('myorg') ``` - -### Function: get_all_directly_accessible(options) ⇒ [List[TypeApplication]](#typeapplication) +## get_all_directly_accessible Get all applications directly accessible by the user -#### Args: +**Signature:** `balena.models.application.get_all_directly_accessible(options)` ⇒ [List[TypeApplication]](#typeapplication) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[APIKeyType]: user API key -#### Examples: +**Examples:** ```python >>> balena.models.application.get_all_directly_accessible() ``` - -### Function: get_by_name(app_name, options, context) ⇒ [TypeApplication](#typeapplication) +## get_by_name Get a single application using the appname. -#### Args: +**Signature:** `balena.models.application.get_by_name(app_name, options, context)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use context (Optional[str]): extra access filters, None or 'directly_accessible' -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get("myapp") ``` - -### Function: get_dashboard_url(app_id) ⇒ str +## get_dashboard_url Get Dashboard URL for a specific application. -#### Args: +**Signature:** `balena.models.application.get_dashboard_url(app_id)` ⇒ str + +**Args:** app_id (int): application id. -#### Returns: +**Returns:** str: Dashboard URL for the specific application. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_dashboard_url(1476418) ``` - -### Function: get_directly_accessible(slug_or_uuid_or_id, options) ⇒ [TypeApplication](#typeapplication) +## get_directly_accessible Get a single application directly accessible by the user -#### Args: +**Signature:** `balena.models.application.get_directly_accessible(slug_or_uuid_or_id, options)` ⇒ [TypeApplication](#typeapplication) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_directly_accessible("myorganization/myapp") >>> balena.models.application.get_directly_accessible(123) ``` - -### Function: get_id(slug_or_uuid_or_id) ⇒ int +## get_id Given an application slug or uuid or id, returns it numeric id. -#### Args: +**Signature:** `balena.models.application.get_id(slug_or_uuid_or_id)` ⇒ int + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** int: The id. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_dashboard_url(1476418) ``` - -### Function: get_target_release_hash(slug_or_uuid_or_id) ⇒ Optional[str] +## get_target_release_hash Get the hash of the current release for a specific application. -#### Args: +**Signature:** `balena.models.application.get_target_release_hash(slug_or_uuid_or_id)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** Optional[str]: The release hash of the current release or None. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_target_release_hash(5685) ``` - -### Function: get_with_device_service_details(slug_or_uuid_or_id, options) ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) +## get_with_device_service_details This method does not map exactly to the underlying model: it runs a larger prebuilt query, and reformats it into an easy to use and understand format. If you want more control, or to see the raw model directly, use `application.get(uuidOrId, options)` instead. -#### Args: +**Signature:** `balena.models.application.get_with_device_service_details(slug_or_uuid_or_id, options)` ⇒ [TypeApplicationWithDeviceServiceDetails](#typeapplicationwithdeviceservicedetails) + +**Args:** slug_or_uuid_or_id (str): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeApplication: application info. -#### Examples: +**Examples:** ```python >>> balena.models.application.get_with_device_service_details('my_org_handle/my_app_name') ``` - -### Function: grant_support_access(slug_or_uuid_or_id, expiry_timestamp) ⇒ None +## grant_support_access Grant support access to an application until a specified time. -#### Args: +**Signature:** `balena.models.application.grant_support_access(slug_or_uuid_or_id, expiry_timestamp)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Examples: +**Examples:** ```python >>> balena.models.application.grant_support_access(5685, 1511974999000) ``` - -### Function: has(slug_or_uuid_or_id) ⇒ bool +## has Check if an application exists. -#### Args: +**Signature:** `balena.models.application.has(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Returns: +**Returns:** bool: True if application exists, False otherwise. -#### Examples: +**Examples:** ```python >>> balena.models.application.has('my_org/foo') ``` - -### Function: has_any() ⇒ bool +## has_any Check if the user has any applications. -#### Returns: +**Signature:** `balena.models.application.has_any()` ⇒ bool + +**Returns:** bool: True if user has any applications, False otherwise. -#### Examples: +**Examples:** ```python >>> balena.models.application.has_any() ``` - -### Function: is_tracking_latest_release(slug_or_uuid_or_id) ⇒ bool +## is_tracking_latest_release Get whether the application is up to date and is tracking the latest finalized release for updates -#### Args: +**Signature:** `balena.models.application.is_tracking_latest_release(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Returns: +**Returns:** bool: is tracking the latest release. -#### Examples: +**Examples:** ```python >>> balena.models.application.is_tracking_latest_release(5685) ``` - -### Function: pin_to_release(slug_or_uuid_or_id, full_release_hash) ⇒ None +## pin_to_release Configures the application to run a particular release and not get updated when the latest release changes. -#### Args: +**Signature:** `balena.models.application.pin_to_release(slug_or_uuid_or_id, full_release_hash)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). full_release_hash (str) : the hash of a successful release (string) -#### Examples: +**Examples:** ```python >>> balena.models.application.set_to_release(5685, '7dba4e0c461215374edad74a5b78f470b894b5b7') ``` - -### Function: purge(app_id) ⇒ None +## purge Purge devices by application id -#### Args: +**Signature:** `balena.models.application.purge(app_id)` ⇒ None + +**Args:** app_id (int): application id (number) -#### Examples: +**Examples:** ```python >>> balena.models.application.purge(5685) ``` - -### Function: reboot(app_id, options) ⇒ None +## reboot Reboots devices by application id -#### Args: +**Signature:** `balena.models.application.reboot(app_id, options)` ⇒ None + +**Args:** app_id (int): application id (number) options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python >>> balena.models.application.reboot(5685) >>> balena.models.application.reboot(5685, {"force": True}) ``` - -### Function: remove(slug_or_uuid_or_id) ⇒ None +## remove Remove application. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.remove('my_org/my_app') >>> balena.models.application.remove('c184556293854781aea71b0bdae10e45') >>> balena.models.application.remove(123) ``` - -### Function: rename(slug_or_uuid_or_id, new_name) ⇒ None +## rename Rename application. -#### Args: +**Signature:** `balena.models.application.rename(slug_or_uuid_or_id, new_name)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). new_name (str): new application name. -#### Examples: +**Examples:** ```python >>> balena.models.application.rename(1681618, 'py-test-app') ``` - -### Function: restart(slug_or_uuid_or_id) ⇒ None +## restart Restart application. -#### Args: +**Signature:** `balena.models.application.restart(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.restart('myorg/RPI1') ``` - -### Function: revoke_support_access(slug_or_uuid_or_id) ⇒ None +## revoke_support_access Revoke support access to an application. -#### Args: +**Signature:** `balena.models.application.revoke_support_access(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.application.revoke_support_access(5685) ``` - -### Function: shutdown(app_id, options) ⇒ None +## shutdown Shutdown devices by application id -#### Args: +**Signature:** `balena.models.application.shutdown(app_id, options)` ⇒ None + +**Args:** app_id (int): application id (number) options (ShutdownOptions): override update lock -#### Examples: +**Examples:** ```python >>> balena.models.application.shutdown(5685) >>> balena.models.application.shutdown(5685, {"force": True}) ``` - -### Function: track_latest_release(slug_or_uuid_or_id) ⇒ None +## track_latest_release Configure a specific application to track the latest available release. -#### Args: +**Signature:** `balena.models.application.track_latest_release(slug_or_uuid_or_id)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) -#### Examples: +**Examples:** ```python >>> balena.models.application.track_latest_release(5685) ``` - -### Function: will_track_new_releases(slug_or_uuid_or_id) ⇒ bool +## will_track_new_releases Get whether the application is configured to receive updates whenever a new release is available. -#### Args: +**Signature:** `balena.models.application.will_track_new_releases(slug_or_uuid_or_id)` ⇒ bool + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Returns: +**Returns:** bool: is tracking the latest release. -#### Examples: +**Examples:** ```python >>> balena.models.application.will_track_new_releases(5685) ``` -## ApplicationTag -This class implements application tag model for balena python SDK. +# ApplicationTag - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +This class implements application tag model for balena python SDK. +## get_all_by_application Get all application tags for an application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.get_all_by_application(1005160) ``` - -### Function: remove(slug_or_uuid_or_id, tag_key) ⇒ None +## remove Remove an application tag. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, tag_key)` ⇒ None + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.remove(1005767, 'tag1') ``` - -### Function: set(slug_or_uuid_or_id, tag_key, value) ⇒ None +## set Set an application tag (update tag value if it exists). -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, tag_key, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) tag_key (str): tag key. value (str): tag value. -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.application.tags.set(1005767, 'tag1', 'Python SDK') ``` -## ApplicationConfigVariable -This class implements application config variable model for balena python SDK. +# ApplicationConfigVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements application config variable model for balena python SDK. +## get Get application config variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all application config variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application config variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.get_all_by_application(9020) ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an application config variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.remove(2184, 'test_env') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific application config variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.application.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env', 'testing1') ``` -## ApplicationEnvVariable -This class implements application environment variable model for balena python SDK. +# ApplicationEnvVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements application environment variable model for balena python SDK. +## get Get application environment variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all application environment variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.get_all_by_application(9020) >>> balena.models.application.env_var.get_all_by_application("myorg/myslug") ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an application environment variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.remove(2184,'test_env4') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific application environment variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.application.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') ``` -## BuildEnvVariable -This class implements build environment variable model for balena python SDK. +# BuildEnvVariable - -### Function: get(slug_or_uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements build environment variable model for balena python SDK. +## get Get build environment variable. -#### Args: +**Signature:** `balena.models.application.get(slug_or_uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all build environment variables by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: build environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.get_all_by_application(9020) >>> balena.models.application.build_var.get_all_by_application("myorg/myslug") ``` - -### Function: remove(slug_or_uuid_or_id, key) ⇒ None +## remove Remove an build environment variable. -#### Args: +**Signature:** `balena.models.application.remove(slug_or_uuid_or_id, key)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.remove(2184, 'test_env4') ``` - -### Function: set(slug_or_uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific build environment variable. -#### Args: +**Signature:** `balena.models.application.set(slug_or_uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.application.build_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4', 'testing1') ``` -## ApplicationMembership -This class implements application membership model for balena python SDK. +# ApplicationMembership - -### Function: change_role(membership_id, role_name) ⇒ None +This class implements application membership model for balena python SDK. +## change_role Changes the role of an application member. -#### Args: +**Signature:** `balena.models.application.change_role(membership_id, role_name)` ⇒ None + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` numeric pair of the membership role_name (str): the role name to be granted to the membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.change_role(55074, 'observer') ``` - -### Function: create(slug_or_uuid_or_id, username, role_name) ⇒ [ApplicationMembershipType](#applicationmembershiptype) +## create Creates a new membership for an application. -#### Args: +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, username, role_name)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). username (str): the username of the balena user that will become a member. role_name (Optional[str]): the role name to be granted to the membership. -#### Returns: +**Returns:** ApplicationMembershipType: application membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.create(1681618, 'testuser') ``` - -### Function: get(membership_id, options) ⇒ [ApplicationMembershipType](#applicationmembershiptype) +## get Get a single application membership. -#### Args: +**Signature:** `balena.models.application.get(membership_id, options)` ⇒ [ApplicationMembershipType](#applicationmembershiptype) + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` numeric pair of the membership options (AnyObject): extra pine options to use -#### Returns: +**Returns:** ApplicationMembershipType: application membership. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get(55074) >>> balena.models.application.membership.get({"user": 123, "is_member_of__application": 125}) ``` - -### Function: get_all(options) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) +## get_all Get all application memberships. -#### Args: +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationMembershipType]: list contains info of application memberships. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) +## get_all_by_application Get all memberships by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationMembershipType]](#applicationmembershiptype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: list contains info of application memberships. -#### Examples: +**Examples:** ```python >>> balena.models.application.membership.get_all_by_application(1681618) ``` - -### Function: remove(membership_id) ⇒ None +## remove Remove a membership. -#### Args: +**Signature:** `balena.models.application.remove(membership_id)` ⇒ None + +**Args:** membership_id (ResourceKey): the id or an object with the unique `user` & `is_member_of__application` -## ApplicationInvite -This class implements application invite model for balena python SDK. +# ApplicationInvite - -### Function: accept(invite_token) ⇒ None +This class implements application invite model for balena python SDK. +## accept Accepts an invite. -#### Args: +**Signature:** `balena.models.application.accept(invite_token)` ⇒ None + +**Args:** invite_token (str): invitationToken - invite token. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.accept("qwerty-invitation-token") ``` - -### Function: create(slug_or_uuid_or_id, options) ⇒ [ApplicationInviteType](#applicationinvitetype) +## create Creates a new invite for an application. -#### Args: +**Signature:** `balena.models.application.create(slug_or_uuid_or_id, options)` ⇒ [ApplicationInviteType](#applicationinvitetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (ApplicationInviteOptions): Application Invite options dict to use. invitee (str): the email/balena_username of the invitee. @@ -1156,200 +941,212 @@ Creates a new invite for an application. One of "observer", "developer", "operator". Defaults to "developer" message (Optional[str]): the message to send along with the invite. -#### Returns: +**Returns:** dict: application invite. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.create(1681618, 'invitee@example.org', 'developer', 'Test invite') ``` - -### Function: get_all(options) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) +## get_all Get all invites. -#### Args: +**Signature:** `balena.models.application.get_all(options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ApplicationInviteType]](#applicationinvitetype) +## get_all_by_application Get all invites by application. -#### Args: +**Signature:** `balena.models.application.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ApplicationInviteType]](#applicationinvitetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ApplicationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.get_all_by_application(1681618) ``` - -### Function: revoke(invite_id) ⇒ None +## revoke Revoke an invite. -#### Args: +**Signature:** `balena.models.application.revoke(invite_id)` ⇒ None + +**Args:** invite_id (int): application invite id. -#### Examples: +**Examples:** ```python >>> balena.models.application.invite.revoke(5860) ``` -## Device -This class implements device model for balena python SDK. +# Device - -### Function: deactivate(uuid_or_id_or_ids) ⇒ None +This class implements device model for balena python SDK. +## deactivate Deactivates a device. -#### Args: +**Signature:** `balena.models.device.deactivate(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.deactivate('44cc9d1861b9f992808c506276e5d31c') >>> balena.models.device.deactivate([123, 234]) ``` - -### Function: disable_device_url(uuid_or_id_or_ids) ⇒ None +## disable_device_url Disable device url for a device. -#### Args: +**Signature:** `balena.models.device.disable_device_url(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Examples: +**Examples:** ```python >>> balena.models.device.disable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.disable_device_url([123, 345]) ``` - -### Function: disable_local_mode(uuid_or_id) ⇒ None +## disable_local_mode Disable local mode. -#### Args: +**Signature:** `balena.models.device.disable_local_mode(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** None. -#### Examples: +**Examples:** ```python >>> balena.models.device.disable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: disable_lock_override(uuid_or_id) ⇒ None +## disable_lock_override Disable lock override. -#### Args: +**Signature:** `balena.models.device.disable_lock_override(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: enable_device_url(uuid_or_id_or_ids) ⇒ None +## enable_device_url Enable device url for a device. -#### Args: +**Signature:** `balena.models.device.enable_device_url(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]). -#### Examples: +**Examples:** ```python >>> balena.models.device.enable_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.enable_device_url([123, 345]) ``` - -### Function: enable_local_mode(uuid_or_id) ⇒ None +## enable_local_mode Enable local mode. -#### Args: +**Signature:** `balena.models.device.enable_local_mode(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python >>> balena.models.device.enable_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: enable_lock_override(uuid_or_id) ⇒ None +## enable_lock_override Enable lock override. -#### Args: +**Signature:** `balena.models.device.enable_lock_override(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: generate_device_key(uuid_or_id, name, description, expiry_date) ⇒ str +## generate_device_key Generate a device key. -#### Args: +**Signature:** `balena.models.device.generate_device_key(uuid_or_id, name, description, expiry_date)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) name (Optional[str]): device key name. description (Optional[str]): description for device key. expiry_date (Optional[str]): expiry date for device key, for example: `2030-01-01T00:00:00Z`. -#### Examples: +**Examples:** ```python >>> balena.models.device.generate_device_key('df0926d8a5cf4293a1b3742c98a500a1') ``` - -### Function: generate_uuid() ⇒ str +## generate_uuid Generate a random device UUID. -#### Returns: +**Signature:** `balena.models.device.generate_uuid()` ⇒ str + +**Returns:** str: a generated UUID. -#### Examples: +**Examples:** ```python >>> balena.models.device.generate_uuid() ``` - -### Function: get(uuid_or_id, options) ⇒ [TypeDevice](#typedevice) +## get This method returns a single device by id or uuid. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, options)` ⇒ [TypeDevice](#typedevice) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** TypeDevice: device info. -#### Examples: +**Examples:** ```python >>> balena.models.device.get('8deb12a58e3b6d3920db1c2b6303d1ff32f23d5ab99781ce1dde6876e8d143') >>> balena.models.device.get('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.get(12345) ``` - -### Function: get_all(options) ⇒ [List[TypeDevice]](#typedevice) +## get_all This method returns all devices that the current user can access. In order to have the following computed properties in the result @@ -1358,658 +1155,720 @@ you have to explicitly define them in a `$select` in the extra options: - overall_progress - is_frozen -#### Args: +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[TypeDevice]](#typedevice) + +** Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[TypeDevice]](#typedevice) +## get_all_by_application Get devices by application slug, uuid or id. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all_by_application('my_org/RPI1') ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[TypeDevice]](#typedevice) +## get_all_by_organization Get devices by organization slug, uuid or id. -#### Args: +**Signature:** `balena.models.device.get_all_by_organization(handle_or_id, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_all_by_organization('my_org') >>> balena.models.device.get_all_by_organization(123) ``` - -### Function: get_application_info(uuid_or_id) ⇒ Any +## get_application_info ***Deprecated*** Return information about the application running on the device. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.get_application_info(uuid_or_id)` ⇒ Any + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains application information. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_application_info('7f66ec3c5da146c3b6a84aaed1c07581') ``` - -### Function: get_application_name(uuid_or_id) ⇒ str +## get_application_name Get application name by device uuid. -#### Args: +**Signature:** `balena.models.device.get_application_name(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: application name. - -### Function: get_by_name(name, options) ⇒ [List[TypeDevice]](#typedevice) +## get_by_name Get devices by device name. -#### Args: +**Signature:** `balena.models.device.get_by_name(name, options)` ⇒ [List[TypeDevice]](#typedevice) + +**Args:** name (str): device name. -#### Returns: +**Returns:** List[TypeDevice]: list contains info of devices. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_by_name('floral-mountain') ``` - -### Function: get_dashboard_url(uuid) ⇒ None +## get_dashboard_url Get balena Dashboard URL for a specific device. -#### Args: +**Signature:** `balena.models.device.get_dashboard_url(uuid)` ⇒ None + +**Args:** uuid (str): device uuid. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_dashboard_url('19619a6317072b65a240b451f45f855d') ``` - -### Function: get_device_url(uuid_or_id) ⇒ str +## get_device_url Get a device url for a device. -#### Args: +**Signature:** `balena.models.device.get_device_url(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python >>> balena.models.device.get_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: get_local_ip_address(uuid_or_id) ⇒ List[str] +## get_local_ip_address Get the local IP addresses of a device. -#### Args: +**Signature:** `balena.models.device.get_local_ip_address(uuid_or_id)` ⇒ List[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** List[str]: IP addresses of a device. - -### Function: get_local_mode_support(uuid_or_id) ⇒ LocalModeResponse +## get_local_mode_support Returns whether local mode is supported and a message describing the reason why local mode is not supported. -#### Args: +**Signature:** `balena.models.device.get_local_mode_support(uuid_or_id)` ⇒ LocalModeResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** dict: local mode support information ({'supported': True/False, 'message': '...'}). -#### Examples: +**Examples:** ```python >>> balena.models.device.get_local_mode_support('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_mac_address(uuid_or_id) ⇒ List[str] +## get_mac_address Get the MAC addresses of a device. -#### Args: +**Signature:** `balena.models.device.get_mac_address(uuid_or_id)` ⇒ List[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** List[str]: MAC addresses of a device. - -### Function: get_metrics(uuid_or_id) ⇒ [DeviceMetricsType](#devicemetricstype) +## get_metrics Gets the metrics related information for a device. -#### Args: +**Signature:** `balena.models.device.get_metrics(uuid_or_id)` ⇒ [DeviceMetricsType](#devicemetricstype) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** dict: metrics of the device. - -### Function: get_name(uuid_or_id) ⇒ str +## get_name Get device name by device uuid. -#### Args: +**Signature:** `balena.models.device.get_name(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: device name. - -### Function: get_os_update_status(uuid_or_id) ⇒ HUPStatusResponse +## get_os_update_status ***Deprecated*** Get the OS update status of a device. -#### Args: +**Signature:** `balena.models.device.get_os_update_status(uuid_or_id)` ⇒ HUPStatusResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** HUPStatusResponse: action response. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_os_update_status('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_status(uuid_or_id) ⇒ str +## get_status Get the status of a device. -#### Args: +**Signature:** `balena.models.device.get_status(uuid_or_id)` ⇒ str + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** str: status of a device. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_status('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: get_supervisor_state(uuid_or_id) ⇒ SupervisorStateType +## get_supervisor_state Get the supervisor state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_state(uuid_or_id)` ⇒ SupervisorStateType + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Returns: +**Returns:** dict: supervisor state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_state('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: get_supervisor_target_state(uuid_or_id) ⇒ Any +## get_supervisor_target_state Get the supervisor target state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_target_state(uuid_or_id)` ⇒ Any + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int). -#### Returns: +**Returns:** DeviceStateType: supervisor target state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_target_state('b6070f4fea5edf808b576123157fe5ec') ``` - -### Function: get_supervisor_target_state_for_app(slug_or_uuid_or_id, release) ⇒ Any +## get_supervisor_target_state_for_app Get the supervisor target state on a device -#### Args: +**Signature:** `balena.models.device.get_supervisor_target_state_for_app(slug_or_uuid_or_id, release)` ⇒ Any + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) release (Optional[Union[str, int]]): (optional) release uuid (default tracked) -#### Returns: +**Returns:** DeviceStateType: supervisor target state. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_supervisor_target_state_for_app('myorg/myapp') ``` - -### Function: get_with_service_details(uuid_or_id, options) ⇒ [TypeDeviceWithServices](#typedevicewithservices) +## get_with_service_details This method does not map exactly to the underlying model: it runs a larger prebuilt query, and reformats it into an easy to use and understand format. If you want more control, or to see the raw model directly, use `device.get(uuidOrId, options)` instead. -#### Args: +**Signature:** `balena.models.device.get_with_service_details(uuid_or_id, options)` ⇒ [TypeDeviceWithServices](#typedevicewithservices) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** dict: device info with associated services details. -#### Examples: +**Examples:** ```python >>> balena.models.device.get_with_service_details('0fcd753af396247e035de53b4e43eec3') ``` - -### Function: grant_support_access(uuid_or_id_or_ids, expiry_timestamp) ⇒ None +## grant_support_access Grant support access to a device until a specified time. -#### Args: +**Signature:** `balena.models.device.grant_support_access(uuid_or_id_or_ids, expiry_timestamp)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) expiry_timestamp (int): a timestamp in ms for when the support access will expire. -#### Examples: +**Examples:** ```python >>> balena.models.device.grant_support_access('49b2a76e8a8d4a2b918c08a23b423580', 1511974999000) ``` - -### Function: has(uuid_or_id) ⇒ bool +## has Check if a device exists. -#### Args: +**Signature:** `balena.models.device.has(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if device exists, False otherwise. - -### Function: has_device_url(uuid_or_id) ⇒ bool +## has_device_url Check if a device is web accessible with device urls -#### Args: +**Signature:** `balena.models.device.has_device_url(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Examples: +**Examples:** ```python >>> balena.models.device.has_device_url('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: has_lock_override(uuid_or_id) ⇒ bool +## has_lock_override Check if a device has the lock override enabled. -#### Args: +**Signature:** `balena.models.device.has_lock_override(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: lock override status. - -### Function: identify(uuid_or_id) ⇒ None +## identify Identify device. -#### Args: +**Signature:** `balena.models.device.identify(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python >>> balena.models.device.identify('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: is_in_local_mode(uuid_or_id) ⇒ bool +## is_in_local_mode Check if local mode is enabled on the device. -#### Args: +**Signature:** `balena.models.device.is_in_local_mode(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if local mode enabled, otherwise False. -#### Examples: +**Examples:** ```python >>> balena.models.device.is_in_local_mode('b6070f4fea5a4f11b4d05c1f1c3b4e72') ``` - -### Function: is_online(uuid_or_id) ⇒ bool +## is_online Check if a device is online. -#### Args: +**Signature:** `balena.models.device.is_online(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: True if the device is online, False otherwise. - -### Function: is_tracking_application_release(uuid_or_id) ⇒ bool +## is_tracking_application_release Get whether the device is configured to track the current application release. -#### Args: +**Signature:** `balena.models.device.is_tracking_application_release(uuid_or_id)` ⇒ bool + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) -#### Returns: +**Returns:** bool: is tracking the current application release. - -### Function: move(uuid_or_id, app_slug_or_uuid_or_id) ⇒ None +## move Move a device to another application. -#### Args: +**Signature:** `balena.models.device.move(uuid_or_id, app_slug_or_uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int). app_slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.device.move(123, 'RPI1Test') ``` - -### Function: pin_to_release(uuid_or_id, full_release_hash_or_id) ⇒ None +## pin_to_os_release + +Mark a specific device to be updated to a particular OS release + +**Signature:** `balena.models.device.pin_to_os_release(uuid_or_id, target_os_version)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int). + target_os_version (str): semver-compatible version for the target device. + Unsupported (unpublished) version will result in rejection. + The version **must** be the exact version number, a "prod" variant + and greater or equal to the one running on the device. + +**Examples:** +```python +>>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') +>>> balena.models.device.pin_to_os_release('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') +``` + +## pin_to_release Configures the device to run a particular release and not get updated when the current application release changes. -#### Args: +**Signature:** `balena.models.device.pin_to_release(uuid_or_id, full_release_hash_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) full_release_hash_or_id (Union[str, int]) : the hash of a successful release (string) or id (number) -#### Examples: +**Examples:** +```python +>>> balena.models.device.pin_to_release('49b2a', '45c90004de73557ded7274d4896a6db90ea61e36') +``` + +## pin_to_supervisor_release + +Set a specific device to run a particular supervisor release. +**Signature:** `balena.models.device.pin_to_supervisor_release(uuid_or_id, supervisor_version_or_id)` ⇒ None + +**Args:** + uuid_or_id (Union[str, int]): device uuid (string) or id (int) + supervisor_version_or_id (Union[str, int]): the version of a released supervisor (string) or id (number) +**Examples:** ```python ->>> balena.models.device.set_to_release('49b2a', '45c90004de73557ded7274d4896a6db90ea61e36') +>>> balena.models.device.pin_to_supervisor_release('f55dcdd9ada04b11b4d05c1f1c3b4e72', 'v13.0.0') ``` - -### Function: ping(uuid_or_id) ⇒ None +## ping Ping a device. This is useful to signal that the supervisor is alive and responding. -#### Args: +**Signature:** `balena.models.device.ping(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python >>> balena.models.device.ping('8f66ec7335dd4a97b7661faa131b1502') >>> balena.models.device.ping(1234) ``` - -### Function: purge(uuid_or_id) ⇒ None +## purge Purge device. This function clears the user application's `/data` directory. -#### Args: +**Signature:** `balena.models.device.purge(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python >>> balena.models.device.purge('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: reboot(uuid_or_id, force) ⇒ None +## reboot Reboot the device. -#### Args: +**Signature:** `balena.models.device.reboot(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python >>> balena.models.device.reboot('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: register(application_slug_or_uuid_or_id, uuid, device_type_slug) ⇒ RegisterResponse +## register Register a new device with a balena application. -#### Args: +**Signature:** `balena.models.device.register(application_slug_or_uuid_or_id, uuid, device_type_slug)` ⇒ RegisterResponse + +**Args:** application_slug_or_uuid_or_id (Union[int, str]): application slug (string), uuid (string) or id (number). uuid (str): device uuid. device_type_slug (Optional[str]): device type slug or alias. -#### Returns: +**Returns:** dict: dictionary contains device info. -#### Examples: +**Examples:** ```python >>> device_uuid = balena.models.device.generate_uuid() >>> balena.models.device.register('RPI1',device_uuid) ``` - -### Function: remove(uuid_or_id_or_ids) ⇒ None +## remove Remove device(s). -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) - -### Function: rename(uuid_or_id, new_name) ⇒ None +## rename Renames a device. -#### Args: +**Signature:** `balena.models.device.rename(uuid_or_id, new_name)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (str) or id (int) new_name (str): device new name. -#### Examples: +**Examples:** ```python >>> balena.models.device.rename(123, 'python-sdk-test-device') ``` - -### Function: restart_application(uuid_or_id) ⇒ None +## restart_application This function restarts the Docker container running the application on the device, but doesn't reboot the device itself. -#### Args: +**Signature:** `balena.models.device.restart_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. -#### Examples: +**Examples:** ```python >>> balena.models.device.restart_application('8deb12a7d7592c2b7f9e44735c2b0a41') >>> balena.models.device.restart_application(1234) ``` - -### Function: restart_service(uuid_or_id, image_id) ⇒ None +## restart_service Restart a service on device. -#### Args: +**Signature:** `balena.models.device.restart_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to restart -#### Examples: +**Examples:** ```python >>> balena.models.device.restart_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) >>> balena.models.device.restart_service(None, 392229) # if running on the device ``` - -### Function: revoke_support_access(uuid_or_id_or_ids) ⇒ None +## revoke_support_access Revoke support access to a device. -#### Args: +**Signature:** `balena.models.device.revoke_support_access(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.revoke_support_access('49b2a76e8a8d4a2b918c08a23b423580') ``` - -### Function: set_custom_location(uuid_or_id_or_ids, location) ⇒ None +## set_custom_location Set a custom location for a device. -#### Args: +**Signature:** `balena.models.device.set_custom_location(uuid_or_id_or_ids, location)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) location (dict): device custom location { 'latitude': Union[int,, str], 'longitude': Union[int, str]}. -#### Examples: +**Examples:** ```python >>> balena.models.device.set_custom_location(123, {'latitude': '21.032777','longitude': '105.831586'}) ``` - -### Function: set_note(uuid_or_id_or_ids, note) ⇒ None +## set_note Note a device. -#### Args: +**Signature:** `balena.models.device.set_note(uuid_or_id_or_ids, note)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) note (str): device note. -#### Examples: +**Examples:** ```python >>> balena.models.device.note(123, 'test note') ``` - -### Function: set_supervisor_release(uuid_or_id, supervisor_version_or_id) ⇒ None - -Set a specific device to run a particular supervisor release. -#### Args: - uuid_or_id (Union[str, int]): device uuid (string) or id (int) - supervisor_version_or_id (Union[str, int]): the version of a released supervisor (string) or id (number) -#### Examples: -```python ->>> balena.models.device.set_supervisor_release('f55dcdd9ada04b11b4d05c1f1c3b4e72', 'v13.0.0') -``` - - -### Function: shutdown(uuid_or_id, force) ⇒ None +## shutdown Shutdown the device. -#### Args: +**Signature:** `balena.models.device.shutdown(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python >>> balena.models.device.shutdown('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: start_application(uuid_or_id) ⇒ None +## start_application ***Deprecated*** Starts a user application container, usually after it has been stopped with `stop_application()`. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.start_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains started application container id. -#### Examples: +**Examples:** ```python >>> balena.models.device.start_application('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: start_os_update(uuid_or_id, target_os_version) ⇒ HUPStatusResponse +## start_os_update Start an OS update on a device. If using run_detached option, monitor progress with device.get() -- status, provisioning_state and provisioning_progress entries. -#### Args: +**Signature:** `balena.models.device.start_os_update(uuid_or_id, target_os_version)` ⇒ HUPStatusResponse + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). target_os_version (str): semver-compatible version for the target device. Unsupported (unpublished) version will result in rejection. The version **must** be the exact version number, a "prod" variant and greater than the one running on the device. run_detached (Optional[bool]): run the update in detached mode. - Default behaviour is run_detached=False but is DEPRECATED and will be - removed in a future release. Use run_detached=True for more reliable updates. + Default behaviour is run_detached=True for more reliable updates. -#### Returns: +**Returns:** HUPStatusResponse: action response. -#### Examples: +**Examples:** ```python >>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.29.2+rev1.prod') >>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1') ->>> balena.models.device.start_os_update('b6070f4fea5a4f11b4d05c1f1c3b4e72', '2.89.0+rev1', run_detached=True) ``` - -### Function: start_service(uuid_or_id, image_id) ⇒ None +## start_service Start a service on device. -#### Args: +**Signature:** `balena.models.device.start_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to start -#### Examples: +**Examples:** ```python >>> balena.models.device.start_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 1234) >>> balena.models.device.start_service(None, 1234) # if running on the device ``` - -### Function: stop_application(uuid_or_id) ⇒ None +## stop_application ***Deprecated*** Temporarily stops a user application container. @@ -2017,438 +1876,466 @@ Application container will not be removed after invoking this function and a reboot or supervisor restart will cause the container to start again. This function requires supervisor v1.8 or higher. -#### Args: +**Signature:** `balena.models.device.stop_application(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int). -#### Returns: +**Returns:** dict: dictionary contains stopped application container id. -#### Examples: +**Examples:** ```python >>> balena.models.device.stop_application('8f66ec7335dd4a97b7661faa131b1502') ``` - -### Function: stop_service(uuid_or_id, image_id) ⇒ None +## stop_service Stop a service on device. -#### Args: +**Signature:** `balena.models.device.stop_service(uuid_or_id, image_id)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. image_id (int): id of the image to stop -#### Examples: +**Examples:** ```python >>> balena.models.device.stop_service('f3887b1de5b54c6a9e6e5e3a2e57b642', 392229) >>> balena.models.device.stop_service(None, 392229) # if running on the device ``` - -### Function: track_application_release(uuid_or_id_or_ids) ⇒ None +## track_application_release Configure a specific device to track the current application release. -#### Args: +**Signature:** `balena.models.device.track_application_release(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) - -### Function: unset_custom_location(uuid_or_id_or_ids) ⇒ None +## unset_custom_location Clear the custom location of a device. -#### Args: +**Signature:** `balena.models.device.unset_custom_location(uuid_or_id_or_ids)` ⇒ None + +**Args:** uuid_or_id_or_ids (Union[str, int, List[int]]): device uuid (str) or id (int) or ids (List[int]) -#### Examples: +**Examples:** ```python >>> balena.models.device.unset_custom_location(123) ``` - -### Function: update(uuid_or_id, force) ⇒ None +## update update the device. -#### Args: +**Signature:** `balena.models.device.update(uuid_or_id, force)` ⇒ None + +**Args:** uuid_or_id (Optional[Union[str, int]]): device uuid (str) or id (int) or None for SDK running on device. force (Optional[bool]): If force is True, the update lock will be overridden. -#### Examples: +**Examples:** ```python >>> balena.models.device.update('8f66ec7335dd4a97b7661faa131b1502') ``` -## DeviceTag -This class implements device tag model for balena python SDK. +# DeviceTag - -### Function: get(uuid_or_id, tag_key) ⇒ Optional[str] +This class implements device tag model for balena python SDK. +## get Get a device tag (update tag value if it exists). ___Note___: Notice that when using the device ID rather than UUID, it will avoid one extra API roundtrip. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, tag_key)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. -#### Returns: +**Returns:** Optional[str]: tag value -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get('f5213eac0d63ac4', 'testtag') ``` - -### Function: get_all(options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all Get all device tags. -#### Args: +**Signature:** `balena.models.device.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_application Get all device tags for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all_by_application(1005160) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_device Get all device tags for a device. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.get_all_by_device('a03ab646ca5a4f11b4d05c1f1c3b4e72') ``` - -### Function: remove(uuid_or_id, tag_key) ⇒ None +## remove Remove a device tag. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, tag_key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.remove('f5213eac0d63ac477', 'testtag') ``` - -### Function: set(uuid_or_id, tag_key, value) ⇒ None +## set Set a device tag (update tag value if it exists). ___Note___: Notice that when using the device ID rather than UUID, it will avoid one extra API roundtrip. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, tag_key, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid or device id. tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test1') >>> balena.models.device.tags.set('f5213eac0d63ac4', 'testtag', 'test2') ``` -## DeviceConfigVariable -This class implements device config variable model for balena python SDK. +# DeviceConfigVariable - -### Function: get(uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements device config variable model for balena python SDK. +## get Get a device config variable. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.get('8deb12a7d7592c2b7f9e44735c2b0a41','test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device config variables for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: list of device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.get_all_by_application(5780) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device config variables belong to a device. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device config variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.get_all_by_device('f5213eac574a4fba8b9e32ab3a9cba12') ``` - -### Function: remove(uuid_or_id, key) ⇒ None +## remove Remove a device environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.device.remove(2184, 'test_env4') ``` - -### Function: set(uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a device config variable. Note that config variables must start with BALENA_ and RESIN_ prefixes. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.device.config_var.set('8deb12a7d7592c2b7f9e44735c2b0a41','BALENA_test_env4', 'testing1') ``` -## DeviceEnvVariable -This class implements device environment variable model for balena python SDK. +# DeviceEnvVariable - -### Function: get(uuid_or_id, env_var_name) ⇒ Optional[str] +This class implements device environment variable model for balena python SDK. +## get Get device environment variable. -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, env_var_name)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device environment variables for an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: list of device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.get_all_by_application(5780) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device environment variables. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.get_all_by_device('8deb12a7d7592c2b7f9e44735c2b0a41') ``` - -### Function: remove(uuid_or_id, key) ⇒ None +## remove Remove a device environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) key (str): environment variable name. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.remove(2184, 'test_env4') ``` - -### Function: set(uuid_or_id, env_var_name, value) ⇒ None +## set Set the value of a specific environment variable. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, env_var_name, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) env_var_name (str): environment variable name. value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.device.env_var.set('8deb12a7d7592c2b7f9e44735c2b0a41', 'test_env4', 'testing1') ``` -## DeviceServiceEnvVariable -This class implements device service variable model for balena python SDK. +# DeviceServiceEnvVariable - -### Function: get(uuid_or_id, service_name_or_id, key) ⇒ Optional[str] +This class implements device service variable model for balena python SDK. +## get Get the overriden value of a service variable on a device -#### Args: +**Signature:** `balena.models.device.get(uuid_or_id, service_name_or_id, key)` ⇒ Optional[str] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name -#### Returns: +**Returns:** Optional[str]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 'myservice', 'VAR') >>> balena.models.device.service_var.get('8deb12a7d7592c2b7f9e44735c2b0a41', 1234', 'VAR') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all device service environment variables belong to an application. -#### Args: +**Signature:** `balena.models.device.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get_all_by_application(1043050) ``` - -### Function: get_all_by_device(uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_device Get all device environment variables. -#### Args: +**Signature:** `balena.models.device.get_all_by_device(uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: device service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.get_all_by_device(8deb12a) ``` - -### Function: remove(uuid_or_id, service_name_or_id, key) ⇒ None +## remove Remove a device service environment variable. -#### Args: +**Signature:** `balena.models.device.remove(uuid_or_id, service_name_or_id, key)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR') >>> balena.models.device.service_var.remove('7cf02a6a016a4b3c9e3b7a8d5f46e127', 28970, 'VAR') ``` - -### Function: set(uuid_or_id, service_name_or_id, key, value) ⇒ None +## set Set the overriden value of a service variable on a device. -#### Args: +**Signature:** `balena.models.device.set(uuid_or_id, service_name_or_id, key, value)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) service_name_or_id (Union[str, int]): service name (string) or service id (number) key (str): variable name value (str): variable value -#### Examples: +**Examples:** ```python >>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 'myservice', 'VAR', 'override') >>> balena.models.device.service_var.set('7cf02a6a016a4b3c9e3b7a8d5f46e127', 123, 'VAR', 'override') ``` -## DeviceHistory -This class implements device history model for balena python SDK. +# DeviceHistory - -### Function: get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options) ⇒ [List[DeviceHistoryType]](#devicehistorytype) +This class implements device history model for balena python SDK. +## get_all_by_application Get all device history entries for an application. -#### Args: +**Signature:** `balena.models.history.get_all_by_application(slug_or_uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago to_date (datetime): history entries younger or equal to this date. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[DeviceHistoryType]: device history entries. -#### Examples: +**Examples:** ```python >>> balena.models.device.history.get_all_by_application('myorg/myapp') >>> balena.models.device.history.get_all_by_application(11196426) @@ -2462,21 +2349,22 @@ Get all device history entries for an application. ... ) ``` - -### Function: get_all_by_device(uuid_or_id, from_date, to_date, options) ⇒ [List[DeviceHistoryType]](#devicehistorytype) +## get_all_by_device Get all device history entries for a device. -#### Args: +**Signature:** `balena.models.history.get_all_by_device(uuid_or_id, from_date, to_date, options)` ⇒ [List[DeviceHistoryType]](#devicehistorytype) + +**Args:** uuid_or_id (str): device uuid (32 / 62 digits string) or id (number) __note__: No short IDs supported from_date (datetime): history entries newer than or equal to this timestamp. Defaults to 7 days ago to_date (datetime): history entries younger or equal to this date. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[DeviceHistoryType]: device history entries. -#### Examples: +**Examples:** ```python >>> balena.models.device.history.get_all_by_device('6046335305c8142883a4466d30abe211') >>> balena.models.device.history.get_all_by_device(11196426) @@ -2489,538 +2377,574 @@ Get all device history entries for a device. ... to_date=from_date = datetime.utcnow() + timedelta(days=-5)) ... ) ``` -## DeviceType -This class implements user API key model for balena python SDK. +# DeviceType - -### Function: get(id_or_slug, options) ⇒ [DeviceTypeType](#devicetypetype) +This class implements user API key model for balena python SDK. +## get Get a single device type. -#### Args: +**Signature:** `balena.models.device_type.get(id_or_slug, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** id_or_slug (Union[str, int]): device type slug or alias (string) or id (int). options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** DeviceTypeType: Returns the device type - -### Function: get_all(options) ⇒ [List[DeviceTypeType]](#devicetypetype) +## get_all Get all device types. -#### Args: +**Signature:** `balena.models.device_type.get_all(options)` ⇒ [List[DeviceTypeType]](#devicetypetype) + +**Args:** options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[DeviceTypeType]: list contains info of device types. - -### Function: get_all_supported(options) ⇒ None +## get_all_supported Get all supported device types. -#### Args: +**Signature:** `balena.models.device_type.get_all_supported(options)` ⇒ None + +**Args:** options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[DeviceTypeType]: list contains info of all supported device types. - -### Function: get_by_slug_or_name(slug_or_name, options) ⇒ [DeviceTypeType](#devicetypetype) +## get_by_slug_or_name Get a single device type by slug or name. -#### Args: +**Signature:** `balena.models.device_type.get_by_slug_or_name(slug_or_name, options)` ⇒ [DeviceTypeType](#devicetypetype) + +**Args:** slug_or_name (str): device type slug or name. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** DeviceTypeType: Returns the device type - -### Function: get_name(slug) ⇒ str +## get_name Get display name for a device. -#### Args: +**Signature:** `balena.models.device_type.get_name(slug)` ⇒ str + +**Args:** slug (str): device type slug. - -### Function: get_slug_by_name(name) ⇒ str +## get_slug_by_name Get device slug. -#### Args: +**Signature:** `balena.models.device_type.get_slug_by_name(name)` ⇒ str + +**Args:** name (str): device type name. -## ApiKey -This class implements user API key model for balena python SDK. +# ApiKey - -### Function: create(name, description, expiry_date) ⇒ str +This class implements user API key model for balena python SDK. +## create This method registers a new api key for the current user with the name given. -#### Args: +**Signature:** `balena.models.api_key.create(name, description, expiry_date)` ⇒ str + +**Args:** name (str): the API key name description (Optional[str]): the API key description expiry_date (Optional[str]): the API key expiring date -#### Returns: +**Returns:** str: API key -#### Examples: +**Examples:** ```python >>> balena.models.api_key.create_api_key("myApiKey") >>> balena.models.api_key.create_api_key("myApiKey", "my api key description") >>> balena.models.api_key.create_api_key("myApiKey", "my descr", datetime.datetime.utcnow().isoformat()) ``` - -### Function: get_all(options) ⇒ [List[APIKeyType]](#apikeytype) +## get_all This function gets all API keys. -#### Args: +**Signature:** `balena.models.api_key.get_all(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[APIKeyType]: user API key -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_all() ``` - -### Function: get_all_named_user_api_keys(options) ⇒ [List[APIKeyType]](#apikeytype) +## get_all_named_user_api_keys Get all named user API keys of the current user. -#### Args: +**Signature:** `balena.models.api_key.get_all_named_user_api_keys(options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_all_named_user_api_keys() ``` - -### Function: get_device_api_keys_by_device(uuid_or_id, options) ⇒ [List[APIKeyType]](#apikeytype) +## get_device_api_keys_by_device Get all API keys for a device. -#### Args: +**Signature:** `balena.models.api_key.get_device_api_keys_by_device(uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** device_uuid (Union[str, int]): device, uuid (string) or id (int) options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_device_api_keys_by_device("44cc9d186") >>> balena.models.api_key.get_device_api_keys_by_device(1111386) ``` - -### Function: get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options) ⇒ [List[APIKeyType]](#apikeytype) +## get_provisioning_api_keys_by_application Get all provisioning API keys for an application. -#### Args: +**Signature:** `balena.models.api_key.get_provisioning_api_keys_by_application(slug_or_uuid_or_id, options)` ⇒ [List[APIKeyType]](#apikeytype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.api_key.get_provisioning_api_keys_by_application(1296047) >>> balena.models.api_key.get_provisioning_api_keys_by_application("myorg/myapp") ``` - -### Function: revoke(id) ⇒ None +## revoke This function revokes an API key. -#### Args: +**Signature:** `balena.models.api_key.revoke(id)` ⇒ None + +**Args:** id (int): API key id. -#### Examples: +**Examples:** ```python >>> balena.models.api_key.revoke(1296047) ``` - -### Function: update(id, api_key_info) ⇒ None +## update This function updates details of an API key. -#### Args: +**Signature:** `balena.models.api_key.update(id, api_key_info)` ⇒ None + +**Args:** id (str): API key id. api_key_info (APIKeyInfoType): new API key info. -#### Examples: +**Examples:** ```python >>> balena.models.api_key.update(1296047, {"name":"new name"}) ``` -## Key -This class implements ssh key model for balena python SDK. +# Key - -### Function: create(title, key) ⇒ [SSHKeyType](#sshkeytype) +This class implements ssh key model for balena python SDK. +## create Create a ssh key. -#### Args: +**Signature:** `balena.models.key.create(title, key)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** title (str): key title. key (str): the public ssh key. -#### Returns: +**Returns:** SSHKeyType: new ssh key id. - -### Function: get(id) ⇒ [SSHKeyType](#sshkeytype) +## get Get a single ssh key. -#### Args: +**Signature:** `balena.models.key.get(id)` ⇒ [SSHKeyType](#sshkeytype) + +**Args:** id (int): key id. -#### Returns: +**Returns:** SSHKeyType: ssh key info. - -### Function: get_all(options) ⇒ [List[SSHKeyType]](#sshkeytype) +## get_all Get all ssh keys. -#### Args: +**Signature:** `balena.models.key.get_all(options)` ⇒ [List[SSHKeyType]](#sshkeytype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[SSHKeyType]: list of ssh keys. - -### Function: remove(id) ⇒ None +## remove Remove a ssh key. -#### Args: +**Signature:** `balena.models.key.remove(id)` ⇒ None + +**Args:** id (int): key id. -## Organization -This class implements organization model for balena python SDK. +# Organization - -### Function: create(name, handle, logo_image) ⇒ [OrganizationType](#organizationtype) +This class implements organization model for balena python SDK. +## create Creates a new organization. -#### Args: +**Signature:** `balena.models.organization.create(name, handle, logo_image)` ⇒ [OrganizationType](#organizationtype) + +**Args:** name (str): the name of the organization that will be created. handle (Optional[str]): The handle of the organization that will be created. logo_image (Optional[io.BufferedReader]): The organization logo to be used. -#### Returns: +**Returns:** dict: organization info. -#### Examples: +**Examples:** ```python >>> balena.models.organization.create('My Org', 'test_org') >>> with open('mypath/myfile.png', 'rb') as f: >>> org = sdk.models.organization.create("my-name", None, f) ``` - -### Function: get(handle_or_id, options) ⇒ [OrganizationType](#organizationtype) +## get Get a single organization. -#### Args: +**Signature:** `balena.models.organization.get(handle_or_id, options)` ⇒ [OrganizationType](#organizationtype) + +**Args:** handle_or_id (str): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** dict: organization info. -#### Raises: +**Raises:** OrganizationNotFound: if organization couldn't be found. -#### Examples: +**Examples:** ```python >>> balena.models.organization.get(26474) >>> balena.models.organization.get('myorg') ``` - -### Function: get_all(options) ⇒ [List[OrganizationType]](#organizationtype) +## get_all Get all organizations. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationType]](#organizationtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationType]: list contains information of organizations. -#### Examples: +**Examples:** ```python >>> balena.models.organization.get_all() ``` - -### Function: remove(handle_or_id) ⇒ None +## remove Remove an organization. -#### Args: +**Signature:** `balena.models.organization.remove(handle_or_id)` ⇒ None + +**Args:** handle_or_id (str): organization handle (string) or id (number). -#### Examples: +**Examples:** ```python >>> balena.models.organization.remove(148003) ``` -## OrganizationMembership -This class implements organization membership model for balena python SDK. +# OrganizationMembership - -### Function: get(membership_id, options) ⇒ [OrganizationMembershipType](#organizationmembershiptype) +This class implements organization membership model for balena python SDK. +## get Get a single organization membership. -#### Args: +**Signature:** `balena.models.organization.get(membership_id, options)` ⇒ [OrganizationMembershipType](#organizationmembershiptype) + +**Args:** membership_id (ResourceKey): the id (int) or an object with the unique `user` & `is_member_of__organization` numeric pair of the membership options (AnyObject): extra pine options to use -#### Returns: +**Returns:** Organization membership. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.get(17608) ``` - -### Function: get_all(options) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) +## get_all Get all organization memberships. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipType]: organization memberships. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) +## get_all_by_organization Get all memberships by organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipType]](#organizationmembershiptype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipType]: organization memberships. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.get_all_by_organization(3014) ``` -## OrganizationMembershipTag -This class implements organization membership tag model for balena python SDK. +# OrganizationMembershipTag - -### Function: get(membership_id, tag_key) ⇒ Optional[str] +This class implements organization membership tag model for balena python SDK. +## get Get an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.get(membership_id, tag_key)` ⇒ Optional[str] + +**Args:** membership_id: organization membership id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get(17608, 'mTag1') ``` - -### Function: get_all(options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all Get all organization membership tags. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all_by_organization Get all organization membership tags for an organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationMembershipTagType]: organization membership tags. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all_by_organization(3014) ``` - -### Function: get_all_by_organization_membership(membership_id, options) ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) +## get_all_by_organization_membership Get all organization membership tags for a memberships of an organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization_membership(membership_id, options)` ⇒ [List[OrganizationMembershipTagType]](#organizationmembershiptagtype) + +**Args:** membership_id (int): organization membership id. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: organization membership tags. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.get_all_by_organization_membership(17608) ``` - -### Function: remove(membership_id, tag_key) ⇒ None +## remove Remove an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.remove(membership_id, tag_key)` ⇒ None + +**Args:** membership_id: organization membership id. tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.remove(17608, 'mTag1') ``` - -### Function: set(membership_id, tag_key, value) ⇒ None +## set Set an organization membership tag. -#### Args: +**Signature:** `balena.models.organization.set(membership_id, tag_key, value)` ⇒ None + +**Args:** membership_id: organization membership id. tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.organization.memberships.tags.set(17608, 'mTag1', 'Python SDK') ``` -## OrganizationInvite -This class implements organization invite model for balena python SDK. +# OrganizationInvite - -### Function: accept(invite_token) ⇒ None +This class implements organization invite model for balena python SDK. +## accept Accepts an invite. -#### Args: +**Signature:** `balena.models.organization.accept(invite_token)` ⇒ None + +**Args:** invite_token (str): invitation Token - invite token. - -### Function: create(handle_or_id, invitee, role_name, message) ⇒ [OrganizationInviteType](#organizationinvitetype) +## create Creates a new invite for an organization. -#### Args: +**Signature:** `balena.models.organization.create(handle_or_id, invitee, role_name, message)` ⇒ [OrganizationInviteType](#organizationinvitetype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string), or id (number). invitee (str): the email/balena_username of the invitee. role_name (Optional[str]): the role name to be granted to the invitee. message (Optional[str]): the message to send along with the invite. -#### Returns: +**Returns:** OrganizationInviteType: organization invite. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.create(26474, 'invitee@example.org', 'member', 'Test invite') ``` - -### Function: get_all(options) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) +## get_all Get all invites. -#### Args: +**Signature:** `balena.models.organization.get_all(options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[OrganizationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.get_all() ``` - -### Function: get_all_by_organization(handle_or_id, options) ⇒ [List[OrganizationInviteType]](#organizationinvitetype) +## get_all_by_organization Get all invites by organization. -#### Args: +**Signature:** `balena.models.organization.get_all_by_organization(handle_or_id, options)` ⇒ [List[OrganizationInviteType]](#organizationinvitetype) + +**Args:** handle_or_id (Union[str, int]): organization handle (string), or id (number). options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** List[OrganizationInviteType]: list contains info of invites. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.get_all_by_organization(26474) ``` - -### Function: revoke(invite_id) ⇒ None +## revoke Revoke an invite. -#### Args: +**Signature:** `balena.models.organization.revoke(invite_id)` ⇒ None + +**Args:** invite_id (int): organization invite id. -#### Examples: +**Examples:** ```python >>> balena.models.organization.invite.revoke(2862) ``` -## DeviceOs -This class implements device os model for balena python SDK. +# DeviceOs - -### Function: download(device_type, version, options) ⇒ None +This class implements device os model for balena python SDK. +## download Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.download(device_type, version, options)` ⇒ None + +**Args:** device_type (str): device type slug. version (str): semver-compatible version or 'latest', defaults to 'latest'. * The version **must** be the exact version number. options (DownloadConfig): OS configuration options to use. -#### Returns: +**Returns:** float: OS image download size, in bytes. Example: @@ -3032,35 +2956,38 @@ Example: ... f.write(chunk) ``` - -### Function: get_all_os_versions(device_type, options) ⇒ None +## get_all_os_versions Get all OS versions for the provided device type(s), inlcuding invalidated ones -#### Args: +**Signature:** `balena.models.os.get_all_os_versions(device_type, options)` ⇒ None + +**Args:** device_type (Union[str, List[str]]): device type slug. options (AnyObject): extra pine options to use -#### Returns: +**Returns:** list: balenaOS versions. - -### Function: get_available_os_versions(device_type) ⇒ None +## get_available_os_versions Get the supported OS versions for the provided device type(s) -#### Args: +**Signature:** `balena.models.os.get_available_os_versions(device_type)` ⇒ None + +**Args:** device_type (Union[str, List[str]]): device type slug. -#### Returns: +**Returns:** list: balenaOS versions. - -### Function: get_config(slug_or_uuid_or_id, options) ⇒ None +## get_config Download application config.json. -#### Args: +**Signature:** `balena.models.os.get_config(slug_or_uuid_or_id, options)` ⇒ None + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (ImgConfigOptions): OS configuration dict to use. The available options are listed below: @@ -3078,31 +3005,33 @@ Download application config.json. version (str): Required: the OS version of the image. developmentMode (Optional[bool]): If the device should be in development mode. -#### Returns: +**Returns:** dict: application config.json content. -#### Raises: +**Raises:** ApplicationNotFound: if application couldn't be found. - -### Function: get_download_size(device_type, version) ⇒ float +## get_download_size Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.get_download_size(device_type, version)` ⇒ float + +**Args:** device_type (str): device type slug. version (str): semver-compatible version or 'latest', defaults to 'latest'. * The version **must** be the exact version number. -#### Returns: +**Returns:** float: OS image download size, in bytes. - -### Function: get_max_satisfying_version(device_type, version_or_range, os_type) ⇒ Optional[str] +## get_max_satisfying_version Get OS download size estimate. Currently only the raw (uncompressed) size is reported. -#### Args: +**Signature:** `balena.models.os.get_max_satisfying_version(device_type, version_or_range, os_type)` ⇒ Optional[str] + +**Args:** device_type (str): device type slug. version_or_range (str): can be one of the exact version number, in which case it is returned if the version is supported, @@ -3119,19 +3048,20 @@ Get OS download size estimate. Currently only the raw (uncompressed) size is rep Defaults to `'latest'` os_type (Optional[Literal["default", "esr"]]): The used OS type. -#### Returns: +**Returns:** float: OS image download size, in bytes. - -### Function: get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options) ⇒ [List[ReleaseType]](#releasetype) +## get_supervisor_releases_for_cpu_architecture Returns the Releases of the supervisor for the CPU Architecture -#### Args: +**Signature:** `balena.models.os.get_supervisor_releases_for_cpu_architecture(cpu_architecture_slug_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** cpu_architecture_slug_or_id (Union[str, int]): The slug (string) or id (number) for the CPU Architecture. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** ReleaseType: release info. @@ -3142,463 +3072,496 @@ Example: { $filter: { raw_version: '12.11.0' } }, ); - -### Function: get_supported_os_update_versions(device_type, current_version) ⇒ None +## get_supported_os_update_versions Get OS supported versions. -#### Args: +**Signature:** `balena.models.os.get_supported_os_update_versions(device_type, current_version)` ⇒ None + +**Args:** device_type (str): device type slug. current_version (str): device type slug. - -### Function: is_architecture_compatible_with(os_architecture, application_architecture) ⇒ None +## is_architecture_compatible_with Returns whether the specified OS architecture is compatible with the target architecture. -#### Args: +**Signature:** `balena.models.os.is_architecture_compatible_with(os_architecture, application_architecture)` ⇒ None + +**Args:** os_architecture (str): The OS's architecture as specified in its device type. application_architecture (str): The application's architecture as specified in its device type. -#### Returns: +**Returns:** bool: Whether the specified OS architecture is capable of running applications build for the target architecture. - -### Function: is_supported_os_update(device_type, current_version, target_version) ⇒ bool +## is_supported_os_update Returns the supported OS update targets for the provided device type. -#### Args: +**Signature:** `balena.models.os.is_supported_os_update(device_type, current_version, target_version)` ⇒ bool + +**Args:** device_type (str): device type slug. current_version (str): emver-compatible version for the starting OS version target_version (str): semver-compatible version for the target OS version -## Config -This class implements configuration model for balena python SDK. +# Config - -### Function: get_all() ⇒ ConfigType +This class implements configuration model for balena python SDK. +## get_all Get all configuration. -#### Returns: +**Signature:** `balena.models.config.get_all()` ⇒ ConfigType + +**Returns:** ConfigType: configuration information. -#### Examples: +**Examples:** ```python >>> balena.models.config.get_all() ``` -## Release -This class implements release model for balena python SDK. +# Release - -### Function: create_from_url(slug_or_uuid_or_id, url, flatten_tarball) ⇒ int +This class implements release model for balena python SDK. +## create_from_url Create a new release built from the source in the provided url. -#### Args: +**Signature:** `balena.models.release.create_from_url(slug_or_uuid_or_id, url, flatten_tarball)` ⇒ int + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). url (str): a url with a tarball of the project to build. flatten_tarball (bool): Should be true when the tarball includes an extra root folder with all the content. -#### Returns: +**Returns:** int: release Id. - -### Function: finalize(commit_or_id_or_raw_version) ⇒ None +## finalize Finalizes a draft release. -#### Args: +**Signature:** `balena.models.release.finalize(commit_or_id_or_raw_version)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) - -### Function: get(commit_or_id_or_raw_version, options) ⇒ [ReleaseType](#releasetype) +## get Get a specific release. -#### Args: +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, options)` ⇒ [ReleaseType](#releasetype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or id (number) or an object with the unique `application` (number or string) & `rawVersion` (string) pair of the release options options(AnyObject): extra pine options to use -#### Returns: +**Returns:** ReleaseType: release info. - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ReleaseType]](#releasetype) +## get_all_by_application Get all releases from an application. -#### Args: +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ReleaseType]](#releasetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ReleaseType]: release info. - -### Function: get_latest_by_application(slug_or_uuid_or_id, options) ⇒ [Optional[ReleaseType]](#releasetype) +## get_latest_by_application Get the latest successful release for an application. -#### Args: +**Signature:** `balena.models.release.get_latest_by_application(slug_or_uuid_or_id, options)` ⇒ [Optional[ReleaseType]](#releasetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number). options (AnyObject): extra pine options to use -#### Returns: +**Returns:** Optional[ReleaseType]: release info. - -### Function: get_with_image_details(commit_or_id_or_raw_version, image_options, release_options) ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) +## get_with_image_details Get a specific release with the details of the images built. -#### Args: +**Signature:** `balena.models.release.get_with_image_details(commit_or_id_or_raw_version, image_options, release_options)` ⇒ [ReleaseWithImageDetailsType](#releasewithimagedetailstype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) image_options (AnyObject): extra pine options to use on image expand release_options (AnyObject): extra pine options to use on release expand -#### Returns: +**Returns:** dict: release info. -#### Raises: +**Raises:** ReleaseNotFound: if release couldn't be found. - -### Function: set_is_invalidated(commit_or_id_or_raw_version, is_invalidated) ⇒ None +## set_is_invalidated Set the is_invalidated property of a release to True or False. -#### Args: +**Signature:** `balena.models.release.set_is_invalidated(commit_or_id_or_raw_version, is_invalidated)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) is_invalidated (bool): True for invalidated, False for validated. - -### Function: set_known_issue_list(commit_or_id_or_raw_version, known_issue_list) ⇒ None +## set_known_issue_list Set a known issue list for a release. -#### Args: +**Signature:** `balena.models.release.set_known_issue_list(commit_or_id_or_raw_version, known_issue_list)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) known_issue_list (Optional[str]): the known issue list. - -### Function: set_note(commit_or_id_or_raw_version, note) ⇒ None +## set_note Set a note for a release. -#### Args: +**Signature:** `balena.models.release.set_note(commit_or_id_or_raw_version, note)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) note (Optional[str]): the note. - -### Function: set_release_version(commit_or_id, semver) ⇒ None +## set_release_version Set a direct semver for a given release. -#### Args: +**Signature:** `balena.models.release.set_release_version(commit_or_id, semver)` ⇒ None + +**Args:** commit_or_id(Union[str, int]): release commit (string) or id (int) semver (str): the version to be released, must be a valid semver -## ReleaseTag -This class implements release tag model for balena python SDK. +# ReleaseTag - -### Function: get(commit_or_id_or_raw_version, tag_key) ⇒ Optional[str] +This class implements release tag model for balena python SDK. +## get Get a single release tag. -#### Args: +**Signature:** `balena.models.release.get(commit_or_id_or_raw_version, tag_key)` ⇒ Optional[str] + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get(465307, 'releaseTag1') ``` - -### Function: get_all(options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all Get all release tags. -#### Args: +**Signature:** `balena.models.release.get_all(options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all() ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_application Get all device tags for an application. -#### Args: +**Signature:** `balena.models.release.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** slug_or_uuid_or_id (int): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all_by_application(1005160) ``` - -### Function: get_all_by_release(commit_or_id_or_raw_version, options) ⇒ [List[BaseTagType]](#basetagtype) +## get_all_by_release Get all release tags for a release. -#### Args: +**Signature:** `balena.models.release.get_all_by_release(commit_or_id_or_raw_version, options)` ⇒ [List[BaseTagType]](#basetagtype) + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[BaseTagType]: tags list. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.get_all_by_release(135) ``` - -### Function: remove(commit_or_id_or_raw_version, tag_key) ⇒ None +## remove Remove a release tag. -#### Args: +**Signature:** `balena.models.release.remove(commit_or_id_or_raw_version, tag_key)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.remove(135, 'releaseTag1') ``` - -### Function: set(commit_or_id_or_raw_version, tag_key, value) ⇒ None +## set Set a release tag (update tag value if it exists). -#### Args: +**Signature:** `balena.models.release.set(commit_or_id_or_raw_version, tag_key, value)` ⇒ None + +**Args:** commit_or_id_or_raw_version(Union[str, int, ReleaseRawVersionApplicationPair]): release commit (string) or tag_key (str): tag key. value (str): tag value. -#### Examples: +**Examples:** ```python >>> balena.models.release.tags.set(465307, 'releaseTag1', 'Python SDK') ``` -## Service -This class implements service model for balena python SDK. +# Service - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[ServiceType]](#servicetype) +This class implements service model for balena python SDK. +## get_all_by_application Get all services from an application. -#### Args: +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[ServiceType]](#servicetype) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[ServiceType]: service info. -## ServiceEnvVariable -This class implements Service environment variable model for balena python SDK. +# ServiceEnvVariable - -### Function: get(service_id_or_natural_key, key) ⇒ Optional[str] +This class implements Service environment variable model for balena python SDK. +## get Get the value of a specific service variable -#### Args: +**Signature:** `balena.models.service.get(service_id_or_natural_key, key)` ⇒ Optional[str] + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get(1234,'test_env4') >>> balena.models.service.var.get({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') ``` - -### Function: get_all_by_application(slug_or_uuid_or_id, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_application Get all service variables by application. -#### Args: +**Signature:** `balena.models.service.get_all_by_application(slug_or_uuid_or_id, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** slug_or_uuid_or_id (Union[str, int]): application slug (string), uuid (string) or id (number) options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: application environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get_all_by_application(9020) >>> balena.models.service.var.get_all_by_application("myorg/myslug") ``` - -### Function: get_all_by_service(service_id_or_natural_key, options) ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) +## get_all_by_service Get all variables for a service. -#### Args: +**Signature:** `balena.models.service.get_all_by_service(service_id_or_natural_key, options)` ⇒ [List[EnvironmentVariableBase]](#environmentvariablebase) + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name options (AnyObject): extra pine options to use -#### Returns: +**Returns:** List[EnvironmentVariableBase]: service environment variables. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.get_all_by_service(1234) >>> balena.models.service.var.get_all_by_service({'application': 'myorg/myapp', 'service_name': 'service'}) ``` - -### Function: remove(service_id_or_natural_key, key) ⇒ None +## remove Clear the value of a specific service variable -#### Args: +**Signature:** `balena.models.service.remove(service_id_or_natural_key, key)` ⇒ None + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name -#### Examples: +**Examples:** ```python >>> balena.models.service.var.remove({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR') >>> balena.models.service.var.remove(1234,'test_env4') ``` - -### Function: set(service_id_or_natural_key, key, value) ⇒ None +## set Set the value of a specific application environment variable. -#### Args: +**Signature:** `balena.models.service.set(service_id_or_natural_key, key, value)` ⇒ None + +**Args:** service_id_or_natural_key (Union[int, ServiceNaturalKey]): service id (number) or appliation-service_name key (str): variable name value (str): environment variable value. -#### Examples: +**Examples:** ```python >>> balena.models.service.var.set({'application': 'myorg/myapp', 'service_name': 'service'}, 'VAR', 'value') >>> balena.models.service.var.set(1234,'test_env4', 'value') ``` -## Image -This class implements image model for balena python SDK. +# Image - -### Function: get(id, options) ⇒ [ImageType](#imagetype) +This class implements image model for balena python SDK. +## get Get a specific image. -#### Args: +**Signature:** `balena.models.image.get(id, options)` ⇒ [ImageType](#imagetype) + +**Args:** id (int): image id. options (AnyObject): extra pine options to use. -#### Returns: +**Returns:** ImageType: image info. - -### Function: get_logs(id) ⇒ str +## get_logs Get the build log from an image. -#### Args: +**Signature:** `balena.models.image.get_logs(id)` ⇒ str + +**Args:** id (str): image id. -#### Returns: +**Returns:** str: build log. -## Auth -This class implements all authentication functions for balena python SDK. +# Auth - -### Function: authenticate() ⇒ str +This class implements all authentication functions for balena python SDK. +## authenticate This function authenticates provided credentials information. You should use Auth.login when possible, as it takes care of saving the Auth Token and username as well. -#### Args: +**Signature:** `balena.auth.authenticate()` ⇒ str + +**Args:** **credentials: credentials keyword arguments. username (str): Balena username. password (str): Password. -#### Returns: +**Returns:** str: Auth Token, -#### Examples: +**Examples:** ```python >>> balena.auth.authenticate(username='', password='') ``` - -### Function: get_actor_id() ⇒ int +## get_actor_id Get current logged in actor id. -#### Returns: +**Signature:** `balena.auth.get_actor_id()` ⇒ int + +**Returns:** int: actor id -#### Examples: +**Examples:** ```python # If you are logged in. >>> balena.auth.get_actor_id() ``` - -### Function: get_token() ⇒ Optional[str] +## get_token This function retrieves Auth Token. -#### Returns: +**Signature:** `balena.auth.get_token()` ⇒ Optional[str] + +**Returns:** str: Auth Token. -#### Examples: +**Examples:** ```python >>> balena.auth.get_token() ``` - -### Function: get_user_info() ⇒ UserInfo +## get_user_info Get current logged in user's info -#### Returns: +**Signature:** `balena.auth.get_user_info()` ⇒ UserInfo + +**Returns:** UserInfo: user info. -#### Examples: +**Examples:** ```python # If you are logged in as a user. >>> balena.auth.get_user_info() ``` - -### Function: is_logged_in() ⇒ bool +## is_logged_in This function checks if you're logged in -#### Returns: +**Signature:** `balena.auth.is_logged_in()` ⇒ bool + +**Returns:** bool: True if logged in, False otherwise. -#### Examples: +**Examples:** ```python # Check if user logged in. >>> if balena.auth.is_logged_in(): @@ -3607,17 +3570,18 @@ This function checks if you're logged in ... print('You are not logged in!') ``` - -### Function: login() ⇒ None +## login This function is used for logging into balena using email and password. -#### Args: +**Signature:** `balena.auth.login()` ⇒ None + +**Args:** **credentials: credentials keyword arguments. username (str): Balena email. password (str): Password. -#### Examples: +**Examples:** ```python >>> from balena import Balena ... balena = Balena() @@ -3627,19 +3591,20 @@ This function is used for logging into balena using email and password. ... balena.auth.login(username='', password='') ``` - -### Function: login_with_token(token) ⇒ None +## login_with_token This function is used for logging into balena using Auth Token. Auth Token can be found in Preferences section on balena Dashboard. -#### Args: +**Signature:** `balena.auth.login_with_token(token)` ⇒ None + +**Args:** token (str): Auth Token. -#### Returns: +**Returns:** This functions saves Auth Token to Settings and returns nothing. -#### Examples: +**Examples:** ```python >>> from balena import Balena >>> balena = Balena() @@ -3647,63 +3612,67 @@ Auth Token can be found in Preferences section on balena Dashboard. >>> balena.auth.login_with_token(auth_token) ``` - -### Function: logout() ⇒ None +## logout This function is used for logging out from balena. -#### Examples: +**Signature:** `balena.auth.logout()` ⇒ None + +**Examples:** ```python # If you are logged in. >>> balena.auth.logout() ``` - -### Function: register() ⇒ str +## register This function is used for registering to balena. -#### Args: +**Signature:** `balena.auth.register()` ⇒ str + +**Args:** **credentials: credentials keyword arguments. email (str): email to register. password (str): Password. -#### Returns: +**Returns:** str: Auth Token for new account. -#### Examples: +**Examples:** ```python >>> credentials = {'email': '', 'password': ''} >>> balena.auth.register(**credentials) ``` - -### Function: whoami() ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] +## whoami Return current logged in username. -#### Returns: +**Signature:** `balena.auth.whoami()` ⇒ Union[UserKeyWhoAmIResponse, ApplicationKeyWhoAmIResponse, DeviceKeyWhoAmIResponse, None] + +**Returns:** Optional[WhoamiResult]: current logged in information -#### Examples: +**Examples:** ```python >>> balena.auth.whoami() ``` -## TwoFactorAuth -This class implements basic 2FA functionalities for balena python SDK. +# TwoFactorAuth - -### Function: challenge(code) ⇒ None +This class implements basic 2FA functionalities for balena python SDK. +## challenge Challenge two-factor authentication. If your account has two-factor authentication enabled and logging in using credentials, you need to pass two-factor authentication before being allowed to use other functions. -#### Args: +**Signature:** `balena.twofactor_auth.challenge(code)` ⇒ None + +**Args:** code (str): two-factor authentication code. -#### Examples: +**Examples:** ```python # You need to enable two-factor authentication on dashboard first. # Check if two-factor authentication is passed for current session. @@ -3715,146 +3684,158 @@ False True ``` - -### Function: disable(password) ⇒ str +## disable Disable two factor authentication. __Note__: Disable will only work when using a token that has 2FA enabled. -#### Args: +**Signature:** `balena.twofactor_auth.disable(password)` ⇒ str + +**Args:** password (str): password. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.disable('your_password') ``` - -### Function: enable(code) ⇒ str +## enable Enable two factor authentication. -#### Args: +**Signature:** `balena.twofactor_auth.enable(code)` ⇒ str + +**Args:** code (str): two-factor authentication code. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.enable('123456') ``` - -### Function: get_setup_key() ⇒ str +## get_setup_key Retrieves a setup key for enabling two factor authentication. This value should be provided to your 2FA app in order to get a token. This function only works if you disable two-factor authentication or log in using Auth Token from dashboard. -#### Returns: +**Signature:** `balena.twofactor_auth.get_setup_key()` ⇒ str + +**Returns:** str: setup key. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.get_setup_key() ``` - -### Function: is_enabled() ⇒ bool +## is_enabled Check if two-factor authentication is enabled. -#### Returns: +**Signature:** `balena.twofactor_auth.is_enabled()` ⇒ bool + +**Returns:** bool: True if enabled. Otherwise False. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.is_enabled() ``` - -### Function: is_passed() ⇒ bool +## is_passed Check if two-factor authentication challenge was passed. If the user does not have 2FA enabled, this will be True. -#### Returns: +**Signature:** `balena.twofactor_auth.is_passed()` ⇒ bool + +**Returns:** bool: True if passed. Otherwise False. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.is_passed() ``` - -### Function: verify(code) ⇒ str +## verify Verifies two factor authentication. Note that this method not update the token automatically. You should use balena.twofactor_auth.challenge() when possible, as it takes care of that as well. -#### Args: +**Signature:** `balena.twofactor_auth.verify(code)` ⇒ str + +**Args:** code (str): two-factor authentication code. -#### Returns: +**Returns:** str: session token. -#### Examples: +**Examples:** ```python >>> balena.twofactor_auth.verify('123456') ``` -## Logs -This class implements functions that allow processing logs from device. +# Logs - -### Function: history(uuid_or_id, count) ⇒ List[Log] +This class implements functions that allow processing logs from device. +## history Get device logs history. -#### Args: +**Signature:** `balena.logs.history(uuid_or_id, count)` ⇒ List[Log] + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. - -### Function: stop() ⇒ None +## stop Will grecefully unsubscribe from all devices and stop the consumer thread. +**Signature:** `balena.logs.stop()` ⇒ None + - -### Function: subscribe(uuid_or_id, callback, error, count) ⇒ None +## subscribe Subscribe to device logs. -#### Args: +**Signature:** `balena.logs.subscribe(uuid_or_id, callback, error, count)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) callback (Callable[[Log], None]): this callback is called on receiving a message. error (Optional[Callable[[Any], None]]): this callback is called on an error event. count (Optional[Union[int, Literal["all"]]]): number of historical messages to include. - -### Function: unsubscribe(uuid_or_id) ⇒ None +## unsubscribe Unsubscribe from device logs for a specific device. -#### Args: +**Signature:** `balena.logs.unsubscribe(uuid_or_id)` ⇒ None + +**Args:** uuid_or_id (Union[str, int]): device uuid (string) or id (int) - -### Function: unsubscribe_all() ⇒ None +## unsubscribe_all Unsubscribe all subscribed devices. -## Settings +**Signature:** `balena.logs.unsubscribe_all()` ⇒ None + + +# Settings Create a module object. The name must be a string; the optional doc argument can have any type. -## Types -### APIKeyInfoType +# Types +## APIKeyInfoType ```python @@ -3866,7 +3847,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### APIKeyType +## APIKeyType ```python @@ -3881,7 +3862,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ActorType +## ActorType ```python @@ -3896,7 +3877,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationHostedOnApplication +## ApplicationHostedOnApplication ```python @@ -3907,7 +3888,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationInviteType +## ApplicationInviteType ```python @@ -3923,7 +3904,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationMembershipRoleType +## ApplicationMembershipRoleType ```python @@ -3934,7 +3915,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationMembershipType +## ApplicationMembershipType ```python @@ -3947,7 +3928,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ApplicationType +## ApplicationType ```python @@ -3966,7 +3947,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### BaseTagType +## BaseTagType ```python @@ -3978,7 +3959,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### BasicUserInfoType +## BasicUserInfoType ```python @@ -3989,7 +3970,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### CpuArchitectureType +## CpuArchitectureType ```python @@ -4001,7 +3982,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### CreditBundleType +## CreditBundleType ```python @@ -4021,7 +4002,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceFamilyType +## DeviceFamilyType ```python @@ -4036,7 +4017,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceHistoryType +## DeviceHistoryType ```python @@ -4062,7 +4043,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceManufacturerType +## DeviceManufacturerType ```python @@ -4076,7 +4057,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceMetricsType +## DeviceMetricsType ```python @@ -4094,7 +4075,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceTypeAliasType +## DeviceTypeAliasType ```python @@ -4106,7 +4087,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### DeviceTypeType +## DeviceTypeType ```python @@ -4127,7 +4108,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### EnvironmentVariableBase +## EnvironmentVariableBase ```python @@ -4139,7 +4120,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageBasicInfoType +## ImageBasicInfoType ```python @@ -4150,7 +4131,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageInstallType +## ImageInstallType ```python @@ -4166,7 +4147,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ImageType +## ImageType ```python @@ -4191,7 +4172,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### InviteeType +## InviteeType ```python @@ -4203,7 +4184,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationInviteType +## OrganizationInviteType ```python @@ -4219,7 +4200,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipRoleType +## OrganizationMembershipRoleType ```python @@ -4230,7 +4211,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipTagType +## OrganizationMembershipTagType ```python @@ -4240,7 +4221,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationMembershipType +## OrganizationMembershipType ```python @@ -4256,7 +4237,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationPrivateDeviceTypeAccess +## OrganizationPrivateDeviceTypeAccess ```python @@ -4268,7 +4249,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### OrganizationType +## OrganizationType ```python @@ -4287,7 +4268,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PineDeferred +## PineDeferred ```python @@ -4297,7 +4278,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PublicDeviceType +## PublicDeviceType ```python @@ -4311,7 +4292,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### PublicOrganizationType +## PublicOrganizationType ```python @@ -4323,7 +4304,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseImageType +## ReleaseImageType ```python @@ -4336,7 +4317,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseType +## ReleaseType ```python @@ -4382,7 +4363,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseVersion +## ReleaseVersion ```python @@ -4398,7 +4379,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ReleaseWithImageDetailsType +## ReleaseWithImageDetailsType ```python @@ -4446,7 +4427,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### SSHKeyType +## SSHKeyType ```python @@ -4460,7 +4441,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ServiceInstanceType +## ServiceInstanceType ```python @@ -4474,7 +4455,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### ServiceType +## ServiceType ```python @@ -4490,7 +4471,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamApplicationAccessType +## TeamApplicationAccessType ```python @@ -4503,7 +4484,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamMembershipType +## TeamMembershipType ```python @@ -4516,7 +4497,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TeamType +## TeamType ```python @@ -4531,7 +4512,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeApplication +## TypeApplication ```python @@ -4573,7 +4554,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeApplicationWithDeviceServiceDetails +## TypeApplicationWithDeviceServiceDetails ```python @@ -4615,7 +4596,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeCurrentService +## TypeCurrentService ```python @@ -4630,7 +4611,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeDevice +## TypeDevice ```python @@ -4696,7 +4677,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeDeviceWithServices +## TypeDeviceWithServices ```python @@ -4763,7 +4744,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypeVar +## TypeVar ```python @@ -4773,7 +4754,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### TypedDict +## TypedDict ```python @@ -4783,7 +4764,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### UserType +## UserType ```python @@ -4800,7 +4781,7 @@ The name must be a string; the optional doc argument can have any type. ``` -### WebResource +## WebResource ```python diff --git a/tools/sync-external.js b/tools/sync-external.js index 253de55e37..a41523e0ba 100755 --- a/tools/sync-external.js +++ b/tools/sync-external.js @@ -652,7 +652,13 @@ async function processVersionedSources(manifest) { ); file = source.fallback; } - const url = buildRawUrl(source.repo, `refs/tags/${version.tag}`, file); + const url = buildRawUrl( + source.repo, + source.repo.includes('python') + ? encodeURIComponent('clean-documentation-for-use-in-docs-site') + : `refs/tags/${version.tag}`, + file, + ); console.log(` Version: ${version.tag} (${version.policy})`); try {