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