Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1 | <html><body> |
| 2 | <style> |
| 3 | |
| 4 | body, h1, h2, h3, div, span, p, pre, a { |
| 5 | margin: 0; |
| 6 | padding: 0; |
| 7 | border: 0; |
| 8 | font-weight: inherit; |
| 9 | font-style: inherit; |
| 10 | font-size: 100%; |
| 11 | font-family: inherit; |
| 12 | vertical-align: baseline; |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | font-size: 13px; |
| 17 | padding: 1em; |
| 18 | } |
| 19 | |
| 20 | h1 { |
| 21 | font-size: 26px; |
| 22 | margin-bottom: 1em; |
| 23 | } |
| 24 | |
| 25 | h2 { |
| 26 | font-size: 24px; |
| 27 | margin-bottom: 1em; |
| 28 | } |
| 29 | |
| 30 | h3 { |
| 31 | font-size: 20px; |
| 32 | margin-bottom: 1em; |
| 33 | margin-top: 1em; |
| 34 | } |
| 35 | |
| 36 | pre, code { |
| 37 | line-height: 1.5; |
| 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 | } |
| 40 | |
| 41 | pre { |
| 42 | margin-top: 0.5em; |
| 43 | } |
| 44 | |
| 45 | h1, h2, h3, p { |
| 46 | font-family: Arial, sans serif; |
| 47 | } |
| 48 | |
| 49 | h1, h2, h3 { |
| 50 | border-bottom: solid #CCC 1px; |
| 51 | } |
| 52 | |
| 53 | .toc_element { |
| 54 | margin-top: 0.5em; |
| 55 | } |
| 56 | |
| 57 | .firstline { |
| 58 | margin-left: 2 em; |
| 59 | } |
| 60 | |
| 61 | .method { |
| 62 | margin-top: 1em; |
| 63 | border: solid 1px #CCC; |
| 64 | padding: 1em; |
| 65 | background: #EEE; |
| 66 | } |
| 67 | |
| 68 | .details { |
| 69 | font-weight: bold; |
| 70 | font-size: 14px; |
| 71 | } |
| 72 | |
| 73 | </style> |
| 74 | |
| 75 | <h1><a href="cloudiot_v1.html">Cloud IoT API</a> . <a href="cloudiot_v1.projects.html">projects</a> . <a href="cloudiot_v1.projects.locations.html">locations</a> . <a href="cloudiot_v1.projects.locations.registries.html">registries</a> . <a href="cloudiot_v1.projects.locations.registries.devices.html">devices</a></h1> |
| 76 | <h2>Instance Methods</h2> |
| 77 | <p class="toc_element"> |
| 78 | <code><a href="cloudiot_v1.projects.locations.registries.devices.configVersions.html">configVersions()</a></code> |
| 79 | </p> |
| 80 | <p class="firstline">Returns the configVersions Resource.</p> |
| 81 | |
| 82 | <p class="toc_element"> |
| 83 | <code><a href="cloudiot_v1.projects.locations.registries.devices.states.html">states()</a></code> |
| 84 | </p> |
| 85 | <p class="firstline">Returns the states Resource.</p> |
| 86 | |
| 87 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 88 | <code><a href="#create">create(parent, body=None, x__xgafv=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 89 | <p class="firstline">Creates a device in a device registry.</p> |
| 90 | <p class="toc_element"> |
| 91 | <code><a href="#delete">delete(name, x__xgafv=None)</a></code></p> |
| 92 | <p class="firstline">Deletes a device.</p> |
| 93 | <p class="toc_element"> |
| 94 | <code><a href="#get">get(name, fieldMask=None, x__xgafv=None)</a></code></p> |
| 95 | <p class="firstline">Gets details about a device.</p> |
| 96 | <p class="toc_element"> |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 97 | <code><a href="#list">list(parent, pageToken=None, fieldMask=None, pageSize=None, deviceIds=None, deviceNumIds=None, gatewayListOptions_associationsDeviceId=None, gatewayListOptions_gatewayType=None, gatewayListOptions_associationsGatewayId=None, x__xgafv=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 98 | <p class="firstline">List devices in a device registry.</p> |
| 99 | <p class="toc_element"> |
| 100 | <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> |
| 101 | <p class="firstline">Retrieves the next page of results.</p> |
| 102 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 103 | <code><a href="#modifyCloudToDeviceConfig">modifyCloudToDeviceConfig(name, body=None, x__xgafv=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 104 | <p class="firstline">Modifies the configuration for the device, which is eventually sent from</p> |
| 105 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 106 | <code><a href="#patch">patch(name, body=None, updateMask=None, x__xgafv=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 107 | <p class="firstline">Updates a device.</p> |
| 108 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 109 | <code><a href="#sendCommandToDevice">sendCommandToDevice(name, body=None, x__xgafv=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 110 | <p class="firstline">Sends a command to the specified device. In order for a device to be able</p> |
| 111 | <h3>Method Details</h3> |
| 112 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 113 | <code class="details" id="create">create(parent, body=None, x__xgafv=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 114 | <pre>Creates a device in a device registry. |
| 115 | |
| 116 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 117 | parent: string, Required. The name of the device registry where this device should be created. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 118 | For example, |
| 119 | `projects/example-project/locations/us-central1/registries/my-registry`. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 120 | body: object, The request body. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 121 | The object takes the form of: |
| 122 | |
| 123 | { # The device resource. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 124 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 125 | # rotation without interruption, multiple device credentials can be bound to |
| 126 | # this device. No more than 3 credentials can be bound to a single device at |
| 127 | # a time. When new credentials are added to a device, they are verified |
| 128 | # against the registry credentials. For details, see the description of the |
| 129 | # `DeviceRegistry.credentials` field. |
| 130 | { # A server-stored device credential used for authentication. |
| 131 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 132 | # credential will be ignored for new client authentication requests after |
| 133 | # this timestamp; however, it will not be automatically deleted. |
| 134 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 135 | # When adding a new device credential, either via device creation or via |
| 136 | # modifications, this public key credential may be required to be signed by |
| 137 | # one of the registry level certificates. More specifically, if the |
| 138 | # registry contains at least one certificate, any new device credential |
| 139 | # must be signed by one of the registry certificates. As a result, |
| 140 | # when the registry contains certificates, only X.509 certificates are |
| 141 | # accepted as device credentials. However, if the registry does |
| 142 | # not contain a certificate, self-signed certificates and public keys will |
| 143 | # be accepted. New device credentials must be different from every |
| 144 | # registry-level certificate. |
| 145 | "key": "A String", # The key data. |
| 146 | "format": "A String", # The format of the key. |
| 147 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 148 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 149 | ], |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 150 | "name": "A String", # The resource path name. For example, |
| 151 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 152 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 153 | # When `name` is populated as a response from the service, it always ends |
| 154 | # in the device numeric ID. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 155 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 156 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 157 | # 'last_error_status'. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 158 | "logLevel": "A String", # **Beta Feature** |
| 159 | # |
| 160 | # The logging verbosity for device activity. If unspecified, |
| 161 | # DeviceRegistry.log_level will be used. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 162 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 163 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 164 | # information for the device. |
| 165 | # |
| 166 | # Keys must conform to the regular expression a-zA-Z+ and |
| 167 | # be less than 128 bytes in length. |
| 168 | # |
| 169 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 170 | # KB in size. |
| 171 | # |
| 172 | # The total size of all keys and values must be less than 256 KB, and the |
| 173 | # maximum number of key-value pairs is 500. |
| 174 | "a_key": "A String", |
| 175 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 176 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 177 | # within a device registry. |
| 178 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 179 | # was received from the device. This field is only for configurations |
| 180 | # sent through MQTT. |
| 181 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 182 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 183 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 184 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 185 | # gateway. |
| 186 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 187 | # specified in `last_accessed_gateway`. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 188 | }, |
| 189 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 190 | # more compact way to identify devices, and it is globally unique. |
| 191 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 192 | # Can be used to temporarily prevent the device from connecting if, for |
| 193 | # example, the sensor is generating bad data and needs maintenance. |
| 194 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 195 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 196 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 197 | # have been sent. Timestamps are periodically collected and written to |
| 198 | # storage; they may be stale by a few minutes. |
| 199 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 200 | # periodically collected and written to storage; they may be stale by a few |
| 201 | # minutes. |
| 202 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 203 | # the device. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 204 | "lastErrorStatus": { # The `Status` type defines a logical error model that is suitable for # [Output only] The error message of the most recent error, such as a failure |
| 205 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 206 | # field. If no errors have occurred, this field has an empty message |
| 207 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 208 | # status code other than OK. |
| 209 | # different programming environments, including REST APIs and RPC APIs. It is |
| 210 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 211 | # three pieces of data: error code, error message, and error details. |
| 212 | # |
| 213 | # You can find out more about this error model and how to work with it in the |
| 214 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 215 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 216 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 217 | # user-facing error message should be localized and sent in the |
| 218 | # google.rpc.Status.details field, or localized by the client. |
| 219 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 220 | # message types for APIs to use. |
| 221 | { |
| 222 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 223 | }, |
| 224 | ], |
| 225 | }, |
| 226 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 227 | # periodically collected and written to storage; they may be stale by a few |
| 228 | # minutes. |
| 229 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 230 | # has been reported, this field is not present. |
| 231 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 232 | # IoT Core. |
| 233 | "binaryData": "A String", # The device state data. |
| 234 | }, |
| 235 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 236 | # Cloud IoT Core to the device. If not present on creation, the |
| 237 | # configuration will be initialized with an empty payload and version value |
| 238 | # of `1`. To update this field after creation, use the |
| 239 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 240 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 241 | # the server, and is always greater than 0 after device creation. The |
| 242 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 243 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 244 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 245 | # Cloud IoT Core. This timestamp is set by the server. |
| 246 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 247 | # acknowledgment from the device, indicating that the device has received |
| 248 | # this configuration version. If this field is not present, the device has |
| 249 | # not yet acknowledged that it received this version. Note that when |
| 250 | # the config was sent to the device, many config versions may have been |
| 251 | # available in Cloud IoT Core while the device was disconnected, and on |
| 252 | # connection, only the latest version is sent to the device. Some |
| 253 | # versions may never be sent to the device, and therefore are never |
| 254 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 255 | "binaryData": "A String", # The device configuration data. |
| 256 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | x__xgafv: string, V1 error format. |
| 260 | Allowed values |
| 261 | 1 - v1 error format |
| 262 | 2 - v2 error format |
| 263 | |
| 264 | Returns: |
| 265 | An object of the form: |
| 266 | |
| 267 | { # The device resource. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 268 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 269 | # rotation without interruption, multiple device credentials can be bound to |
| 270 | # this device. No more than 3 credentials can be bound to a single device at |
| 271 | # a time. When new credentials are added to a device, they are verified |
| 272 | # against the registry credentials. For details, see the description of the |
| 273 | # `DeviceRegistry.credentials` field. |
| 274 | { # A server-stored device credential used for authentication. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 275 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 276 | # credential will be ignored for new client authentication requests after |
| 277 | # this timestamp; however, it will not be automatically deleted. |
| 278 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 279 | # When adding a new device credential, either via device creation or via |
| 280 | # modifications, this public key credential may be required to be signed by |
| 281 | # one of the registry level certificates. More specifically, if the |
| 282 | # registry contains at least one certificate, any new device credential |
| 283 | # must be signed by one of the registry certificates. As a result, |
| 284 | # when the registry contains certificates, only X.509 certificates are |
| 285 | # accepted as device credentials. However, if the registry does |
| 286 | # not contain a certificate, self-signed certificates and public keys will |
| 287 | # be accepted. New device credentials must be different from every |
| 288 | # registry-level certificate. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 289 | "key": "A String", # The key data. |
| 290 | "format": "A String", # The format of the key. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 291 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 292 | }, |
| 293 | ], |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 294 | "name": "A String", # The resource path name. For example, |
| 295 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 296 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 297 | # When `name` is populated as a response from the service, it always ends |
| 298 | # in the device numeric ID. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 299 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 300 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 301 | # 'last_error_status'. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 302 | "logLevel": "A String", # **Beta Feature** |
| 303 | # |
| 304 | # The logging verbosity for device activity. If unspecified, |
| 305 | # DeviceRegistry.log_level will be used. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 306 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 307 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 308 | # information for the device. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 309 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 310 | # Keys must conform to the regular expression a-zA-Z+ and |
| 311 | # be less than 128 bytes in length. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 312 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 313 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 314 | # KB in size. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 315 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 316 | # The total size of all keys and values must be less than 256 KB, and the |
| 317 | # maximum number of key-value pairs is 500. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 318 | "a_key": "A String", |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 319 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 320 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 321 | # within a device registry. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 322 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 323 | # was received from the device. This field is only for configurations |
| 324 | # sent through MQTT. |
| 325 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 326 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 327 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 328 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 329 | # gateway. |
| 330 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 331 | # specified in `last_accessed_gateway`. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 332 | }, |
| 333 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 334 | # more compact way to identify devices, and it is globally unique. |
| 335 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 336 | # Can be used to temporarily prevent the device from connecting if, for |
| 337 | # example, the sensor is generating bad data and needs maintenance. |
| 338 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 339 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 340 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 341 | # have been sent. Timestamps are periodically collected and written to |
| 342 | # storage; they may be stale by a few minutes. |
| 343 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 344 | # periodically collected and written to storage; they may be stale by a few |
| 345 | # minutes. |
| 346 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 347 | # the device. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 348 | "lastErrorStatus": { # The `Status` type defines a logical error model that is suitable for # [Output only] The error message of the most recent error, such as a failure |
| 349 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 350 | # field. If no errors have occurred, this field has an empty message |
| 351 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 352 | # status code other than OK. |
| 353 | # different programming environments, including REST APIs and RPC APIs. It is |
| 354 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 355 | # three pieces of data: error code, error message, and error details. |
| 356 | # |
| 357 | # You can find out more about this error model and how to work with it in the |
| 358 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 359 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 360 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 361 | # user-facing error message should be localized and sent in the |
| 362 | # google.rpc.Status.details field, or localized by the client. |
| 363 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 364 | # message types for APIs to use. |
| 365 | { |
| 366 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 367 | }, |
| 368 | ], |
| 369 | }, |
| 370 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 371 | # periodically collected and written to storage; they may be stale by a few |
| 372 | # minutes. |
| 373 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 374 | # has been reported, this field is not present. |
| 375 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 376 | # IoT Core. |
| 377 | "binaryData": "A String", # The device state data. |
| 378 | }, |
| 379 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 380 | # Cloud IoT Core to the device. If not present on creation, the |
| 381 | # configuration will be initialized with an empty payload and version value |
| 382 | # of `1`. To update this field after creation, use the |
| 383 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 384 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 385 | # the server, and is always greater than 0 after device creation. The |
| 386 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 387 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 388 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 389 | # Cloud IoT Core. This timestamp is set by the server. |
| 390 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 391 | # acknowledgment from the device, indicating that the device has received |
| 392 | # this configuration version. If this field is not present, the device has |
| 393 | # not yet acknowledged that it received this version. Note that when |
| 394 | # the config was sent to the device, many config versions may have been |
| 395 | # available in Cloud IoT Core while the device was disconnected, and on |
| 396 | # connection, only the latest version is sent to the device. Some |
| 397 | # versions may never be sent to the device, and therefore are never |
| 398 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 399 | "binaryData": "A String", # The device configuration data. |
| 400 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 401 | }</pre> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 402 | </div> |
| 403 | |
| 404 | <div class="method"> |
| 405 | <code class="details" id="delete">delete(name, x__xgafv=None)</code> |
| 406 | <pre>Deletes a device. |
| 407 | |
| 408 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 409 | name: string, Required. The name of the device. For example, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 410 | `projects/p0/locations/us-central1/registries/registry0/devices/device0` or |
| 411 | `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. (required) |
| 412 | x__xgafv: string, V1 error format. |
| 413 | Allowed values |
| 414 | 1 - v1 error format |
| 415 | 2 - v2 error format |
| 416 | |
| 417 | Returns: |
| 418 | An object of the form: |
| 419 | |
| 420 | { # A generic empty message that you can re-use to avoid defining duplicated |
| 421 | # empty messages in your APIs. A typical example is to use it as the request |
| 422 | # or the response type of an API method. For instance: |
| 423 | # |
| 424 | # service Foo { |
| 425 | # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); |
| 426 | # } |
| 427 | # |
| 428 | # The JSON representation for `Empty` is empty JSON object `{}`. |
| 429 | }</pre> |
| 430 | </div> |
| 431 | |
| 432 | <div class="method"> |
| 433 | <code class="details" id="get">get(name, fieldMask=None, x__xgafv=None)</code> |
| 434 | <pre>Gets details about a device. |
| 435 | |
| 436 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 437 | name: string, Required. The name of the device. For example, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 438 | `projects/p0/locations/us-central1/registries/registry0/devices/device0` or |
| 439 | `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. (required) |
| 440 | fieldMask: string, The fields of the `Device` resource to be returned in the response. If the |
| 441 | field mask is unset or empty, all fields are returned. |
| 442 | x__xgafv: string, V1 error format. |
| 443 | Allowed values |
| 444 | 1 - v1 error format |
| 445 | 2 - v2 error format |
| 446 | |
| 447 | Returns: |
| 448 | An object of the form: |
| 449 | |
| 450 | { # The device resource. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 451 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 452 | # rotation without interruption, multiple device credentials can be bound to |
| 453 | # this device. No more than 3 credentials can be bound to a single device at |
| 454 | # a time. When new credentials are added to a device, they are verified |
| 455 | # against the registry credentials. For details, see the description of the |
| 456 | # `DeviceRegistry.credentials` field. |
| 457 | { # A server-stored device credential used for authentication. |
| 458 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 459 | # credential will be ignored for new client authentication requests after |
| 460 | # this timestamp; however, it will not be automatically deleted. |
| 461 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 462 | # When adding a new device credential, either via device creation or via |
| 463 | # modifications, this public key credential may be required to be signed by |
| 464 | # one of the registry level certificates. More specifically, if the |
| 465 | # registry contains at least one certificate, any new device credential |
| 466 | # must be signed by one of the registry certificates. As a result, |
| 467 | # when the registry contains certificates, only X.509 certificates are |
| 468 | # accepted as device credentials. However, if the registry does |
| 469 | # not contain a certificate, self-signed certificates and public keys will |
| 470 | # be accepted. New device credentials must be different from every |
| 471 | # registry-level certificate. |
| 472 | "key": "A String", # The key data. |
| 473 | "format": "A String", # The format of the key. |
| 474 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 475 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 476 | ], |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 477 | "name": "A String", # The resource path name. For example, |
| 478 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 479 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 480 | # When `name` is populated as a response from the service, it always ends |
| 481 | # in the device numeric ID. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 482 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 483 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 484 | # 'last_error_status'. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 485 | "logLevel": "A String", # **Beta Feature** |
| 486 | # |
| 487 | # The logging verbosity for device activity. If unspecified, |
| 488 | # DeviceRegistry.log_level will be used. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 489 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 490 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 491 | # information for the device. |
| 492 | # |
| 493 | # Keys must conform to the regular expression a-zA-Z+ and |
| 494 | # be less than 128 bytes in length. |
| 495 | # |
| 496 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 497 | # KB in size. |
| 498 | # |
| 499 | # The total size of all keys and values must be less than 256 KB, and the |
| 500 | # maximum number of key-value pairs is 500. |
| 501 | "a_key": "A String", |
| 502 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 503 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 504 | # within a device registry. |
| 505 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 506 | # was received from the device. This field is only for configurations |
| 507 | # sent through MQTT. |
| 508 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 509 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 510 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 511 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 512 | # gateway. |
| 513 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 514 | # specified in `last_accessed_gateway`. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 515 | }, |
| 516 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 517 | # more compact way to identify devices, and it is globally unique. |
| 518 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 519 | # Can be used to temporarily prevent the device from connecting if, for |
| 520 | # example, the sensor is generating bad data and needs maintenance. |
| 521 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 522 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 523 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 524 | # have been sent. Timestamps are periodically collected and written to |
| 525 | # storage; they may be stale by a few minutes. |
| 526 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 527 | # periodically collected and written to storage; they may be stale by a few |
| 528 | # minutes. |
| 529 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 530 | # the device. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 531 | "lastErrorStatus": { # The `Status` type defines a logical error model that is suitable for # [Output only] The error message of the most recent error, such as a failure |
| 532 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 533 | # field. If no errors have occurred, this field has an empty message |
| 534 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 535 | # status code other than OK. |
| 536 | # different programming environments, including REST APIs and RPC APIs. It is |
| 537 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 538 | # three pieces of data: error code, error message, and error details. |
| 539 | # |
| 540 | # You can find out more about this error model and how to work with it in the |
| 541 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 542 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 543 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 544 | # user-facing error message should be localized and sent in the |
| 545 | # google.rpc.Status.details field, or localized by the client. |
| 546 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 547 | # message types for APIs to use. |
| 548 | { |
| 549 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 550 | }, |
| 551 | ], |
| 552 | }, |
| 553 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 554 | # periodically collected and written to storage; they may be stale by a few |
| 555 | # minutes. |
| 556 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 557 | # has been reported, this field is not present. |
| 558 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 559 | # IoT Core. |
| 560 | "binaryData": "A String", # The device state data. |
| 561 | }, |
| 562 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 563 | # Cloud IoT Core to the device. If not present on creation, the |
| 564 | # configuration will be initialized with an empty payload and version value |
| 565 | # of `1`. To update this field after creation, use the |
| 566 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 567 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 568 | # the server, and is always greater than 0 after device creation. The |
| 569 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 570 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 571 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 572 | # Cloud IoT Core. This timestamp is set by the server. |
| 573 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 574 | # acknowledgment from the device, indicating that the device has received |
| 575 | # this configuration version. If this field is not present, the device has |
| 576 | # not yet acknowledged that it received this version. Note that when |
| 577 | # the config was sent to the device, many config versions may have been |
| 578 | # available in Cloud IoT Core while the device was disconnected, and on |
| 579 | # connection, only the latest version is sent to the device. Some |
| 580 | # versions may never be sent to the device, and therefore are never |
| 581 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 582 | "binaryData": "A String", # The device configuration data. |
| 583 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 584 | }</pre> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 585 | </div> |
| 586 | |
| 587 | <div class="method"> |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 588 | <code class="details" id="list">list(parent, pageToken=None, fieldMask=None, pageSize=None, deviceIds=None, deviceNumIds=None, gatewayListOptions_associationsDeviceId=None, gatewayListOptions_gatewayType=None, gatewayListOptions_associationsGatewayId=None, x__xgafv=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 589 | <pre>List devices in a device registry. |
| 590 | |
| 591 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 592 | parent: string, Required. The device registry path. Required. For example, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 593 | `projects/my-project/locations/us-central1/registries/my-registry`. (required) |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 594 | pageToken: string, The value returned by the last `ListDevicesResponse`; indicates |
| 595 | that this is a continuation of a prior `ListDevices` call and |
| 596 | the system should return the next page of data. |
| 597 | fieldMask: string, The fields of the `Device` resource to be returned in the response. The |
| 598 | fields `id` and `num_id` are always returned, along with any |
| 599 | other fields specified. |
| 600 | pageSize: integer, The maximum number of devices to return in the response. If this value |
| 601 | is zero, the service will select a default size. A call may return fewer |
| 602 | objects than requested. A non-empty `next_page_token` in the response |
| 603 | indicates that more data is available. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 604 | deviceIds: string, A list of device string IDs. For example, `['device0', 'device12']`. |
| 605 | If empty, this field is ignored. Maximum IDs: 10,000 (repeated) |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 606 | deviceNumIds: string, A list of device numeric IDs. If empty, this field is ignored. Maximum |
| 607 | IDs: 10,000. (repeated) |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 608 | gatewayListOptions_associationsDeviceId: string, If set, returns only the gateways with which the specified device is |
| 609 | associated. The device ID can be numeric (`num_id`) or the user-defined |
| 610 | string (`id`). For example, if `456` is specified, returns only the |
| 611 | gateways to which the device with `num_id` 456 is bound. |
| 612 | gatewayListOptions_gatewayType: string, If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY` |
| 613 | is specified, only non-gateway devices are returned. If |
| 614 | `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 615 | gatewayListOptions_associationsGatewayId: string, If set, only devices associated with the specified gateway are returned. |
| 616 | The gateway ID can be numeric (`num_id`) or the user-defined string |
| 617 | (`id`). For example, if `123` is specified, only devices bound to the |
| 618 | gateway with `num_id` 123 are returned. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 619 | x__xgafv: string, V1 error format. |
| 620 | Allowed values |
| 621 | 1 - v1 error format |
| 622 | 2 - v2 error format |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 623 | |
| 624 | Returns: |
| 625 | An object of the form: |
| 626 | |
| 627 | { # Response for `ListDevices`. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 628 | "devices": [ # The devices that match the request. |
| 629 | { # The device resource. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 630 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 631 | # rotation without interruption, multiple device credentials can be bound to |
| 632 | # this device. No more than 3 credentials can be bound to a single device at |
| 633 | # a time. When new credentials are added to a device, they are verified |
| 634 | # against the registry credentials. For details, see the description of the |
| 635 | # `DeviceRegistry.credentials` field. |
| 636 | { # A server-stored device credential used for authentication. |
| 637 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 638 | # credential will be ignored for new client authentication requests after |
| 639 | # this timestamp; however, it will not be automatically deleted. |
| 640 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 641 | # When adding a new device credential, either via device creation or via |
| 642 | # modifications, this public key credential may be required to be signed by |
| 643 | # one of the registry level certificates. More specifically, if the |
| 644 | # registry contains at least one certificate, any new device credential |
| 645 | # must be signed by one of the registry certificates. As a result, |
| 646 | # when the registry contains certificates, only X.509 certificates are |
| 647 | # accepted as device credentials. However, if the registry does |
| 648 | # not contain a certificate, self-signed certificates and public keys will |
| 649 | # be accepted. New device credentials must be different from every |
| 650 | # registry-level certificate. |
| 651 | "key": "A String", # The key data. |
| 652 | "format": "A String", # The format of the key. |
| 653 | }, |
| 654 | }, |
| 655 | ], |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 656 | "name": "A String", # The resource path name. For example, |
| 657 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 658 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 659 | # When `name` is populated as a response from the service, it always ends |
| 660 | # in the device numeric ID. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 661 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 662 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 663 | # 'last_error_status'. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 664 | "logLevel": "A String", # **Beta Feature** |
| 665 | # |
| 666 | # The logging verbosity for device activity. If unspecified, |
| 667 | # DeviceRegistry.log_level will be used. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 668 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 669 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 670 | # information for the device. |
| 671 | # |
| 672 | # Keys must conform to the regular expression a-zA-Z+ and |
| 673 | # be less than 128 bytes in length. |
| 674 | # |
| 675 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 676 | # KB in size. |
| 677 | # |
| 678 | # The total size of all keys and values must be less than 256 KB, and the |
| 679 | # maximum number of key-value pairs is 500. |
| 680 | "a_key": "A String", |
| 681 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 682 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 683 | # within a device registry. |
| 684 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 685 | # was received from the device. This field is only for configurations |
| 686 | # sent through MQTT. |
| 687 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 688 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 689 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 690 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 691 | # gateway. |
| 692 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 693 | # specified in `last_accessed_gateway`. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 694 | }, |
| 695 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 696 | # more compact way to identify devices, and it is globally unique. |
| 697 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 698 | # Can be used to temporarily prevent the device from connecting if, for |
| 699 | # example, the sensor is generating bad data and needs maintenance. |
| 700 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 701 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 702 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 703 | # have been sent. Timestamps are periodically collected and written to |
| 704 | # storage; they may be stale by a few minutes. |
| 705 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 706 | # periodically collected and written to storage; they may be stale by a few |
| 707 | # minutes. |
| 708 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 709 | # the device. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 710 | "lastErrorStatus": { # The `Status` type defines a logical error model that is suitable for # [Output only] The error message of the most recent error, such as a failure |
| 711 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 712 | # field. If no errors have occurred, this field has an empty message |
| 713 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 714 | # status code other than OK. |
| 715 | # different programming environments, including REST APIs and RPC APIs. It is |
| 716 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 717 | # three pieces of data: error code, error message, and error details. |
| 718 | # |
| 719 | # You can find out more about this error model and how to work with it in the |
| 720 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 721 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 722 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 723 | # user-facing error message should be localized and sent in the |
| 724 | # google.rpc.Status.details field, or localized by the client. |
| 725 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 726 | # message types for APIs to use. |
| 727 | { |
| 728 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 729 | }, |
| 730 | ], |
| 731 | }, |
| 732 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 733 | # periodically collected and written to storage; they may be stale by a few |
| 734 | # minutes. |
| 735 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 736 | # has been reported, this field is not present. |
| 737 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 738 | # IoT Core. |
| 739 | "binaryData": "A String", # The device state data. |
| 740 | }, |
| 741 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 742 | # Cloud IoT Core to the device. If not present on creation, the |
| 743 | # configuration will be initialized with an empty payload and version value |
| 744 | # of `1`. To update this field after creation, use the |
| 745 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 746 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 747 | # the server, and is always greater than 0 after device creation. The |
| 748 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 749 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 750 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 751 | # Cloud IoT Core. This timestamp is set by the server. |
| 752 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 753 | # acknowledgment from the device, indicating that the device has received |
| 754 | # this configuration version. If this field is not present, the device has |
| 755 | # not yet acknowledged that it received this version. Note that when |
| 756 | # the config was sent to the device, many config versions may have been |
| 757 | # available in Cloud IoT Core while the device was disconnected, and on |
| 758 | # connection, only the latest version is sent to the device. Some |
| 759 | # versions may never be sent to the device, and therefore are never |
| 760 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 761 | "binaryData": "A String", # The device configuration data. |
| 762 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 763 | }, |
| 764 | ], |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 765 | "nextPageToken": "A String", # If not empty, indicates that there may be more devices that match the |
| 766 | # request; this value should be passed in a new `ListDevicesRequest`. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 767 | }</pre> |
| 768 | </div> |
| 769 | |
| 770 | <div class="method"> |
| 771 | <code class="details" id="list_next">list_next(previous_request, previous_response)</code> |
| 772 | <pre>Retrieves the next page of results. |
| 773 | |
| 774 | Args: |
| 775 | previous_request: The request for the previous page. (required) |
| 776 | previous_response: The response from the request for the previous page. (required) |
| 777 | |
| 778 | Returns: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 779 | A request object that you can call 'execute()' on to request the next |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 780 | page. Returns None if there are no more items in the collection. |
| 781 | </pre> |
| 782 | </div> |
| 783 | |
| 784 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 785 | <code class="details" id="modifyCloudToDeviceConfig">modifyCloudToDeviceConfig(name, body=None, x__xgafv=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 786 | <pre>Modifies the configuration for the device, which is eventually sent from |
| 787 | the Cloud IoT Core servers. Returns the modified configuration version and |
| 788 | its metadata. |
| 789 | |
| 790 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 791 | name: string, Required. The name of the device. For example, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 792 | `projects/p0/locations/us-central1/registries/registry0/devices/device0` or |
| 793 | `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 794 | body: object, The request body. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 795 | The object takes the form of: |
| 796 | |
| 797 | { # Request for `ModifyCloudToDeviceConfig`. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 798 | "binaryData": "A String", # Required. The configuration data for the device. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 799 | "versionToUpdate": "A String", # The version number to update. If this value is zero, it will not check the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 800 | # version number of the server and will always update the current version; |
| 801 | # otherwise, this update will fail if the version number found on the server |
| 802 | # does not match this version number. This is used to support multiple |
| 803 | # simultaneous updates without losing data. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 804 | } |
| 805 | |
| 806 | x__xgafv: string, V1 error format. |
| 807 | Allowed values |
| 808 | 1 - v1 error format |
| 809 | 2 - v2 error format |
| 810 | |
| 811 | Returns: |
| 812 | An object of the form: |
| 813 | |
| 814 | { # The device configuration. Eventually delivered to devices. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 815 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 816 | # the server, and is always greater than 0 after device creation. The |
| 817 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 818 | # specified; the response of `CreateDevice` will always have a value of 1. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 819 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 820 | # Cloud IoT Core. This timestamp is set by the server. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 821 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 822 | # acknowledgment from the device, indicating that the device has received |
| 823 | # this configuration version. If this field is not present, the device has |
| 824 | # not yet acknowledged that it received this version. Note that when |
| 825 | # the config was sent to the device, many config versions may have been |
| 826 | # available in Cloud IoT Core while the device was disconnected, and on |
| 827 | # connection, only the latest version is sent to the device. Some |
| 828 | # versions may never be sent to the device, and therefore are never |
| 829 | # acknowledged. This timestamp is set by Cloud IoT Core. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 830 | "binaryData": "A String", # The device configuration data. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 831 | }</pre> |
| 832 | </div> |
| 833 | |
| 834 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 835 | <code class="details" id="patch">patch(name, body=None, updateMask=None, x__xgafv=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 836 | <pre>Updates a device. |
| 837 | |
| 838 | Args: |
| 839 | name: string, The resource path name. For example, |
| 840 | `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 841 | `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 842 | When `name` is populated as a response from the service, it always ends |
| 843 | in the device numeric ID. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 844 | body: object, The request body. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 845 | The object takes the form of: |
| 846 | |
| 847 | { # The device resource. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 848 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 849 | # rotation without interruption, multiple device credentials can be bound to |
| 850 | # this device. No more than 3 credentials can be bound to a single device at |
| 851 | # a time. When new credentials are added to a device, they are verified |
| 852 | # against the registry credentials. For details, see the description of the |
| 853 | # `DeviceRegistry.credentials` field. |
| 854 | { # A server-stored device credential used for authentication. |
| 855 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 856 | # credential will be ignored for new client authentication requests after |
| 857 | # this timestamp; however, it will not be automatically deleted. |
| 858 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 859 | # When adding a new device credential, either via device creation or via |
| 860 | # modifications, this public key credential may be required to be signed by |
| 861 | # one of the registry level certificates. More specifically, if the |
| 862 | # registry contains at least one certificate, any new device credential |
| 863 | # must be signed by one of the registry certificates. As a result, |
| 864 | # when the registry contains certificates, only X.509 certificates are |
| 865 | # accepted as device credentials. However, if the registry does |
| 866 | # not contain a certificate, self-signed certificates and public keys will |
| 867 | # be accepted. New device credentials must be different from every |
| 868 | # registry-level certificate. |
| 869 | "key": "A String", # The key data. |
| 870 | "format": "A String", # The format of the key. |
| 871 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 872 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 873 | ], |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 874 | "name": "A String", # The resource path name. For example, |
| 875 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 876 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 877 | # When `name` is populated as a response from the service, it always ends |
| 878 | # in the device numeric ID. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 879 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 880 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 881 | # 'last_error_status'. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 882 | "logLevel": "A String", # **Beta Feature** |
| 883 | # |
| 884 | # The logging verbosity for device activity. If unspecified, |
| 885 | # DeviceRegistry.log_level will be used. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 886 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 887 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 888 | # information for the device. |
| 889 | # |
| 890 | # Keys must conform to the regular expression a-zA-Z+ and |
| 891 | # be less than 128 bytes in length. |
| 892 | # |
| 893 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 894 | # KB in size. |
| 895 | # |
| 896 | # The total size of all keys and values must be less than 256 KB, and the |
| 897 | # maximum number of key-value pairs is 500. |
| 898 | "a_key": "A String", |
| 899 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 900 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 901 | # within a device registry. |
| 902 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 903 | # was received from the device. This field is only for configurations |
| 904 | # sent through MQTT. |
| 905 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 906 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 907 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 908 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 909 | # gateway. |
| 910 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 911 | # specified in `last_accessed_gateway`. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 912 | }, |
| 913 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 914 | # more compact way to identify devices, and it is globally unique. |
| 915 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 916 | # Can be used to temporarily prevent the device from connecting if, for |
| 917 | # example, the sensor is generating bad data and needs maintenance. |
| 918 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 919 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 920 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 921 | # have been sent. Timestamps are periodically collected and written to |
| 922 | # storage; they may be stale by a few minutes. |
| 923 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 924 | # periodically collected and written to storage; they may be stale by a few |
| 925 | # minutes. |
| 926 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 927 | # the device. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 928 | "lastErrorStatus": { # The `Status` type defines a logical error model that is suitable for # [Output only] The error message of the most recent error, such as a failure |
| 929 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 930 | # field. If no errors have occurred, this field has an empty message |
| 931 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 932 | # status code other than OK. |
| 933 | # different programming environments, including REST APIs and RPC APIs. It is |
| 934 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 935 | # three pieces of data: error code, error message, and error details. |
| 936 | # |
| 937 | # You can find out more about this error model and how to work with it in the |
| 938 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 939 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 940 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 941 | # user-facing error message should be localized and sent in the |
| 942 | # google.rpc.Status.details field, or localized by the client. |
| 943 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 944 | # message types for APIs to use. |
| 945 | { |
| 946 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 947 | }, |
| 948 | ], |
| 949 | }, |
| 950 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 951 | # periodically collected and written to storage; they may be stale by a few |
| 952 | # minutes. |
| 953 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 954 | # has been reported, this field is not present. |
| 955 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 956 | # IoT Core. |
| 957 | "binaryData": "A String", # The device state data. |
| 958 | }, |
| 959 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 960 | # Cloud IoT Core to the device. If not present on creation, the |
| 961 | # configuration will be initialized with an empty payload and version value |
| 962 | # of `1`. To update this field after creation, use the |
| 963 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 964 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 965 | # the server, and is always greater than 0 after device creation. The |
| 966 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 967 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 968 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 969 | # Cloud IoT Core. This timestamp is set by the server. |
| 970 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 971 | # acknowledgment from the device, indicating that the device has received |
| 972 | # this configuration version. If this field is not present, the device has |
| 973 | # not yet acknowledged that it received this version. Note that when |
| 974 | # the config was sent to the device, many config versions may have been |
| 975 | # available in Cloud IoT Core while the device was disconnected, and on |
| 976 | # connection, only the latest version is sent to the device. Some |
| 977 | # versions may never be sent to the device, and therefore are never |
| 978 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 979 | "binaryData": "A String", # The device configuration data. |
| 980 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 981 | } |
| 982 | |
| 983 | updateMask: string, Required. Only updates the `device` fields indicated by this mask. |
| 984 | The field mask must not be empty, and it must not contain fields that |
| 985 | are immutable or only set by the server. |
| 986 | Mutable top-level fields: `credentials`, `blocked`, and `metadata` |
| 987 | x__xgafv: string, V1 error format. |
| 988 | Allowed values |
| 989 | 1 - v1 error format |
| 990 | 2 - v2 error format |
| 991 | |
| 992 | Returns: |
| 993 | An object of the form: |
| 994 | |
| 995 | { # The device resource. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 996 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 997 | # rotation without interruption, multiple device credentials can be bound to |
| 998 | # this device. No more than 3 credentials can be bound to a single device at |
| 999 | # a time. When new credentials are added to a device, they are verified |
| 1000 | # against the registry credentials. For details, see the description of the |
| 1001 | # `DeviceRegistry.credentials` field. |
| 1002 | { # A server-stored device credential used for authentication. |
| 1003 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 1004 | # credential will be ignored for new client authentication requests after |
| 1005 | # this timestamp; however, it will not be automatically deleted. |
| 1006 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 1007 | # When adding a new device credential, either via device creation or via |
| 1008 | # modifications, this public key credential may be required to be signed by |
| 1009 | # one of the registry level certificates. More specifically, if the |
| 1010 | # registry contains at least one certificate, any new device credential |
| 1011 | # must be signed by one of the registry certificates. As a result, |
| 1012 | # when the registry contains certificates, only X.509 certificates are |
| 1013 | # accepted as device credentials. However, if the registry does |
| 1014 | # not contain a certificate, self-signed certificates and public keys will |
| 1015 | # be accepted. New device credentials must be different from every |
| 1016 | # registry-level certificate. |
| 1017 | "key": "A String", # The key data. |
| 1018 | "format": "A String", # The format of the key. |
| 1019 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1020 | }, |
| 1021 | ], |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 1022 | "name": "A String", # The resource path name. For example, |
| 1023 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 1024 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 1025 | # When `name` is populated as a response from the service, it always ends |
| 1026 | # in the device numeric ID. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1027 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 1028 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 1029 | # 'last_error_status'. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 1030 | "logLevel": "A String", # **Beta Feature** |
| 1031 | # |
| 1032 | # The logging verbosity for device activity. If unspecified, |
| 1033 | # DeviceRegistry.log_level will be used. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1034 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 1035 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 1036 | # information for the device. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1037 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1038 | # Keys must conform to the regular expression a-zA-Z+ and |
| 1039 | # be less than 128 bytes in length. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1040 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1041 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 1042 | # KB in size. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1043 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1044 | # The total size of all keys and values must be less than 256 KB, and the |
| 1045 | # maximum number of key-value pairs is 500. |
| 1046 | "a_key": "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1047 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1048 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 1049 | # within a device registry. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1050 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 1051 | # was received from the device. This field is only for configurations |
| 1052 | # sent through MQTT. |
| 1053 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 1054 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1055 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 1056 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 1057 | # gateway. |
| 1058 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 1059 | # specified in `last_accessed_gateway`. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1060 | }, |
| 1061 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 1062 | # more compact way to identify devices, and it is globally unique. |
| 1063 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 1064 | # Can be used to temporarily prevent the device from connecting if, for |
| 1065 | # example, the sensor is generating bad data and needs maintenance. |
| 1066 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 1067 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 1068 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 1069 | # have been sent. Timestamps are periodically collected and written to |
| 1070 | # storage; they may be stale by a few minutes. |
| 1071 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 1072 | # periodically collected and written to storage; they may be stale by a few |
| 1073 | # minutes. |
| 1074 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 1075 | # the device. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame] | 1076 | "lastErrorStatus": { # The `Status` type defines a logical error model that is suitable for # [Output only] The error message of the most recent error, such as a failure |
| 1077 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 1078 | # field. If no errors have occurred, this field has an empty message |
| 1079 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 1080 | # status code other than OK. |
| 1081 | # different programming environments, including REST APIs and RPC APIs. It is |
| 1082 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 1083 | # three pieces of data: error code, error message, and error details. |
| 1084 | # |
| 1085 | # You can find out more about this error model and how to work with it in the |
| 1086 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 1087 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 1088 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 1089 | # user-facing error message should be localized and sent in the |
| 1090 | # google.rpc.Status.details field, or localized by the client. |
| 1091 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 1092 | # message types for APIs to use. |
| 1093 | { |
| 1094 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 1095 | }, |
| 1096 | ], |
| 1097 | }, |
| 1098 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 1099 | # periodically collected and written to storage; they may be stale by a few |
| 1100 | # minutes. |
| 1101 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 1102 | # has been reported, this field is not present. |
| 1103 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 1104 | # IoT Core. |
| 1105 | "binaryData": "A String", # The device state data. |
| 1106 | }, |
| 1107 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 1108 | # Cloud IoT Core to the device. If not present on creation, the |
| 1109 | # configuration will be initialized with an empty payload and version value |
| 1110 | # of `1`. To update this field after creation, use the |
| 1111 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 1112 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 1113 | # the server, and is always greater than 0 after device creation. The |
| 1114 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 1115 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 1116 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 1117 | # Cloud IoT Core. This timestamp is set by the server. |
| 1118 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 1119 | # acknowledgment from the device, indicating that the device has received |
| 1120 | # this configuration version. If this field is not present, the device has |
| 1121 | # not yet acknowledged that it received this version. Note that when |
| 1122 | # the config was sent to the device, many config versions may have been |
| 1123 | # available in Cloud IoT Core while the device was disconnected, and on |
| 1124 | # connection, only the latest version is sent to the device. Some |
| 1125 | # versions may never be sent to the device, and therefore are never |
| 1126 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 1127 | "binaryData": "A String", # The device configuration data. |
| 1128 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1129 | }</pre> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1130 | </div> |
| 1131 | |
| 1132 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 1133 | <code class="details" id="sendCommandToDevice">sendCommandToDevice(name, body=None, x__xgafv=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1134 | <pre>Sends a command to the specified device. In order for a device to be able |
| 1135 | to receive commands, it must: |
| 1136 | 1) be connected to Cloud IoT Core using the MQTT protocol, and |
| 1137 | 2) be subscribed to the group of MQTT topics specified by |
| 1138 | /devices/{device-id}/commands/#. This subscription will receive commands |
| 1139 | at the top-level topic /devices/{device-id}/commands as well as commands |
| 1140 | for subfolders, like /devices/{device-id}/commands/subfolder. |
| 1141 | Note that subscribing to specific subfolders is not supported. |
| 1142 | If the command could not be delivered to the device, this method will |
| 1143 | return an error; in particular, if the device is not subscribed, this |
| 1144 | method will return FAILED_PRECONDITION. Otherwise, this method will |
| 1145 | return OK. If the subscription is QoS 1, at least once delivery will be |
| 1146 | guaranteed; for QoS 0, no acknowledgment will be expected from the device. |
| 1147 | |
| 1148 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 1149 | name: string, Required. The name of the device. For example, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1150 | `projects/p0/locations/us-central1/registries/registry0/devices/device0` or |
| 1151 | `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 1152 | body: object, The request body. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1153 | The object takes the form of: |
| 1154 | |
| 1155 | { # Request for `SendCommandToDevice`. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1156 | "subfolder": "A String", # Optional subfolder for the command. If empty, the command will be delivered |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1157 | # to the /devices/{device-id}/commands topic, otherwise it will be delivered |
| 1158 | # to the /devices/{device-id}/commands/{subfolder} topic. Multi-level |
| 1159 | # subfolders are allowed. This field must not have more than 256 characters, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1160 | # and must not contain any MQTT wildcards ("+" or "#") or null characters. |
| 1161 | "binaryData": "A String", # Required. The command data to send to the device. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1162 | } |
| 1163 | |
| 1164 | x__xgafv: string, V1 error format. |
| 1165 | Allowed values |
| 1166 | 1 - v1 error format |
| 1167 | 2 - v2 error format |
| 1168 | |
| 1169 | Returns: |
| 1170 | An object of the form: |
| 1171 | |
| 1172 | { # Response for `SendCommandToDevice`. |
| 1173 | }</pre> |
| 1174 | </div> |
| 1175 | |
| 1176 | </body></html> |