Resource: Device
The device resource.
JSON representation | |
---|---|
{ "id": string, "name": string, "numId": string, "credentials": [ { object(DeviceCredential) } ], "lastHeartbeatTime": string, "lastEventTime": string, "lastStateTime": string, "lastConfigAckTime": string, "lastConfigSendTime": string, "blocked": boolean, "lastErrorTime": string, "lastErrorStatus": { object(Status) }, "config": { object(DeviceConfig) }, "state": { object(DeviceState) }, "logLevel": enum(LogLevel), "metadata": { string: string, ... }, "gatewayConfig": { object(GatewayConfig) } } |
Fields | |
---|---|
|
The user-defined device identifier. The device ID must be unique within a device registry. |
|
The resource path name. For example, |
|
[Output only] A server-defined unique numeric ID for the device. This is a more compact way to identify devices, and it is globally unique. |
|
The credentials used to authenticate this device. To allow credential rotation without interruption, multiple device credentials can be bound to this device. No more than 3 credentials can be bound to a single device at a time. When new credentials are added to a device, they are verified against the registry credentials. For details, see the description of the |
|
[Output only] The last time an MQTT A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: |
|
[Output only] The last time a telemetry event was received. Timestamps are periodically collected and written to storage; they may be stale by a few minutes. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: |
|
[Output only] The last time a state event was received. Timestamps are periodically collected and written to storage; they may be stale by a few minutes. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: |
|
[Output only] The last time a cloud-to-device config version acknowledgment was received from the device. This field is only for configurations sent through MQTT. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: |
|
[Output only] The last time a cloud-to-device config version was sent to the device. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: |
|
If a device is blocked, connections or requests from this device will fail. Can be used to temporarily prevent the device from connecting if, for example, the sensor is generating bad data and needs maintenance. |
|
[Output only] The time the most recent error occurred, such as a failure to publish to Cloud Pub/Sub. This field is the timestamp of 'lastErrorStatus'. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: |
|
[Output only] The error message of the most recent error, such as a failure to publish to Cloud Pub/Sub. 'lastErrorTime' is the timestamp of this field. If no errors have occurred, this field has an empty message and the status code 0 == OK. Otherwise, this field is expected to have a status code other than OK. |
|
The most recent device configuration, which is eventually sent from ClearBlade IoT Core to the device. If not present on creation, the configuration will be initialized with an empty payload and version value of |
|
[Output only] The state most recently received from the device. If no state has been reported, this field is not present. |
|
The logging verbosity for device activity. If unspecified, DeviceRegistry.log_level will be used. |
|
The metadata key-value pairs assigned to the device. This metadata is not interpreted or indexed by ClearBlade IoT Core. It can be used to add contextual information for the device. Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and be less than 128 bytes in length. Values are free-form strings. Each value must be less than or equal to 32 KB in size. The total size of all keys and values must be less than 256 KB, and the maximum number of key-value pairs is 500. An object containing a list of |
|
Gateway-related configuration and state. |
DeviceCredential
A server-stored device credential used for authentication.
JSON representation | |
---|---|
{ "expirationTime": string, "publicKey": { object(PublicKeyCredential) } } |
Fields | |
---|---|
|
[Optional] The time at which this credential becomes invalid. This credential will be ignored for new client authentication requests after this timestamp; however, it will not be automatically deleted. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: |
|
A public key used to verify the signature of JSON Web Tokens (JWTs). When adding a new device credential, either via device creation or via modifications, this public key credential may be required to be signed by one of the registry level certificates. More specifically, if the registry contains at least one certificate, any new device credential must be signed by one of the registry certificates. As a result, when the registry contains certificates, only X.509 certificates are accepted as device credentials. However, if the registry does not contain a certificate, self-signed certificates and public keys will be accepted. New device credentials must be different from every registry-level certificate. |
PublicKeyCredential
A public key format and data.
JSON representation | |
---|---|
{ "format": enum(PublicKeyFormat), "key": string } |
Fields | |
---|---|
|
The format of the key. |
|
The key data. |
PublicKeyFormat
The supported formats for the public key.
Enums | |
---|---|
| The format has not been specified. This is an invalid default value and must not be used. |
| An RSA public key encoded in base64, and wrapped by |
| As RSA_PEM, but wrapped in an X.509v3 certificate (RFC5280), encoded in base64, and wrapped by |
| Public key for the ECDSA algorithm using P-256 and SHA-256, encoded in base64, and wrapped by |
| As ES256_PEM, but wrapped in an X.509v3 certificate (RFC5280), encoded in base64, and wrapped by |
Status
The Status
type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. The error model is designed to be:
Simple to use and understand for most users
Flexible enough to meet unexpected needs
Overview
The Status
message contains three pieces of data: error code, error message, and error details. The error code should be an enum value of google.rpc.Code
, but it may accept additional error codes if needed. The error message should be a developer-facing English message that helps developers understand and resolve the error. If a localized user-facing error message is needed, put the localized message in the error details or localize it in the client. The optional error details may contain arbitrary information about the error. There is a predefined set of error detail types in the package google.rpc
that can be used for common error conditions.
Language mapping
The Status
message is the logical representation of the error model, but it is not necessarily the actual wire format. When the Status
message is exposed in different client libraries and different wire protocols, it can be mapped differently. For example, it will likely be mapped to some exceptions in Java, but more likely mapped to some error codes in C.
Other uses
The error model and the Status
message can be used in a variety of environments, either with or without APIs, to provide a consistent developer experience across different environments.
Example uses of this error model include:
Partial errors. If a service needs to return partial errors to the client, it may embed the
Status
in the normal response to indicate the partial errors.Workflow errors. A typical workflow has multiple steps. Each step may have a
Status
message for error reporting.Batch operations. If a client uses batch request and batch response, the
Status
message should be used directly inside batch response, one for each error sub-response.Asynchronous operations. If an API call embeds asynchronous operation results in its response, the status of those operations should be represented directly using the
Status
message.Logging. If some API errors are stored in logs, the message
Status
could be used directly after any stripping needed for security/privacy reasons.
JSON representation | |
---|---|
{ "code": number, "message": string, "details": [ { "@type": string, field1: ..., ... } ] } |
Fields | |
---|---|
|
The status code, which should be an enum value of |
|
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the |
|
A list of messages that carry the error details. There is a common set of message types for APIs to use. An object containing fields of an arbitrary type. An additional field |
GatewayConfig
Gateway-related configuration and state.
JSON representation | |
---|---|
{ "gatewayType": enum(GatewayType), "gatewayAuthMethod": enum(GatewayAuthMethod), "lastAccessedGatewayId": string, "lastAccessedGatewayTime": string } |
Fields | |
---|---|
|
Indicates whether the device is a gateway. |
|
Indicates how to authorize and/or authenticate devices to access the gateway. |
|
[Output only] The ID of the gateway the device accessed most recently. |
|
[Output only] The most recent time at which the device accessed the gateway specified in A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: |
GatewayType
Gateway type.
Enums | |
---|---|
| If unspecified, the device is considered a non-gateway device. |
| The device is a gateway. |
| The device is not a gateway. |
GatewayAuthMethod
The gateway authorization/authentication method. This setting determines how ClearBlade IoT Core authorizes/authenticate devices to access the gateway.
Enums | |
---|---|
| No authentication/authorization method specified. No devices are allowed to access the gateway. |
| The device is authenticated through the gateway association only. Device credentials are ignored even if provided. |
| The device is authenticated through its own credentials. Gateway association is not checked. |
| The device is authenticated through both device credentials and gateway association. The device must be bound to the gateway and must provide its own credentials. |
Methods | |
---|---|
create | Creates a device in a device registry. |
delete | Deletes a device. |
get | Gets details about a device. |
list | List devices in a device registry. |
modifyCloudToDeviceConfig | Modifies the configuration for the device, which is eventually sent from the ClearBlade IoT Core servers. |
patch | Updates a device. |
sendCommandToDevice | Sends a command to the specified device. |