Skip to content

Latest commit

 

History

History
727 lines (451 loc) · 17.7 KB

iot.md

File metadata and controls

727 lines (451 loc) · 17.7 KB

Documentation for scw iot

IoT API.

IoT Device commands

IoT Device commands.

Add a device

Add a device.

Usage:

scw iot device create [arg=value ...]

Args:

Name Description
name Required
Default: <generated>
Device name
hub-id Required ID of the device's hub
allow-insecure Allow plain and server-authenticated SSL connections in addition to mutually-authenticated ones
allow-multiple-connections Allow multiple physical devices to connect with this device's credentials
message-filters.publish.policy One of: unknown, accept, reject How to use the topic list
message-filters.publish.topics.{index} List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters
message-filters.subscribe.policy One of: unknown, accept, reject How to use the topic list
message-filters.subscribe.topics.{index} List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters
description Device description
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Remove a device

Remove a device.

Usage:

scw iot device delete <device-id ...> [arg=value ...]

Args:

Name Description
device-id Required Device ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Disable a device

Disable a device.

Usage:

scw iot device disable <device-id ...> [arg=value ...]

Args:

Name Description
device-id Required Device ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Enable a device

Enable a device.

Usage:

scw iot device enable <device-id ...> [arg=value ...]

Args:

Name Description
device-id Required Device ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Get a device

Get a device.

Usage:

scw iot device get <device-id ...> [arg=value ...]

Args:

Name Description
device-id Required Device ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Get a device's certificate

Get a device's certificate.

Usage:

scw iot device get-certificate <device-id ...> [arg=value ...]

Args:

Name Description
device-id Required Device ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Get a device's metrics

Get a device's metrics.

Usage:

scw iot device get-metrics <device-id ...> [arg=value ...]

Args:

Name Description
device-id Required Device ID
start-date Required Start date used to compute the best scale for the returned metrics
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

List devices

List devices.

Usage:

scw iot device list [arg=value ...]

Args:

Name Description
order-by One of: name_asc, name_desc, status_asc, status_desc, hub_id_asc, hub_id_desc, created_at_asc, created_at_desc, updated_at_asc, updated_at_desc, allow_insecure_asc, allow_insecure_desc Ordering of requested devices
name Filter on the name
hub-id Filter on the hub
allow-insecure Filter on the allow_insecure flag
status One of: unknown, error, enabled, disabled Device status (enabled, disabled, etc.)
region Default: fr-par
One of: fr-par, all
Region to target. If none is passed will use default region from the config

Renew a device certificate

Renew a device certificate.

Usage:

scw iot device renew-certificate <device-id ...> [arg=value ...]

Args:

Name Description
device-id Required Device ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Set a custom certificate on a device

Set a custom certificate on a device.

Usage:

scw iot device set-certificate <device-id ...> [arg=value ...]

Args:

Name Description
device-id Required Device ID
certificate-pem Required The PEM-encoded custom certificate
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Update a device

Update a device.

Usage:

scw iot device update <device-id ...> [arg=value ...]

Args:

Name Description
device-id Required Device ID
description Device description
allow-insecure Allow plain and server-authenticated SSL connections in addition to mutually-authenticated ones
allow-multiple-connections Allow multiple physical devices to connect with this device's credentials
message-filters.publish.policy One of: unknown, accept, reject How to use the topic list
message-filters.publish.topics.{index} List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters
message-filters.subscribe.policy One of: unknown, accept, reject How to use the topic list
message-filters.subscribe.topics.{index} List of topics to accept or reject. It must be valid MQTT topics and up to 65535 characters
hub-id Change Hub for this device, additional fees may apply, see IoT Hub pricing
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

IoT Hub commands

IoT Hub commands.

Create a hub

Create a hub.

Usage:

scw iot hub create [arg=value ...]

Args:

Name Description
name Required
Default: <generated>
Hub name (up to 255 characters)
project-id Project ID to use. If none is passed the default project ID will be used
product-plan Required
Default: plan_shared
One of: plan_unknown, plan_shared, plan_dedicated, plan_ha
Hub feature set
disable-events Disable Hub events
events-topic-prefix Hub events topic prefix (default '$SCW/events')
twins-graphite-config.push-uri
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Delete a hub

Delete a hub.

Usage:

scw iot hub delete <hub-id ...> [arg=value ...]

Args:

Name Description
hub-id Required Hub ID
delete-devices Force deletion of devices added to this hub instead of rejecting operation
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Disable a hub

Disable a hub.

Usage:

scw iot hub disable <hub-id ...> [arg=value ...]

Args:

Name Description
hub-id Required Hub ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Enable a hub

Enable a hub.

Usage:

scw iot hub enable <hub-id ...> [arg=value ...]

Args:

Name Description
hub-id Required Hub ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Get a hub

Get a hub.

Usage:

scw iot hub get <hub-id ...> [arg=value ...]

Args:

Name Description
hub-id Required Hub ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Get the certificate authority of a hub

Get the certificate authority of a hub.

Usage:

scw iot hub get-ca [arg=value ...]

Args:

Name Description
hub-id Required
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

List hubs

List hubs.

Usage:

scw iot hub list [arg=value ...]

Args:

Name Description
order-by One of: name_asc, name_desc, status_asc, status_desc, product_plan_asc, product_plan_desc, created_at_asc, created_at_desc, updated_at_asc, updated_at_desc Ordering of requested hub
project-id Filter on project
name Filter on the name
organization-id Filter on the organization
region Default: fr-par
One of: fr-par, all
Region to target. If none is passed will use default region from the config

Set the certificate authority of a hub

Set the certificate authority of a hub.

Usage:

scw iot hub set-ca <hub-id ...> [arg=value ...]

Args:

Name Description
hub-id Required Hub ID
ca-cert-pem Required The CA's PEM-encoded certificate
challenge-cert-pem Required Proof of possession PEM-encoded certificate
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Update a hub

Update a hub.

Usage:

scw iot hub update <hub-id ...> [arg=value ...]

Args:

Name Description
hub-id Required Hub ID
name Hub name (up to 255 characters)
product-plan One of: plan_unknown, plan_shared, plan_dedicated, plan_ha Hub feature set
disable-events Disable Hub events
events-topic-prefix Hub events topic prefix
enable-device-auto-provisioning Enable device auto provisioning
twins-graphite-config.push-uri
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

IoT Network commands

IoT Network commands.

Create a new Network

Create a new Network.

Usage:

scw iot network create [arg=value ...]

Args:

Name Description
name Required
Default: <generated>
Network name
type Required
One of: unknown, sigfox, rest
Type of network to connect with
hub-id Required Hub ID to connect the Network to
topic-prefix Required Topic prefix for the Network
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Delete a Network

Delete a Network.

Usage:

scw iot network delete <network-id ...> [arg=value ...]

Args:

Name Description
network-id Required Network ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Retrieve a specific Network

Retrieve a specific Network.

Usage:

scw iot network get <network-id ...> [arg=value ...]

Args:

Name Description
network-id Required Network ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

List the Networks

List the Networks.

Usage:

scw iot network list [arg=value ...]

Args:

Name Description
order-by One of: name_asc, name_desc, type_asc, type_desc, created_at_asc, created_at_desc Ordering of requested routes
name Filter on Network name
hub-id Filter on the hub
topic-prefix Filter on the topic prefix
region Default: fr-par
One of: fr-par, all
Region to target. If none is passed will use default region from the config

IoT Route commands

IoT Route commands.

Create a route

Multiple route kinds can be created:

  • Database Route. Create a route that will record subscribed MQTT messages into your database. You need to manage the database by yourself.
  • REST Route. Create a route that will call a REST API on received subscribed MQTT messages.
  • S3 Routes. Create a route that will put subscribed MQTT messages into an S3 bucket. You need to create the bucket yourself and grant us write access. The grant can be done with s3cmd (s3cmd setacl s3://<my-bucket> --acl-grant=write:555c69c3-87d0-4bf8-80f1-99a2f757d031:555c69c3-87d0-4bf8-80f1-99a2f757d031).

Usage:

scw iot route create [arg=value ...]

Args:

Name Description
name Default: <generated> Route name
hub-id ID of the route's hub
topic Topic the route subscribes to. It must be a valid MQTT topic and up to 65535 characters
s3-config.bucket-region
s3-config.bucket-name
s3-config.object-prefix
s3-config.strategy One of: unknown, per_topic, per_message
db-config.host
db-config.port
db-config.dbname
db-config.username
db-config.password
db-config.query
db-config.engine One of: unknown, postgresql, mysql
rest-config.verb One of: unknown, get, post, put, patch, delete
rest-config.uri
rest-config.headers.{key}
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Delete a route

Delete a route.

Usage:

scw iot route delete <route-id ...> [arg=value ...]

Args:

Name Description
route-id Required Route ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

Get a route

Get a route.

Usage:

scw iot route get <route-id ...> [arg=value ...]

Args:

Name Description
route-id Required Route ID
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config

List routes

List routes.

Usage:

scw iot route list [arg=value ...]

Args:

Name Description
order-by One of: name_asc, name_desc, hub_id_asc, hub_id_desc, type_asc, type_desc, created_at_asc, created_at_desc Ordering of requested routes
hub-id Filter on the hub
name Filter on route's name
region Default: fr-par
One of: fr-par, all
Region to target. If none is passed will use default region from the config

Update a route

Update a route.

Usage:

scw iot route update [arg=value ...]

Args:

Name Description
route-id Required Route id
name Route name
topic Topic the route subscribes to. It must be a valid MQTT topic and up to 65535 characters
s3-config.bucket-region
s3-config.bucket-name
s3-config.object-prefix
s3-config.strategy One of: unknown, per_topic, per_message
db-config.host
db-config.port
db-config.dbname
db-config.username
db-config.password
db-config.query
db-config.engine One of: unknown, postgresql, mysql
rest-config.verb One of: unknown, get, post, put, patch, delete
rest-config.uri
rest-config.headers.{key}
region Default: fr-par
One of: fr-par
Region to target. If none is passed will use default region from the config