device_manager.proto 25 KB

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