device_manager.proto 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.iot.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/iot/v1/resources.proto";
  21. import "google/iam/v1/iam_policy.proto";
  22. import "google/iam/v1/policy.proto";
  23. import "google/protobuf/empty.proto";
  24. import "google/protobuf/field_mask.proto";
  25. option cc_enable_arenas = true;
  26. option go_package = "google.golang.org/genproto/googleapis/cloud/iot/v1;iot";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "DeviceManagerProto";
  29. option java_package = "com.google.cloud.iot.v1";
  30. // Internet of Things (IoT) service. Securely connect and manage IoT devices.
  31. service DeviceManager {
  32. option (google.api.default_host) = "cloudiot.googleapis.com";
  33. option (google.api.oauth_scopes) =
  34. "https://www.googleapis.com/auth/cloud-platform,"
  35. "https://www.googleapis.com/auth/cloudiot";
  36. // Creates a device registry that contains devices.
  37. rpc CreateDeviceRegistry(CreateDeviceRegistryRequest) returns (DeviceRegistry) {
  38. option (google.api.http) = {
  39. post: "/v1/{parent=projects/*/locations/*}/registries"
  40. body: "device_registry"
  41. };
  42. option (google.api.method_signature) = "parent,device_registry";
  43. }
  44. // Gets a device registry configuration.
  45. rpc GetDeviceRegistry(GetDeviceRegistryRequest) returns (DeviceRegistry) {
  46. option (google.api.http) = {
  47. get: "/v1/{name=projects/*/locations/*/registries/*}"
  48. };
  49. option (google.api.method_signature) = "name";
  50. }
  51. // Updates a device registry configuration.
  52. rpc UpdateDeviceRegistry(UpdateDeviceRegistryRequest) returns (DeviceRegistry) {
  53. option (google.api.http) = {
  54. patch: "/v1/{device_registry.name=projects/*/locations/*/registries/*}"
  55. body: "device_registry"
  56. };
  57. option (google.api.method_signature) = "device_registry,update_mask";
  58. }
  59. // Deletes a device registry configuration.
  60. rpc DeleteDeviceRegistry(DeleteDeviceRegistryRequest) returns (google.protobuf.Empty) {
  61. option (google.api.http) = {
  62. delete: "/v1/{name=projects/*/locations/*/registries/*}"
  63. };
  64. option (google.api.method_signature) = "name";
  65. }
  66. // Lists device registries.
  67. rpc ListDeviceRegistries(ListDeviceRegistriesRequest) returns (ListDeviceRegistriesResponse) {
  68. option (google.api.http) = {
  69. get: "/v1/{parent=projects/*/locations/*}/registries"
  70. };
  71. option (google.api.method_signature) = "parent";
  72. }
  73. // Creates a device in a device registry.
  74. rpc CreateDevice(CreateDeviceRequest) returns (Device) {
  75. option (google.api.http) = {
  76. post: "/v1/{parent=projects/*/locations/*/registries/*}/devices"
  77. body: "device"
  78. };
  79. option (google.api.method_signature) = "parent,device";
  80. }
  81. // Gets details about a device.
  82. rpc GetDevice(GetDeviceRequest) returns (Device) {
  83. option (google.api.http) = {
  84. get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}"
  85. additional_bindings {
  86. get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}"
  87. }
  88. };
  89. option (google.api.method_signature) = "name";
  90. }
  91. // Updates a device.
  92. rpc UpdateDevice(UpdateDeviceRequest) returns (Device) {
  93. option (google.api.http) = {
  94. patch: "/v1/{device.name=projects/*/locations/*/registries/*/devices/*}"
  95. body: "device"
  96. additional_bindings {
  97. patch: "/v1/{device.name=projects/*/locations/*/registries/*/groups/*/devices/*}"
  98. body: "device"
  99. }
  100. };
  101. option (google.api.method_signature) = "device,update_mask";
  102. }
  103. // Deletes a device.
  104. rpc DeleteDevice(DeleteDeviceRequest) returns (google.protobuf.Empty) {
  105. option (google.api.http) = {
  106. delete: "/v1/{name=projects/*/locations/*/registries/*/devices/*}"
  107. };
  108. option (google.api.method_signature) = "name";
  109. }
  110. // List devices in a device registry.
  111. rpc ListDevices(ListDevicesRequest) returns (ListDevicesResponse) {
  112. option (google.api.http) = {
  113. get: "/v1/{parent=projects/*/locations/*/registries/*}/devices"
  114. additional_bindings {
  115. get: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}/devices"
  116. }
  117. };
  118. option (google.api.method_signature) = "parent";
  119. }
  120. // Modifies the configuration for the device, which is eventually sent from
  121. // the Cloud IoT Core servers. Returns the modified configuration version and
  122. // its metadata.
  123. rpc ModifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest) returns (DeviceConfig) {
  124. option (google.api.http) = {
  125. post: "/v1/{name=projects/*/locations/*/registries/*/devices/*}:modifyCloudToDeviceConfig"
  126. body: "*"
  127. additional_bindings {
  128. post: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:modifyCloudToDeviceConfig"
  129. body: "*"
  130. }
  131. };
  132. option (google.api.method_signature) = "name,binary_data";
  133. }
  134. // Lists the last few versions of the device configuration in descending
  135. // order (i.e.: newest first).
  136. rpc ListDeviceConfigVersions(ListDeviceConfigVersionsRequest) returns (ListDeviceConfigVersionsResponse) {
  137. option (google.api.http) = {
  138. get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}/configVersions"
  139. additional_bindings {
  140. get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/configVersions"
  141. }
  142. };
  143. option (google.api.method_signature) = "name";
  144. }
  145. // Lists the last few versions of the device state in descending order (i.e.:
  146. // newest first).
  147. rpc ListDeviceStates(ListDeviceStatesRequest) returns (ListDeviceStatesResponse) {
  148. option (google.api.http) = {
  149. get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}/states"
  150. additional_bindings {
  151. get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/states"
  152. }
  153. };
  154. option (google.api.method_signature) = "name";
  155. }
  156. // Sets the access control policy on the specified resource. Replaces any
  157. // existing policy.
  158. rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
  159. option (google.api.http) = {
  160. post: "/v1/{resource=projects/*/locations/*/registries/*}:setIamPolicy"
  161. body: "*"
  162. additional_bindings {
  163. post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:setIamPolicy"
  164. body: "*"
  165. }
  166. };
  167. option (google.api.method_signature) = "resource,policy";
  168. }
  169. // Gets the access control policy for a resource.
  170. // Returns an empty policy if the resource exists and does not have a policy
  171. // set.
  172. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
  173. option (google.api.http) = {
  174. post: "/v1/{resource=projects/*/locations/*/registries/*}:getIamPolicy"
  175. body: "*"
  176. additional_bindings {
  177. post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:getIamPolicy"
  178. body: "*"
  179. }
  180. };
  181. option (google.api.method_signature) = "resource";
  182. }
  183. // Returns permissions that a caller has on the specified resource.
  184. // If the resource does not exist, this will return an empty set of
  185. // permissions, not a NOT_FOUND error.
  186. rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
  187. option (google.api.http) = {
  188. post: "/v1/{resource=projects/*/locations/*/registries/*}:testIamPermissions"
  189. body: "*"
  190. additional_bindings {
  191. post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:testIamPermissions"
  192. body: "*"
  193. }
  194. };
  195. option (google.api.method_signature) = "resource,permissions";
  196. }
  197. // Sends a command to the specified device. In order for a device to be able
  198. // to receive commands, it must:
  199. // 1) be connected to Cloud IoT Core using the MQTT protocol, and
  200. // 2) be subscribed to the group of MQTT topics specified by
  201. // /devices/{device-id}/commands/#. This subscription will receive commands
  202. // at the top-level topic /devices/{device-id}/commands as well as commands
  203. // for subfolders, like /devices/{device-id}/commands/subfolder.
  204. // Note that subscribing to specific subfolders is not supported.
  205. // If the command could not be delivered to the device, this method will
  206. // return an error; in particular, if the device is not subscribed, this
  207. // method will return FAILED_PRECONDITION. Otherwise, this method will
  208. // return OK. If the subscription is QoS 1, at least once delivery will be
  209. // guaranteed; for QoS 0, no acknowledgment will be expected from the device.
  210. rpc SendCommandToDevice(SendCommandToDeviceRequest) returns (SendCommandToDeviceResponse) {
  211. option (google.api.http) = {
  212. post: "/v1/{name=projects/*/locations/*/registries/*/devices/*}:sendCommandToDevice"
  213. body: "*"
  214. additional_bindings {
  215. post: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:sendCommandToDevice"
  216. body: "*"
  217. }
  218. };
  219. option (google.api.method_signature) = "name,binary_data";
  220. option (google.api.method_signature) = "name,binary_data,subfolder";
  221. }
  222. // Associates the device with the gateway.
  223. rpc BindDeviceToGateway(BindDeviceToGatewayRequest) returns (BindDeviceToGatewayResponse) {
  224. option (google.api.http) = {
  225. post: "/v1/{parent=projects/*/locations/*/registries/*}:bindDeviceToGateway"
  226. body: "*"
  227. additional_bindings {
  228. post: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:bindDeviceToGateway"
  229. body: "*"
  230. }
  231. };
  232. option (google.api.method_signature) = "parent,gateway_id,device_id";
  233. }
  234. // Deletes the association between the device and the gateway.
  235. rpc UnbindDeviceFromGateway(UnbindDeviceFromGatewayRequest) returns (UnbindDeviceFromGatewayResponse) {
  236. option (google.api.http) = {
  237. post: "/v1/{parent=projects/*/locations/*/registries/*}:unbindDeviceFromGateway"
  238. body: "*"
  239. additional_bindings {
  240. post: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:unbindDeviceFromGateway"
  241. body: "*"
  242. }
  243. };
  244. option (google.api.method_signature) = "parent,gateway_id,device_id";
  245. }
  246. }
  247. // Request for `CreateDeviceRegistry`.
  248. message CreateDeviceRegistryRequest {
  249. // Required. The project and cloud region where this device registry must be created.
  250. // For example, `projects/example-project/locations/us-central1`.
  251. string parent = 1 [
  252. (google.api.field_behavior) = REQUIRED,
  253. (google.api.resource_reference) = {
  254. type: "locations.googleapis.com/Location"
  255. }
  256. ];
  257. // Required. The device registry. The field `name` must be empty. The server will
  258. // generate that field from the device registry `id` provided and the
  259. // `parent` field.
  260. DeviceRegistry device_registry = 2 [(google.api.field_behavior) = REQUIRED];
  261. }
  262. // Request for `GetDeviceRegistry`.
  263. message GetDeviceRegistryRequest {
  264. // Required. The name of the device registry. For example,
  265. // `projects/example-project/locations/us-central1/registries/my-registry`.
  266. string name = 1 [
  267. (google.api.field_behavior) = REQUIRED,
  268. (google.api.resource_reference) = {
  269. type: "cloudiot.googleapis.com/Registry"
  270. }
  271. ];
  272. }
  273. // Request for `DeleteDeviceRegistry`.
  274. message DeleteDeviceRegistryRequest {
  275. // Required. The name of the device registry. For example,
  276. // `projects/example-project/locations/us-central1/registries/my-registry`.
  277. string name = 1 [
  278. (google.api.field_behavior) = REQUIRED,
  279. (google.api.resource_reference) = {
  280. type: "cloudiot.googleapis.com/Registry"
  281. }
  282. ];
  283. }
  284. // Request for `UpdateDeviceRegistry`.
  285. message UpdateDeviceRegistryRequest {
  286. // Required. The new values for the device registry. The `id` field must be empty, and
  287. // the `name` field must indicate the path of the resource. For example,
  288. // `projects/example-project/locations/us-central1/registries/my-registry`.
  289. DeviceRegistry device_registry = 1 [(google.api.field_behavior) = REQUIRED];
  290. // Required. Only updates the `device_registry` fields indicated by this mask.
  291. // The field mask must not be empty, and it must not contain fields that
  292. // are immutable or only set by the server.
  293. // Mutable top-level fields: `event_notification_config`, `http_config`,
  294. // `mqtt_config`, and `state_notification_config`.
  295. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
  296. }
  297. // Request for `ListDeviceRegistries`.
  298. message ListDeviceRegistriesRequest {
  299. // Required. The project and cloud region path. For example,
  300. // `projects/example-project/locations/us-central1`.
  301. string parent = 1 [
  302. (google.api.field_behavior) = REQUIRED,
  303. (google.api.resource_reference) = {
  304. type: "locations.googleapis.com/Location"
  305. }
  306. ];
  307. // The maximum number of registries to return in the response. If this value
  308. // is zero, the service will select a default size. A call may return fewer
  309. // objects than requested. A non-empty `next_page_token` in the response
  310. // indicates that more data is available.
  311. int32 page_size = 2;
  312. // The value returned by the last `ListDeviceRegistriesResponse`; indicates
  313. // that this is a continuation of a prior `ListDeviceRegistries` call and
  314. // the system should return the next page of data.
  315. string page_token = 3;
  316. }
  317. // Response for `ListDeviceRegistries`.
  318. message ListDeviceRegistriesResponse {
  319. // The registries that matched the query.
  320. repeated DeviceRegistry device_registries = 1;
  321. // If not empty, indicates that there may be more registries that match the
  322. // request; this value should be passed in a new
  323. // `ListDeviceRegistriesRequest`.
  324. string next_page_token = 2;
  325. }
  326. // Request for `CreateDevice`.
  327. message CreateDeviceRequest {
  328. // Required. The name of the device registry where this device should be created.
  329. // For example,
  330. // `projects/example-project/locations/us-central1/registries/my-registry`.
  331. string parent = 1 [
  332. (google.api.field_behavior) = REQUIRED,
  333. (google.api.resource_reference) = {
  334. type: "cloudiot.googleapis.com/Registry"
  335. }
  336. ];
  337. // Required. The device registration details. The field `name` must be empty. The server
  338. // generates `name` from the device registry `id` and the
  339. // `parent` field.
  340. Device device = 2 [(google.api.field_behavior) = REQUIRED];
  341. }
  342. // Request for `GetDevice`.
  343. message GetDeviceRequest {
  344. // Required. The name of the device. For example,
  345. // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
  346. // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
  347. string name = 1 [
  348. (google.api.field_behavior) = REQUIRED,
  349. (google.api.resource_reference) = {
  350. type: "cloudiot.googleapis.com/Device"
  351. }
  352. ];
  353. // The fields of the `Device` resource to be returned in the response. If the
  354. // field mask is unset or empty, all fields are returned. Fields have to be
  355. // provided in snake_case format, for example: `last_heartbeat_time`.
  356. google.protobuf.FieldMask field_mask = 2;
  357. }
  358. // Request for `UpdateDevice`.
  359. message UpdateDeviceRequest {
  360. // Required. The new values for the device. The `id` and `num_id` fields must
  361. // be empty, and the field `name` must specify the name path. For example,
  362. // `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
  363. // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
  364. Device device = 2 [(google.api.field_behavior) = REQUIRED];
  365. // Required. Only updates the `device` fields indicated by this mask.
  366. // The field mask must not be empty, and it must not contain fields that
  367. // are immutable or only set by the server.
  368. // Mutable top-level fields: `credentials`, `blocked`, and `metadata`
  369. google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED];
  370. }
  371. // Request for `DeleteDevice`.
  372. message DeleteDeviceRequest {
  373. // Required. The name of the device. For example,
  374. // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
  375. // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
  376. string name = 1 [
  377. (google.api.field_behavior) = REQUIRED,
  378. (google.api.resource_reference) = {
  379. type: "cloudiot.googleapis.com/Device"
  380. }
  381. ];
  382. }
  383. // Request for `ListDevices`.
  384. message ListDevicesRequest {
  385. // Required. The device registry path. Required. For example,
  386. // `projects/my-project/locations/us-central1/registries/my-registry`.
  387. string parent = 1 [
  388. (google.api.field_behavior) = REQUIRED,
  389. (google.api.resource_reference) = {
  390. type: "cloudiot.googleapis.com/Registry"
  391. }
  392. ];
  393. // A list of device numeric IDs. If empty, this field is ignored. Maximum
  394. // IDs: 10,000.
  395. repeated uint64 device_num_ids = 2;
  396. // A list of device string IDs. For example, `['device0', 'device12']`.
  397. // If empty, this field is ignored. Maximum IDs: 10,000
  398. repeated string device_ids = 3;
  399. // The fields of the `Device` resource to be returned in the response. The
  400. // fields `id` and `num_id` are always returned, along with any
  401. // other fields specified in snake_case format, for example:
  402. // `last_heartbeat_time`.
  403. google.protobuf.FieldMask field_mask = 4;
  404. // Options related to gateways.
  405. GatewayListOptions gateway_list_options = 6;
  406. // The maximum number of devices to return in the response. If this value
  407. // is zero, the service will select a default size. A call may return fewer
  408. // objects than requested. A non-empty `next_page_token` in the response
  409. // indicates that more data is available.
  410. int32 page_size = 100;
  411. // The value returned by the last `ListDevicesResponse`; indicates
  412. // that this is a continuation of a prior `ListDevices` call and
  413. // the system should return the next page of data.
  414. string page_token = 101;
  415. }
  416. // Options for limiting the list based on gateway type and associations.
  417. message GatewayListOptions {
  418. // If not set, all devices and gateways are returned. If set, the list is
  419. // filtered based on gateway type and associations.
  420. oneof filter {
  421. // If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
  422. // is specified, only non-gateway devices are returned. If
  423. // `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
  424. GatewayType gateway_type = 1;
  425. // If set, only devices associated with the specified gateway are returned.
  426. // The gateway ID can be numeric (`num_id`) or the user-defined string
  427. // (`id`). For example, if `123` is specified, only devices bound to the
  428. // gateway with `num_id` 123 are returned.
  429. string associations_gateway_id = 2;
  430. // If set, returns only the gateways with which the specified device is
  431. // associated. The device ID can be numeric (`num_id`) or the user-defined
  432. // string (`id`). For example, if `456` is specified, returns only the
  433. // gateways to which the device with `num_id` 456 is bound.
  434. string associations_device_id = 3;
  435. }
  436. }
  437. // Response for `ListDevices`.
  438. message ListDevicesResponse {
  439. // The devices that match the request.
  440. repeated Device devices = 1;
  441. // If not empty, indicates that there may be more devices that match the
  442. // request; this value should be passed in a new `ListDevicesRequest`.
  443. string next_page_token = 2;
  444. }
  445. // Request for `ModifyCloudToDeviceConfig`.
  446. message ModifyCloudToDeviceConfigRequest {
  447. // Required. The name of the device. For example,
  448. // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
  449. // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
  450. string name = 1 [
  451. (google.api.field_behavior) = REQUIRED,
  452. (google.api.resource_reference) = {
  453. type: "cloudiot.googleapis.com/Device"
  454. }
  455. ];
  456. // The version number to update. If this value is zero, it will not check the
  457. // version number of the server and will always update the current version;
  458. // otherwise, this update will fail if the version number found on the server
  459. // does not match this version number. This is used to support multiple
  460. // simultaneous updates without losing data.
  461. int64 version_to_update = 2;
  462. // Required. The configuration data for the device.
  463. bytes binary_data = 3 [(google.api.field_behavior) = REQUIRED];
  464. }
  465. // Request for `ListDeviceConfigVersions`.
  466. message ListDeviceConfigVersionsRequest {
  467. // Required. The name of the device. For example,
  468. // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
  469. // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
  470. string name = 1 [
  471. (google.api.field_behavior) = REQUIRED,
  472. (google.api.resource_reference) = {
  473. type: "cloudiot.googleapis.com/Device"
  474. }
  475. ];
  476. // The number of versions to list. Versions are listed in decreasing order of
  477. // the version number. The maximum number of versions retained is 10. If this
  478. // value is zero, it will return all the versions available.
  479. int32 num_versions = 2;
  480. }
  481. // Response for `ListDeviceConfigVersions`.
  482. message ListDeviceConfigVersionsResponse {
  483. // The device configuration for the last few versions. Versions are listed
  484. // in decreasing order, starting from the most recent one.
  485. repeated DeviceConfig device_configs = 1;
  486. }
  487. // Request for `ListDeviceStates`.
  488. message ListDeviceStatesRequest {
  489. // Required. The name of the device. For example,
  490. // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
  491. // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
  492. string name = 1 [
  493. (google.api.field_behavior) = REQUIRED,
  494. (google.api.resource_reference) = {
  495. type: "cloudiot.googleapis.com/Device"
  496. }
  497. ];
  498. // The number of states to list. States are listed in descending order of
  499. // update time. The maximum number of states retained is 10. If this
  500. // value is zero, it will return all the states available.
  501. int32 num_states = 2;
  502. }
  503. // Response for `ListDeviceStates`.
  504. message ListDeviceStatesResponse {
  505. // The last few device states. States are listed in descending order of server
  506. // update time, starting from the most recent one.
  507. repeated DeviceState device_states = 1;
  508. }
  509. // Request for `SendCommandToDevice`.
  510. message SendCommandToDeviceRequest {
  511. // Required. The name of the device. For example,
  512. // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
  513. // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
  514. string name = 1 [
  515. (google.api.field_behavior) = REQUIRED,
  516. (google.api.resource_reference) = {
  517. type: "cloudiot.googleapis.com/Device"
  518. }
  519. ];
  520. // Required. The command data to send to the device.
  521. bytes binary_data = 2 [(google.api.field_behavior) = REQUIRED];
  522. // Optional subfolder for the command. If empty, the command will be delivered
  523. // to the /devices/{device-id}/commands topic, otherwise it will be delivered
  524. // to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
  525. // subfolders are allowed. This field must not have more than 256 characters,
  526. // and must not contain any MQTT wildcards ("+" or "#") or null characters.
  527. string subfolder = 3;
  528. }
  529. // Response for `SendCommandToDevice`.
  530. message SendCommandToDeviceResponse {
  531. }
  532. // Request for `BindDeviceToGateway`.
  533. message BindDeviceToGatewayRequest {
  534. // Required. The name of the registry. For example,
  535. // `projects/example-project/locations/us-central1/registries/my-registry`.
  536. string parent = 1 [
  537. (google.api.field_behavior) = REQUIRED,
  538. (google.api.resource_reference) = {
  539. type: "cloudiot.googleapis.com/Registry"
  540. }
  541. ];
  542. // Required. The value of `gateway_id` can be either the device numeric ID or the
  543. // user-defined device identifier.
  544. string gateway_id = 2 [(google.api.field_behavior) = REQUIRED];
  545. // Required. The device to associate with the specified gateway. The value of
  546. // `device_id` can be either the device numeric ID or the user-defined device
  547. // identifier.
  548. string device_id = 3 [(google.api.field_behavior) = REQUIRED];
  549. }
  550. // Response for `BindDeviceToGateway`.
  551. message BindDeviceToGatewayResponse {
  552. }
  553. // Request for `UnbindDeviceFromGateway`.
  554. message UnbindDeviceFromGatewayRequest {
  555. // Required. The name of the registry. For example,
  556. // `projects/example-project/locations/us-central1/registries/my-registry`.
  557. string parent = 1 [
  558. (google.api.field_behavior) = REQUIRED,
  559. (google.api.resource_reference) = {
  560. type: "cloudiot.googleapis.com/Registry"
  561. }
  562. ];
  563. // Required. The value of `gateway_id` can be either the device numeric ID or the
  564. // user-defined device identifier.
  565. string gateway_id = 2 [(google.api.field_behavior) = REQUIRED];
  566. // Required. The device to disassociate from the specified gateway. The value of
  567. // `device_id` can be either the device numeric ID or the user-defined device
  568. // identifier.
  569. string device_id = 3 [(google.api.field_behavior) = REQUIRED];
  570. }
  571. // Response for `UnbindDeviceFromGateway`.
  572. message UnbindDeviceFromGatewayResponse {
  573. }