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 | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 97 | <code><a href="#list">list(parent, deviceIds=None, gatewayListOptions_associationsDeviceId=None, deviceNumIds=None, gatewayListOptions_gatewayType=None, gatewayListOptions_associationsGatewayId=None, fieldMask=None, pageToken=None, pageSize=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 | "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 |
| 125 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 126 | # field. If no errors have occurred, this field has an empty message |
| 127 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 128 | # status code other than OK. |
| 129 | # different programming environments, including REST APIs and RPC APIs. It is |
| 130 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 131 | # three pieces of data: error code, error message, and error details. |
| 132 | # |
| 133 | # You can find out more about this error model and how to work with it in the |
| 134 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 135 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 136 | # message types for APIs to use. |
| 137 | { |
| 138 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 139 | }, |
| 140 | ], |
| 141 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 142 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 143 | # user-facing error message should be localized and sent in the |
| 144 | # google.rpc.Status.details field, or localized by the client. |
| 145 | }, |
| 146 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 147 | # periodically collected and written to storage; they may be stale by a few |
| 148 | # minutes. |
| 149 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 150 | # Cloud IoT Core to the device. If not present on creation, the |
| 151 | # configuration will be initialized with an empty payload and version value |
| 152 | # of `1`. To update this field after creation, use the |
| 153 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 154 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 155 | # the server, and is always greater than 0 after device creation. The |
| 156 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 157 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 158 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 159 | # Cloud IoT Core. This timestamp is set by the server. |
| 160 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 161 | # acknowledgment from the device, indicating that the device has received |
| 162 | # this configuration version. If this field is not present, the device has |
| 163 | # not yet acknowledged that it received this version. Note that when |
| 164 | # the config was sent to the device, many config versions may have been |
| 165 | # available in Cloud IoT Core while the device was disconnected, and on |
| 166 | # connection, only the latest version is sent to the device. Some |
| 167 | # versions may never be sent to the device, and therefore are never |
| 168 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 169 | "binaryData": "A String", # The device configuration data. |
| 170 | }, |
| 171 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 172 | # has been reported, this field is not present. |
| 173 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 174 | # IoT Core. |
| 175 | "binaryData": "A String", # The device state data. |
| 176 | }, |
| 177 | "name": "A String", # The resource path name. For example, |
| 178 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 179 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 180 | # When `name` is populated as a response from the service, it always ends |
| 181 | # in the device numeric ID. |
| 182 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 183 | # rotation without interruption, multiple device credentials can be bound to |
| 184 | # this device. No more than 3 credentials can be bound to a single device at |
| 185 | # a time. When new credentials are added to a device, they are verified |
| 186 | # against the registry credentials. For details, see the description of the |
| 187 | # `DeviceRegistry.credentials` field. |
| 188 | { # A server-stored device credential used for authentication. |
| 189 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 190 | # credential will be ignored for new client authentication requests after |
| 191 | # this timestamp; however, it will not be automatically deleted. |
| 192 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 193 | # When adding a new device credential, either via device creation or via |
| 194 | # modifications, this public key credential may be required to be signed by |
| 195 | # one of the registry level certificates. More specifically, if the |
| 196 | # registry contains at least one certificate, any new device credential |
| 197 | # must be signed by one of the registry certificates. As a result, |
| 198 | # when the registry contains certificates, only X.509 certificates are |
| 199 | # accepted as device credentials. However, if the registry does |
| 200 | # not contain a certificate, self-signed certificates and public keys will |
| 201 | # be accepted. New device credentials must be different from every |
| 202 | # registry-level certificate. |
| 203 | "key": "A String", # The key data. |
| 204 | "format": "A String", # The format of the key. |
| 205 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 206 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 207 | ], |
| 208 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 209 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 210 | # 'last_error_status'. |
| 211 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 212 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 213 | # information for the device. |
| 214 | # |
| 215 | # Keys must conform to the regular expression a-zA-Z+ and |
| 216 | # be less than 128 bytes in length. |
| 217 | # |
| 218 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 219 | # KB in size. |
| 220 | # |
| 221 | # The total size of all keys and values must be less than 256 KB, and the |
| 222 | # maximum number of key-value pairs is 500. |
| 223 | "a_key": "A String", |
| 224 | }, |
| 225 | "logLevel": "A String", # **Beta Feature** |
| 226 | # |
| 227 | # The logging verbosity for device activity. If unspecified, |
| 228 | # DeviceRegistry.log_level will be used. |
| 229 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 230 | # within a device registry. |
| 231 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 232 | # was received from the device. This field is only for configurations |
| 233 | # sent through MQTT. |
| 234 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
| 235 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 236 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 237 | # gateway. |
| 238 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 239 | # specified in `last_accessed_gateway`. |
| 240 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
| 241 | }, |
| 242 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 243 | # more compact way to identify devices, and it is globally unique. |
| 244 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 245 | # Can be used to temporarily prevent the device from connecting if, for |
| 246 | # example, the sensor is generating bad data and needs maintenance. |
| 247 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 248 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 249 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 250 | # have been sent. Timestamps are periodically collected and written to |
| 251 | # storage; they may be stale by a few minutes. |
| 252 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 253 | # periodically collected and written to storage; they may be stale by a few |
| 254 | # minutes. |
| 255 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 256 | # the device. |
| 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 | "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 |
| 269 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 270 | # field. If no errors have occurred, this field has an empty message |
| 271 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 272 | # status code other than OK. |
| 273 | # different programming environments, including REST APIs and RPC APIs. It is |
| 274 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 275 | # three pieces of data: error code, error message, and error details. |
| 276 | # |
| 277 | # You can find out more about this error model and how to work with it in the |
| 278 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 279 | "details": [ # A list of messages that carry the error details. There is a common set of |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 280 | # message types for APIs to use. |
| 281 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 282 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 283 | }, |
| 284 | ], |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 285 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 286 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 287 | # user-facing error message should be localized and sent in the |
| 288 | # google.rpc.Status.details field, or localized by the client. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 289 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 290 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 291 | # periodically collected and written to storage; they may be stale by a few |
| 292 | # minutes. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 293 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 294 | # Cloud IoT Core to the device. If not present on creation, the |
| 295 | # configuration will be initialized with an empty payload and version value |
| 296 | # of `1`. To update this field after creation, use the |
| 297 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 298 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 299 | # the server, and is always greater than 0 after device creation. The |
| 300 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 301 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 302 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 303 | # Cloud IoT Core. This timestamp is set by the server. |
| 304 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 305 | # acknowledgment from the device, indicating that the device has received |
| 306 | # this configuration version. If this field is not present, the device has |
| 307 | # not yet acknowledged that it received this version. Note that when |
| 308 | # the config was sent to the device, many config versions may have been |
| 309 | # available in Cloud IoT Core while the device was disconnected, and on |
| 310 | # connection, only the latest version is sent to the device. Some |
| 311 | # versions may never be sent to the device, and therefore are never |
| 312 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 313 | "binaryData": "A String", # The device configuration data. |
| 314 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 315 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 316 | # has been reported, this field is not present. |
| 317 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 318 | # IoT Core. |
| 319 | "binaryData": "A String", # The device state data. |
| 320 | }, |
| 321 | "name": "A String", # The resource path name. For example, |
| 322 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 323 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 324 | # When `name` is populated as a response from the service, it always ends |
| 325 | # in the device numeric ID. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 326 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 327 | # rotation without interruption, multiple device credentials can be bound to |
| 328 | # this device. No more than 3 credentials can be bound to a single device at |
| 329 | # a time. When new credentials are added to a device, they are verified |
| 330 | # against the registry credentials. For details, see the description of the |
| 331 | # `DeviceRegistry.credentials` field. |
| 332 | { # A server-stored device credential used for authentication. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 333 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 334 | # credential will be ignored for new client authentication requests after |
| 335 | # this timestamp; however, it will not be automatically deleted. |
| 336 | "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] | 337 | # When adding a new device credential, either via device creation or via |
| 338 | # modifications, this public key credential may be required to be signed by |
| 339 | # one of the registry level certificates. More specifically, if the |
| 340 | # registry contains at least one certificate, any new device credential |
| 341 | # must be signed by one of the registry certificates. As a result, |
| 342 | # when the registry contains certificates, only X.509 certificates are |
| 343 | # accepted as device credentials. However, if the registry does |
| 344 | # not contain a certificate, self-signed certificates and public keys will |
| 345 | # be accepted. New device credentials must be different from every |
| 346 | # registry-level certificate. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 347 | "key": "A String", # The key data. |
| 348 | "format": "A String", # The format of the key. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 349 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 350 | }, |
| 351 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 352 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 353 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 354 | # 'last_error_status'. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 355 | "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] | 356 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 357 | # information for the device. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 358 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 359 | # Keys must conform to the regular expression a-zA-Z+ and |
| 360 | # be less than 128 bytes in length. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 361 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 362 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 363 | # KB in size. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 364 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 365 | # The total size of all keys and values must be less than 256 KB, and the |
| 366 | # maximum number of key-value pairs is 500. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 367 | "a_key": "A String", |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 368 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 369 | "logLevel": "A String", # **Beta Feature** |
| 370 | # |
| 371 | # The logging verbosity for device activity. If unspecified, |
| 372 | # DeviceRegistry.log_level will be used. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 373 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 374 | # within a device registry. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 375 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 376 | # was received from the device. This field is only for configurations |
| 377 | # sent through MQTT. |
| 378 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
| 379 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 380 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 381 | # gateway. |
| 382 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 383 | # specified in `last_accessed_gateway`. |
| 384 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
| 385 | }, |
| 386 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 387 | # more compact way to identify devices, and it is globally unique. |
| 388 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 389 | # Can be used to temporarily prevent the device from connecting if, for |
| 390 | # example, the sensor is generating bad data and needs maintenance. |
| 391 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 392 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 393 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 394 | # have been sent. Timestamps are periodically collected and written to |
| 395 | # storage; they may be stale by a few minutes. |
| 396 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 397 | # periodically collected and written to storage; they may be stale by a few |
| 398 | # minutes. |
| 399 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 400 | # the device. |
| 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 | "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 |
| 452 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 453 | # field. If no errors have occurred, this field has an empty message |
| 454 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 455 | # status code other than OK. |
| 456 | # different programming environments, including REST APIs and RPC APIs. It is |
| 457 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 458 | # three pieces of data: error code, error message, and error details. |
| 459 | # |
| 460 | # You can find out more about this error model and how to work with it in the |
| 461 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 462 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 463 | # message types for APIs to use. |
| 464 | { |
| 465 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 466 | }, |
| 467 | ], |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 468 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 469 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 470 | # user-facing error message should be localized and sent in the |
| 471 | # google.rpc.Status.details field, or localized by the client. |
| 472 | }, |
| 473 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 474 | # periodically collected and written to storage; they may be stale by a few |
| 475 | # minutes. |
| 476 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 477 | # Cloud IoT Core to the device. If not present on creation, the |
| 478 | # configuration will be initialized with an empty payload and version value |
| 479 | # of `1`. To update this field after creation, use the |
| 480 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 481 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 482 | # the server, and is always greater than 0 after device creation. The |
| 483 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 484 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 485 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 486 | # Cloud IoT Core. This timestamp is set by the server. |
| 487 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 488 | # acknowledgment from the device, indicating that the device has received |
| 489 | # this configuration version. If this field is not present, the device has |
| 490 | # not yet acknowledged that it received this version. Note that when |
| 491 | # the config was sent to the device, many config versions may have been |
| 492 | # available in Cloud IoT Core while the device was disconnected, and on |
| 493 | # connection, only the latest version is sent to the device. Some |
| 494 | # versions may never be sent to the device, and therefore are never |
| 495 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 496 | "binaryData": "A String", # The device configuration data. |
| 497 | }, |
| 498 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 499 | # has been reported, this field is not present. |
| 500 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 501 | # IoT Core. |
| 502 | "binaryData": "A String", # The device state data. |
| 503 | }, |
| 504 | "name": "A String", # The resource path name. For example, |
| 505 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 506 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 507 | # When `name` is populated as a response from the service, it always ends |
| 508 | # in the device numeric ID. |
| 509 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 510 | # rotation without interruption, multiple device credentials can be bound to |
| 511 | # this device. No more than 3 credentials can be bound to a single device at |
| 512 | # a time. When new credentials are added to a device, they are verified |
| 513 | # against the registry credentials. For details, see the description of the |
| 514 | # `DeviceRegistry.credentials` field. |
| 515 | { # A server-stored device credential used for authentication. |
| 516 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 517 | # credential will be ignored for new client authentication requests after |
| 518 | # this timestamp; however, it will not be automatically deleted. |
| 519 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 520 | # When adding a new device credential, either via device creation or via |
| 521 | # modifications, this public key credential may be required to be signed by |
| 522 | # one of the registry level certificates. More specifically, if the |
| 523 | # registry contains at least one certificate, any new device credential |
| 524 | # must be signed by one of the registry certificates. As a result, |
| 525 | # when the registry contains certificates, only X.509 certificates are |
| 526 | # accepted as device credentials. However, if the registry does |
| 527 | # not contain a certificate, self-signed certificates and public keys will |
| 528 | # be accepted. New device credentials must be different from every |
| 529 | # registry-level certificate. |
| 530 | "key": "A String", # The key data. |
| 531 | "format": "A String", # The format of the key. |
| 532 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 533 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 534 | ], |
| 535 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 536 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 537 | # 'last_error_status'. |
| 538 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 539 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 540 | # information for the device. |
| 541 | # |
| 542 | # Keys must conform to the regular expression a-zA-Z+ and |
| 543 | # be less than 128 bytes in length. |
| 544 | # |
| 545 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 546 | # KB in size. |
| 547 | # |
| 548 | # The total size of all keys and values must be less than 256 KB, and the |
| 549 | # maximum number of key-value pairs is 500. |
| 550 | "a_key": "A String", |
| 551 | }, |
| 552 | "logLevel": "A String", # **Beta Feature** |
| 553 | # |
| 554 | # The logging verbosity for device activity. If unspecified, |
| 555 | # DeviceRegistry.log_level will be used. |
| 556 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 557 | # within a device registry. |
| 558 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 559 | # was received from the device. This field is only for configurations |
| 560 | # sent through MQTT. |
| 561 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
| 562 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 563 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 564 | # gateway. |
| 565 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 566 | # specified in `last_accessed_gateway`. |
| 567 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
| 568 | }, |
| 569 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 570 | # more compact way to identify devices, and it is globally unique. |
| 571 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 572 | # Can be used to temporarily prevent the device from connecting if, for |
| 573 | # example, the sensor is generating bad data and needs maintenance. |
| 574 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 575 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 576 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 577 | # have been sent. Timestamps are periodically collected and written to |
| 578 | # storage; they may be stale by a few minutes. |
| 579 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 580 | # periodically collected and written to storage; they may be stale by a few |
| 581 | # minutes. |
| 582 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 583 | # the device. |
| 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 | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 588 | <code class="details" id="list">list(parent, deviceIds=None, gatewayListOptions_associationsDeviceId=None, deviceNumIds=None, gatewayListOptions_gatewayType=None, gatewayListOptions_associationsGatewayId=None, fieldMask=None, pageToken=None, pageSize=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 | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 594 | deviceIds: string, A list of device string IDs. For example, `['device0', 'device12']`. |
| 595 | If empty, this field is ignored. Maximum IDs: 10,000 (repeated) |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 596 | gatewayListOptions_associationsDeviceId: string, If set, returns only the gateways with which the specified device is |
| 597 | associated. The device ID can be numeric (`num_id`) or the user-defined |
| 598 | string (`id`). For example, if `456` is specified, returns only the |
| 599 | gateways to which the device with `num_id` 456 is bound. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 600 | deviceNumIds: string, A list of device numeric IDs. If empty, this field is ignored. Maximum |
| 601 | IDs: 10,000. (repeated) |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 602 | gatewayListOptions_gatewayType: string, If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY` |
| 603 | is specified, only non-gateway devices are returned. If |
| 604 | `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 605 | gatewayListOptions_associationsGatewayId: string, If set, only devices associated with the specified gateway are returned. |
| 606 | The gateway ID can be numeric (`num_id`) or the user-defined string |
| 607 | (`id`). For example, if `123` is specified, only devices bound to the |
| 608 | gateway with `num_id` 123 are returned. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 609 | fieldMask: string, The fields of the `Device` resource to be returned in the response. The |
| 610 | fields `id` and `num_id` are always returned, along with any |
| 611 | other fields specified. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 612 | pageToken: string, The value returned by the last `ListDevicesResponse`; indicates |
| 613 | that this is a continuation of a prior `ListDevices` call and |
| 614 | the system should return the next page of data. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 615 | pageSize: integer, The maximum number of devices to return in the response. If this value |
| 616 | is zero, the service will select a default size. A call may return fewer |
| 617 | objects than requested. A non-empty `next_page_token` in the response |
| 618 | indicates that more data is available. |
| 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 | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 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`. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 630 | "devices": [ # The devices that match the request. |
| 631 | { # The device resource. |
| 632 | "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 |
| 633 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 634 | # field. If no errors have occurred, this field has an empty message |
| 635 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 636 | # status code other than OK. |
| 637 | # different programming environments, including REST APIs and RPC APIs. It is |
| 638 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 639 | # three pieces of data: error code, error message, and error details. |
| 640 | # |
| 641 | # You can find out more about this error model and how to work with it in the |
| 642 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 643 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 644 | # message types for APIs to use. |
| 645 | { |
| 646 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 647 | }, |
| 648 | ], |
| 649 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 650 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 651 | # user-facing error message should be localized and sent in the |
| 652 | # google.rpc.Status.details field, or localized by the client. |
| 653 | }, |
| 654 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 655 | # periodically collected and written to storage; they may be stale by a few |
| 656 | # minutes. |
| 657 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 658 | # Cloud IoT Core to the device. If not present on creation, the |
| 659 | # configuration will be initialized with an empty payload and version value |
| 660 | # of `1`. To update this field after creation, use the |
| 661 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 662 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 663 | # the server, and is always greater than 0 after device creation. The |
| 664 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 665 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 666 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 667 | # Cloud IoT Core. This timestamp is set by the server. |
| 668 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 669 | # acknowledgment from the device, indicating that the device has received |
| 670 | # this configuration version. If this field is not present, the device has |
| 671 | # not yet acknowledged that it received this version. Note that when |
| 672 | # the config was sent to the device, many config versions may have been |
| 673 | # available in Cloud IoT Core while the device was disconnected, and on |
| 674 | # connection, only the latest version is sent to the device. Some |
| 675 | # versions may never be sent to the device, and therefore are never |
| 676 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 677 | "binaryData": "A String", # The device configuration data. |
| 678 | }, |
| 679 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 680 | # has been reported, this field is not present. |
| 681 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 682 | # IoT Core. |
| 683 | "binaryData": "A String", # The device state data. |
| 684 | }, |
| 685 | "name": "A String", # The resource path name. For example, |
| 686 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 687 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 688 | # When `name` is populated as a response from the service, it always ends |
| 689 | # in the device numeric ID. |
| 690 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 691 | # rotation without interruption, multiple device credentials can be bound to |
| 692 | # this device. No more than 3 credentials can be bound to a single device at |
| 693 | # a time. When new credentials are added to a device, they are verified |
| 694 | # against the registry credentials. For details, see the description of the |
| 695 | # `DeviceRegistry.credentials` field. |
| 696 | { # A server-stored device credential used for authentication. |
| 697 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 698 | # credential will be ignored for new client authentication requests after |
| 699 | # this timestamp; however, it will not be automatically deleted. |
| 700 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 701 | # When adding a new device credential, either via device creation or via |
| 702 | # modifications, this public key credential may be required to be signed by |
| 703 | # one of the registry level certificates. More specifically, if the |
| 704 | # registry contains at least one certificate, any new device credential |
| 705 | # must be signed by one of the registry certificates. As a result, |
| 706 | # when the registry contains certificates, only X.509 certificates are |
| 707 | # accepted as device credentials. However, if the registry does |
| 708 | # not contain a certificate, self-signed certificates and public keys will |
| 709 | # be accepted. New device credentials must be different from every |
| 710 | # registry-level certificate. |
| 711 | "key": "A String", # The key data. |
| 712 | "format": "A String", # The format of the key. |
| 713 | }, |
| 714 | }, |
| 715 | ], |
| 716 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 717 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 718 | # 'last_error_status'. |
| 719 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 720 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 721 | # information for the device. |
| 722 | # |
| 723 | # Keys must conform to the regular expression a-zA-Z+ and |
| 724 | # be less than 128 bytes in length. |
| 725 | # |
| 726 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 727 | # KB in size. |
| 728 | # |
| 729 | # The total size of all keys and values must be less than 256 KB, and the |
| 730 | # maximum number of key-value pairs is 500. |
| 731 | "a_key": "A String", |
| 732 | }, |
| 733 | "logLevel": "A String", # **Beta Feature** |
| 734 | # |
| 735 | # The logging verbosity for device activity. If unspecified, |
| 736 | # DeviceRegistry.log_level will be used. |
| 737 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 738 | # within a device registry. |
| 739 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 740 | # was received from the device. This field is only for configurations |
| 741 | # sent through MQTT. |
| 742 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
| 743 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 744 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 745 | # gateway. |
| 746 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 747 | # specified in `last_accessed_gateway`. |
| 748 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
| 749 | }, |
| 750 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 751 | # more compact way to identify devices, and it is globally unique. |
| 752 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 753 | # Can be used to temporarily prevent the device from connecting if, for |
| 754 | # example, the sensor is generating bad data and needs maintenance. |
| 755 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 756 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 757 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 758 | # have been sent. Timestamps are periodically collected and written to |
| 759 | # storage; they may be stale by a few minutes. |
| 760 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 761 | # periodically collected and written to storage; they may be stale by a few |
| 762 | # minutes. |
| 763 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 764 | # the device. |
| 765 | }, |
| 766 | ], |
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 | "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 |
| 849 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 850 | # field. If no errors have occurred, this field has an empty message |
| 851 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 852 | # status code other than OK. |
| 853 | # different programming environments, including REST APIs and RPC APIs. It is |
| 854 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 855 | # three pieces of data: error code, error message, and error details. |
| 856 | # |
| 857 | # You can find out more about this error model and how to work with it in the |
| 858 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
| 859 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 860 | # message types for APIs to use. |
| 861 | { |
| 862 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 863 | }, |
| 864 | ], |
| 865 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 866 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 867 | # user-facing error message should be localized and sent in the |
| 868 | # google.rpc.Status.details field, or localized by the client. |
| 869 | }, |
| 870 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 871 | # periodically collected and written to storage; they may be stale by a few |
| 872 | # minutes. |
| 873 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 874 | # Cloud IoT Core to the device. If not present on creation, the |
| 875 | # configuration will be initialized with an empty payload and version value |
| 876 | # of `1`. To update this field after creation, use the |
| 877 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 878 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 879 | # the server, and is always greater than 0 after device creation. The |
| 880 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 881 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 882 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 883 | # Cloud IoT Core. This timestamp is set by the server. |
| 884 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 885 | # acknowledgment from the device, indicating that the device has received |
| 886 | # this configuration version. If this field is not present, the device has |
| 887 | # not yet acknowledged that it received this version. Note that when |
| 888 | # the config was sent to the device, many config versions may have been |
| 889 | # available in Cloud IoT Core while the device was disconnected, and on |
| 890 | # connection, only the latest version is sent to the device. Some |
| 891 | # versions may never be sent to the device, and therefore are never |
| 892 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 893 | "binaryData": "A String", # The device configuration data. |
| 894 | }, |
| 895 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 896 | # has been reported, this field is not present. |
| 897 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 898 | # IoT Core. |
| 899 | "binaryData": "A String", # The device state data. |
| 900 | }, |
| 901 | "name": "A String", # The resource path name. For example, |
| 902 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 903 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 904 | # When `name` is populated as a response from the service, it always ends |
| 905 | # in the device numeric ID. |
| 906 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 907 | # rotation without interruption, multiple device credentials can be bound to |
| 908 | # this device. No more than 3 credentials can be bound to a single device at |
| 909 | # a time. When new credentials are added to a device, they are verified |
| 910 | # against the registry credentials. For details, see the description of the |
| 911 | # `DeviceRegistry.credentials` field. |
| 912 | { # A server-stored device credential used for authentication. |
| 913 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 914 | # credential will be ignored for new client authentication requests after |
| 915 | # this timestamp; however, it will not be automatically deleted. |
| 916 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 917 | # When adding a new device credential, either via device creation or via |
| 918 | # modifications, this public key credential may be required to be signed by |
| 919 | # one of the registry level certificates. More specifically, if the |
| 920 | # registry contains at least one certificate, any new device credential |
| 921 | # must be signed by one of the registry certificates. As a result, |
| 922 | # when the registry contains certificates, only X.509 certificates are |
| 923 | # accepted as device credentials. However, if the registry does |
| 924 | # not contain a certificate, self-signed certificates and public keys will |
| 925 | # be accepted. New device credentials must be different from every |
| 926 | # registry-level certificate. |
| 927 | "key": "A String", # The key data. |
| 928 | "format": "A String", # The format of the key. |
| 929 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 930 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 931 | ], |
| 932 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 933 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 934 | # 'last_error_status'. |
| 935 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 936 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 937 | # information for the device. |
| 938 | # |
| 939 | # Keys must conform to the regular expression a-zA-Z+ and |
| 940 | # be less than 128 bytes in length. |
| 941 | # |
| 942 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 943 | # KB in size. |
| 944 | # |
| 945 | # The total size of all keys and values must be less than 256 KB, and the |
| 946 | # maximum number of key-value pairs is 500. |
| 947 | "a_key": "A String", |
| 948 | }, |
| 949 | "logLevel": "A String", # **Beta Feature** |
| 950 | # |
| 951 | # The logging verbosity for device activity. If unspecified, |
| 952 | # DeviceRegistry.log_level will be used. |
| 953 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 954 | # within a device registry. |
| 955 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 956 | # was received from the device. This field is only for configurations |
| 957 | # sent through MQTT. |
| 958 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
| 959 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 960 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 961 | # gateway. |
| 962 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 963 | # specified in `last_accessed_gateway`. |
| 964 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
| 965 | }, |
| 966 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 967 | # more compact way to identify devices, and it is globally unique. |
| 968 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 969 | # Can be used to temporarily prevent the device from connecting if, for |
| 970 | # example, the sensor is generating bad data and needs maintenance. |
| 971 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 972 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 973 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 974 | # have been sent. Timestamps are periodically collected and written to |
| 975 | # storage; they may be stale by a few minutes. |
| 976 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 977 | # periodically collected and written to storage; they may be stale by a few |
| 978 | # minutes. |
| 979 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 980 | # the device. |
| 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 | "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 |
| 997 | # to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this |
| 998 | # field. If no errors have occurred, this field has an empty message |
| 999 | # and the status code 0 == OK. Otherwise, this field is expected to have a |
| 1000 | # status code other than OK. |
| 1001 | # different programming environments, including REST APIs and RPC APIs. It is |
| 1002 | # used by [gRPC](https://github.com/grpc). Each `Status` message contains |
| 1003 | # three pieces of data: error code, error message, and error details. |
| 1004 | # |
| 1005 | # You can find out more about this error model and how to work with it in the |
| 1006 | # [API Design Guide](https://cloud.google.com/apis/design/errors). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1007 | "details": [ # A list of messages that carry the error details. There is a common set of |
| 1008 | # message types for APIs to use. |
| 1009 | { |
| 1010 | "a_key": "", # Properties of the object. Contains field @type with type URL. |
| 1011 | }, |
| 1012 | ], |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1013 | "code": 42, # The status code, which should be an enum value of google.rpc.Code. |
| 1014 | "message": "A String", # A developer-facing error message, which should be in English. Any |
| 1015 | # user-facing error message should be localized and sent in the |
| 1016 | # google.rpc.Status.details field, or localized by the client. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1017 | }, |
| 1018 | "lastStateTime": "A String", # [Output only] The last time a state event was received. Timestamps are |
| 1019 | # periodically collected and written to storage; they may be stale by a few |
| 1020 | # minutes. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1021 | "config": { # The device configuration. Eventually delivered to devices. # The most recent device configuration, which is eventually sent from |
| 1022 | # Cloud IoT Core to the device. If not present on creation, the |
| 1023 | # configuration will be initialized with an empty payload and version value |
| 1024 | # of `1`. To update this field after creation, use the |
| 1025 | # `DeviceManager.ModifyCloudToDeviceConfig` method. |
| 1026 | "version": "A String", # [Output only] The version of this update. The version number is assigned by |
| 1027 | # the server, and is always greater than 0 after device creation. The |
| 1028 | # version must be 0 on the `CreateDevice` request if a `config` is |
| 1029 | # specified; the response of `CreateDevice` will always have a value of 1. |
| 1030 | "cloudUpdateTime": "A String", # [Output only] The time at which this configuration version was updated in |
| 1031 | # Cloud IoT Core. This timestamp is set by the server. |
| 1032 | "deviceAckTime": "A String", # [Output only] The time at which Cloud IoT Core received the |
| 1033 | # acknowledgment from the device, indicating that the device has received |
| 1034 | # this configuration version. If this field is not present, the device has |
| 1035 | # not yet acknowledged that it received this version. Note that when |
| 1036 | # the config was sent to the device, many config versions may have been |
| 1037 | # available in Cloud IoT Core while the device was disconnected, and on |
| 1038 | # connection, only the latest version is sent to the device. Some |
| 1039 | # versions may never be sent to the device, and therefore are never |
| 1040 | # acknowledged. This timestamp is set by Cloud IoT Core. |
| 1041 | "binaryData": "A String", # The device configuration data. |
| 1042 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1043 | "state": { # The device state, as reported by the device. # [Output only] The state most recently received from the device. If no state |
| 1044 | # has been reported, this field is not present. |
| 1045 | "updateTime": "A String", # [Output only] The time at which this state version was updated in Cloud |
| 1046 | # IoT Core. |
| 1047 | "binaryData": "A String", # The device state data. |
| 1048 | }, |
| 1049 | "name": "A String", # The resource path name. For example, |
| 1050 | # `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or |
| 1051 | # `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. |
| 1052 | # When `name` is populated as a response from the service, it always ends |
| 1053 | # in the device numeric ID. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1054 | "credentials": [ # The credentials used to authenticate this device. To allow credential |
| 1055 | # rotation without interruption, multiple device credentials can be bound to |
| 1056 | # this device. No more than 3 credentials can be bound to a single device at |
| 1057 | # a time. When new credentials are added to a device, they are verified |
| 1058 | # against the registry credentials. For details, see the description of the |
| 1059 | # `DeviceRegistry.credentials` field. |
| 1060 | { # A server-stored device credential used for authentication. |
| 1061 | "expirationTime": "A String", # [Optional] The time at which this credential becomes invalid. This |
| 1062 | # credential will be ignored for new client authentication requests after |
| 1063 | # this timestamp; however, it will not be automatically deleted. |
| 1064 | "publicKey": { # A public key format and data. # A public key used to verify the signature of JSON Web Tokens (JWTs). |
| 1065 | # When adding a new device credential, either via device creation or via |
| 1066 | # modifications, this public key credential may be required to be signed by |
| 1067 | # one of the registry level certificates. More specifically, if the |
| 1068 | # registry contains at least one certificate, any new device credential |
| 1069 | # must be signed by one of the registry certificates. As a result, |
| 1070 | # when the registry contains certificates, only X.509 certificates are |
| 1071 | # accepted as device credentials. However, if the registry does |
| 1072 | # not contain a certificate, self-signed certificates and public keys will |
| 1073 | # be accepted. New device credentials must be different from every |
| 1074 | # registry-level certificate. |
| 1075 | "key": "A String", # The key data. |
| 1076 | "format": "A String", # The format of the key. |
| 1077 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1078 | }, |
| 1079 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1080 | "lastErrorTime": "A String", # [Output only] The time the most recent error occurred, such as a failure to |
| 1081 | # publish to Cloud Pub/Sub. This field is the timestamp of |
| 1082 | # 'last_error_status'. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1083 | "metadata": { # The metadata key-value pairs assigned to the device. This metadata is not |
| 1084 | # interpreted or indexed by Cloud IoT Core. It can be used to add contextual |
| 1085 | # information for the device. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1086 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1087 | # Keys must conform to the regular expression a-zA-Z+ and |
| 1088 | # be less than 128 bytes in length. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1089 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1090 | # Values are free-form strings. Each value must be less than or equal to 32 |
| 1091 | # KB in size. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1092 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1093 | # The total size of all keys and values must be less than 256 KB, and the |
| 1094 | # maximum number of key-value pairs is 500. |
| 1095 | "a_key": "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1096 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1097 | "logLevel": "A String", # **Beta Feature** |
| 1098 | # |
| 1099 | # The logging verbosity for device activity. If unspecified, |
| 1100 | # DeviceRegistry.log_level will be used. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 1101 | "id": "A String", # The user-defined device identifier. The device ID must be unique |
| 1102 | # within a device registry. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 1103 | "lastConfigAckTime": "A String", # [Output only] The last time a cloud-to-device config version acknowledgment |
| 1104 | # was received from the device. This field is only for configurations |
| 1105 | # sent through MQTT. |
| 1106 | "gatewayConfig": { # Gateway-related configuration and state. # Gateway-related configuration and state. |
| 1107 | "lastAccessedGatewayId": "A String", # [Output only] The ID of the gateway the device accessed most recently. |
| 1108 | "gatewayAuthMethod": "A String", # Indicates how to authorize and/or authenticate devices to access the |
| 1109 | # gateway. |
| 1110 | "lastAccessedGatewayTime": "A String", # [Output only] The most recent time at which the device accessed the gateway |
| 1111 | # specified in `last_accessed_gateway`. |
| 1112 | "gatewayType": "A String", # Indicates whether the device is a gateway. |
| 1113 | }, |
| 1114 | "numId": "A String", # [Output only] A server-defined unique numeric ID for the device. This is a |
| 1115 | # more compact way to identify devices, and it is globally unique. |
| 1116 | "blocked": True or False, # If a device is blocked, connections or requests from this device will fail. |
| 1117 | # Can be used to temporarily prevent the device from connecting if, for |
| 1118 | # example, the sensor is generating bad data and needs maintenance. |
| 1119 | "lastHeartbeatTime": "A String", # [Output only] The last time an MQTT `PINGREQ` was received. This field |
| 1120 | # applies only to devices connecting through MQTT. MQTT clients usually only |
| 1121 | # send `PINGREQ` messages if the connection is idle, and no other messages |
| 1122 | # have been sent. Timestamps are periodically collected and written to |
| 1123 | # storage; they may be stale by a few minutes. |
| 1124 | "lastEventTime": "A String", # [Output only] The last time a telemetry event was received. Timestamps are |
| 1125 | # periodically collected and written to storage; they may be stale by a few |
| 1126 | # minutes. |
| 1127 | "lastConfigSendTime": "A String", # [Output only] The last time a cloud-to-device config version was sent to |
| 1128 | # the device. |
| 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> |