You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3936 lines
143 KiB

  1. // Package cloudiot provides access to the Cloud IoT API.
  2. //
  3. // See https://cloud.google.com/iot
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/cloudiot/v1"
  8. // ...
  9. // cloudiotService, err := cloudiot.New(oauthHttpClient)
  10. package cloudiot // import "google.golang.org/api/cloudiot/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "cloudiot:v1"
  41. const apiName = "cloudiot"
  42. const apiVersion = "v1"
  43. const basePath = "https://cloudiot.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. // Register and manage devices in the Google Cloud IoT service
  49. CloudiotScope = "https://www.googleapis.com/auth/cloudiot"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.Projects = NewProjectsService(s)
  57. return s, nil
  58. }
  59. type Service struct {
  60. client *http.Client
  61. BasePath string // API endpoint base URL
  62. UserAgent string // optional additional User-Agent fragment
  63. Projects *ProjectsService
  64. }
  65. func (s *Service) userAgent() string {
  66. if s.UserAgent == "" {
  67. return googleapi.UserAgent
  68. }
  69. return googleapi.UserAgent + " " + s.UserAgent
  70. }
  71. func NewProjectsService(s *Service) *ProjectsService {
  72. rs := &ProjectsService{s: s}
  73. rs.Locations = NewProjectsLocationsService(s)
  74. return rs
  75. }
  76. type ProjectsService struct {
  77. s *Service
  78. Locations *ProjectsLocationsService
  79. }
  80. func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
  81. rs := &ProjectsLocationsService{s: s}
  82. rs.Registries = NewProjectsLocationsRegistriesService(s)
  83. return rs
  84. }
  85. type ProjectsLocationsService struct {
  86. s *Service
  87. Registries *ProjectsLocationsRegistriesService
  88. }
  89. func NewProjectsLocationsRegistriesService(s *Service) *ProjectsLocationsRegistriesService {
  90. rs := &ProjectsLocationsRegistriesService{s: s}
  91. rs.Devices = NewProjectsLocationsRegistriesDevicesService(s)
  92. return rs
  93. }
  94. type ProjectsLocationsRegistriesService struct {
  95. s *Service
  96. Devices *ProjectsLocationsRegistriesDevicesService
  97. }
  98. func NewProjectsLocationsRegistriesDevicesService(s *Service) *ProjectsLocationsRegistriesDevicesService {
  99. rs := &ProjectsLocationsRegistriesDevicesService{s: s}
  100. rs.ConfigVersions = NewProjectsLocationsRegistriesDevicesConfigVersionsService(s)
  101. rs.States = NewProjectsLocationsRegistriesDevicesStatesService(s)
  102. return rs
  103. }
  104. type ProjectsLocationsRegistriesDevicesService struct {
  105. s *Service
  106. ConfigVersions *ProjectsLocationsRegistriesDevicesConfigVersionsService
  107. States *ProjectsLocationsRegistriesDevicesStatesService
  108. }
  109. func NewProjectsLocationsRegistriesDevicesConfigVersionsService(s *Service) *ProjectsLocationsRegistriesDevicesConfigVersionsService {
  110. rs := &ProjectsLocationsRegistriesDevicesConfigVersionsService{s: s}
  111. return rs
  112. }
  113. type ProjectsLocationsRegistriesDevicesConfigVersionsService struct {
  114. s *Service
  115. }
  116. func NewProjectsLocationsRegistriesDevicesStatesService(s *Service) *ProjectsLocationsRegistriesDevicesStatesService {
  117. rs := &ProjectsLocationsRegistriesDevicesStatesService{s: s}
  118. return rs
  119. }
  120. type ProjectsLocationsRegistriesDevicesStatesService struct {
  121. s *Service
  122. }
  123. // Binding: Associates `members` with a `role`.
  124. type Binding struct {
  125. // Members: Specifies the identities requesting access for a Cloud
  126. // Platform resource.
  127. // `members` can have the following values:
  128. //
  129. // * `allUsers`: A special identifier that represents anyone who is
  130. // on the internet; with or without a Google account.
  131. //
  132. // * `allAuthenticatedUsers`: A special identifier that represents
  133. // anyone
  134. // who is authenticated with a Google account or a service
  135. // account.
  136. //
  137. // * `user:{emailid}`: An email address that represents a specific
  138. // Google
  139. // account. For example, `alice@gmail.com` .
  140. //
  141. //
  142. // * `serviceAccount:{emailid}`: An email address that represents a
  143. // service
  144. // account. For example,
  145. // `my-other-app@appspot.gserviceaccount.com`.
  146. //
  147. // * `group:{emailid}`: An email address that represents a Google
  148. // group.
  149. // For example, `admins@example.com`.
  150. //
  151. //
  152. // * `domain:{domain}`: A Google Apps domain name that represents all
  153. // the
  154. // users of that domain. For example, `google.com` or
  155. // `example.com`.
  156. //
  157. //
  158. Members []string `json:"members,omitempty"`
  159. // Role: Role that is assigned to `members`.
  160. // For example, `roles/viewer`, `roles/editor`, or
  161. // `roles/owner`.
  162. // Required
  163. Role string `json:"role,omitempty"`
  164. // ForceSendFields is a list of field names (e.g. "Members") to
  165. // unconditionally include in API requests. By default, fields with
  166. // empty values are omitted from API requests. However, any non-pointer,
  167. // non-interface field appearing in ForceSendFields will be sent to the
  168. // server regardless of whether the field is empty or not. This may be
  169. // used to include empty fields in Patch requests.
  170. ForceSendFields []string `json:"-"`
  171. // NullFields is a list of field names (e.g. "Members") to include in
  172. // API requests with the JSON null value. By default, fields with empty
  173. // values are omitted from API requests. However, any field with an
  174. // empty value appearing in NullFields will be sent to the server as
  175. // null. It is an error if a field in this list has a non-empty value.
  176. // This may be used to include null fields in Patch requests.
  177. NullFields []string `json:"-"`
  178. }
  179. func (s *Binding) MarshalJSON() ([]byte, error) {
  180. type NoMethod Binding
  181. raw := NoMethod(*s)
  182. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  183. }
  184. // Device: The device resource.
  185. type Device struct {
  186. // Blocked: If a device is blocked, connections or requests from this
  187. // device will fail.
  188. // Can be used to temporarily prevent the device from connecting if,
  189. // for
  190. // example, the sensor is generating bad data and needs maintenance.
  191. Blocked bool `json:"blocked,omitempty"`
  192. // Config: The most recent device configuration, which is eventually
  193. // sent from
  194. // Cloud IoT Core to the device. If not present on creation,
  195. // the
  196. // configuration will be initialized with an empty payload and version
  197. // value
  198. // of `1`. To update this field after creation, use
  199. // the
  200. // `DeviceManager.ModifyCloudToDeviceConfig` method.
  201. Config *DeviceConfig `json:"config,omitempty"`
  202. // Credentials: The credentials used to authenticate this device. To
  203. // allow credential
  204. // rotation without interruption, multiple device credentials can be
  205. // bound to
  206. // this device. No more than 3 credentials can be bound to a single
  207. // device at
  208. // a time. When new credentials are added to a device, they are
  209. // verified
  210. // against the registry credentials. For details, see the description of
  211. // the
  212. // `DeviceRegistry.credentials` field.
  213. Credentials []*DeviceCredential `json:"credentials,omitempty"`
  214. // Id: The user-defined device identifier. The device ID must be
  215. // unique
  216. // within a device registry.
  217. Id string `json:"id,omitempty"`
  218. // LastConfigAckTime: [Output only] The last time a cloud-to-device
  219. // config version acknowledgment
  220. // was received from the device. This field is only for
  221. // configurations
  222. // sent through MQTT.
  223. LastConfigAckTime string `json:"lastConfigAckTime,omitempty"`
  224. // LastConfigSendTime: [Output only] The last time a cloud-to-device
  225. // config version was sent to
  226. // the device.
  227. LastConfigSendTime string `json:"lastConfigSendTime,omitempty"`
  228. // LastErrorStatus: [Output only] The error message of the most recent
  229. // error, such as a failure
  230. // to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of
  231. // this
  232. // field. If no errors have occurred, this field has an empty
  233. // message
  234. // and the status code 0 == OK. Otherwise, this field is expected to
  235. // have a
  236. // status code other than OK.
  237. LastErrorStatus *Status `json:"lastErrorStatus,omitempty"`
  238. // LastErrorTime: [Output only] The time the most recent error occurred,
  239. // such as a failure to
  240. // publish to Cloud Pub/Sub. This field is the timestamp
  241. // of
  242. // 'last_error_status'.
  243. LastErrorTime string `json:"lastErrorTime,omitempty"`
  244. // LastEventTime: [Output only] The last time a telemetry event was
  245. // received. Timestamps are
  246. // periodically collected and written to storage; they may be stale by a
  247. // few
  248. // minutes.
  249. LastEventTime string `json:"lastEventTime,omitempty"`
  250. // LastHeartbeatTime: [Output only] The last time an MQTT `PINGREQ` was
  251. // received. This field
  252. // applies only to devices connecting through MQTT. MQTT clients usually
  253. // only
  254. // send `PINGREQ` messages if the connection is idle, and no other
  255. // messages
  256. // have been sent. Timestamps are periodically collected and written
  257. // to
  258. // storage; they may be stale by a few minutes.
  259. LastHeartbeatTime string `json:"lastHeartbeatTime,omitempty"`
  260. // LastStateTime: [Output only] The last time a state event was
  261. // received. Timestamps are
  262. // periodically collected and written to storage; they may be stale by a
  263. // few
  264. // minutes.
  265. LastStateTime string `json:"lastStateTime,omitempty"`
  266. // Metadata: The metadata key-value pairs assigned to the device. This
  267. // metadata is not
  268. // interpreted or indexed by Cloud IoT Core. It can be used to add
  269. // contextual
  270. // information for the device.
  271. //
  272. // Keys must conform to the regular expression a-zA-Z+ and
  273. // be less than 128 bytes in length.
  274. //
  275. // Values are free-form strings. Each value must be less than or equal
  276. // to 32
  277. // KB in size.
  278. //
  279. // The total size of all keys and values must be less than 256 KB, and
  280. // the
  281. // maximum number of key-value pairs is 500.
  282. Metadata map[string]string `json:"metadata,omitempty"`
  283. // Name: The resource path name. For
  284. // example,
  285. // `projects/p1/locations/us-central1/registries/registry0/devic
  286. // es/dev0`
  287. // or
  288. // `projects/p1/locations/us-central1/registries/registry0/devices/{nu
  289. // m_id}`.
  290. // When `name` is populated as a response from the service, it always
  291. // ends
  292. // in the device numeric ID.
  293. Name string `json:"name,omitempty"`
  294. // NumId: [Output only] A server-defined unique numeric ID for the
  295. // device. This is a
  296. // more compact way to identify devices, and it is globally unique.
  297. NumId uint64 `json:"numId,omitempty,string"`
  298. // State: [Output only] The state most recently received from the
  299. // device. If no state
  300. // has been reported, this field is not present.
  301. State *DeviceState `json:"state,omitempty"`
  302. // ServerResponse contains the HTTP response code and headers from the
  303. // server.
  304. googleapi.ServerResponse `json:"-"`
  305. // ForceSendFields is a list of field names (e.g. "Blocked") to
  306. // unconditionally include in API requests. By default, fields with
  307. // empty values are omitted from API requests. However, any non-pointer,
  308. // non-interface field appearing in ForceSendFields will be sent to the
  309. // server regardless of whether the field is empty or not. This may be
  310. // used to include empty fields in Patch requests.
  311. ForceSendFields []string `json:"-"`
  312. // NullFields is a list of field names (e.g. "Blocked") to include in
  313. // API requests with the JSON null value. By default, fields with empty
  314. // values are omitted from API requests. However, any field with an
  315. // empty value appearing in NullFields will be sent to the server as
  316. // null. It is an error if a field in this list has a non-empty value.
  317. // This may be used to include null fields in Patch requests.
  318. NullFields []string `json:"-"`
  319. }
  320. func (s *Device) MarshalJSON() ([]byte, error) {
  321. type NoMethod Device
  322. raw := NoMethod(*s)
  323. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  324. }
  325. // DeviceConfig: The device configuration. Eventually delivered to
  326. // devices.
  327. type DeviceConfig struct {
  328. // BinaryData: The device configuration data.
  329. BinaryData string `json:"binaryData,omitempty"`
  330. // CloudUpdateTime: [Output only] The time at which this configuration
  331. // version was updated in
  332. // Cloud IoT Core. This timestamp is set by the server.
  333. CloudUpdateTime string `json:"cloudUpdateTime,omitempty"`
  334. // DeviceAckTime: [Output only] The time at which Cloud IoT Core
  335. // received the
  336. // acknowledgment from the device, indicating that the device has
  337. // received
  338. // this configuration version. If this field is not present, the device
  339. // has
  340. // not yet acknowledged that it received this version. Note that
  341. // when
  342. // the config was sent to the device, many config versions may have
  343. // been
  344. // available in Cloud IoT Core while the device was disconnected, and
  345. // on
  346. // connection, only the latest version is sent to the device.
  347. // Some
  348. // versions may never be sent to the device, and therefore are
  349. // never
  350. // acknowledged. This timestamp is set by Cloud IoT Core.
  351. DeviceAckTime string `json:"deviceAckTime,omitempty"`
  352. // Version: [Output only] The version of this update. The version number
  353. // is assigned by
  354. // the server, and is always greater than 0 after device creation.
  355. // The
  356. // version must be 0 on the `CreateDevice` request if a `config`
  357. // is
  358. // specified; the response of `CreateDevice` will always have a value of
  359. // 1.
  360. Version int64 `json:"version,omitempty,string"`
  361. // ServerResponse contains the HTTP response code and headers from the
  362. // server.
  363. googleapi.ServerResponse `json:"-"`
  364. // ForceSendFields is a list of field names (e.g. "BinaryData") to
  365. // unconditionally include in API requests. By default, fields with
  366. // empty values are omitted from API requests. However, any non-pointer,
  367. // non-interface field appearing in ForceSendFields will be sent to the
  368. // server regardless of whether the field is empty or not. This may be
  369. // used to include empty fields in Patch requests.
  370. ForceSendFields []string `json:"-"`
  371. // NullFields is a list of field names (e.g. "BinaryData") to include in
  372. // API requests with the JSON null value. By default, fields with empty
  373. // values are omitted from API requests. However, any field with an
  374. // empty value appearing in NullFields will be sent to the server as
  375. // null. It is an error if a field in this list has a non-empty value.
  376. // This may be used to include null fields in Patch requests.
  377. NullFields []string `json:"-"`
  378. }
  379. func (s *DeviceConfig) MarshalJSON() ([]byte, error) {
  380. type NoMethod DeviceConfig
  381. raw := NoMethod(*s)
  382. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  383. }
  384. // DeviceCredential: A server-stored device credential used for
  385. // authentication.
  386. type DeviceCredential struct {
  387. // ExpirationTime: [Optional] The time at which this credential becomes
  388. // invalid. This
  389. // credential will be ignored for new client authentication requests
  390. // after
  391. // this timestamp; however, it will not be automatically deleted.
  392. ExpirationTime string `json:"expirationTime,omitempty"`
  393. // PublicKey: A public key used to verify the signature of JSON Web
  394. // Tokens (JWTs).
  395. // When adding a new device credential, either via device creation or
  396. // via
  397. // modifications, this public key credential may be required to be
  398. // signed by
  399. // one of the registry level certificates. More specifically, if
  400. // the
  401. // registry contains at least one certificate, any new device
  402. // credential
  403. // must be signed by one of the registry certificates. As a result,
  404. // when the registry contains certificates, only X.509 certificates
  405. // are
  406. // accepted as device credentials. However, if the registry does
  407. // not contain a certificate, self-signed certificates and public keys
  408. // will
  409. // be accepted. New device credentials must be different from
  410. // every
  411. // registry-level certificate.
  412. PublicKey *PublicKeyCredential `json:"publicKey,omitempty"`
  413. // ForceSendFields is a list of field names (e.g. "ExpirationTime") to
  414. // unconditionally include in API requests. By default, fields with
  415. // empty values are omitted from API requests. However, any non-pointer,
  416. // non-interface field appearing in ForceSendFields will be sent to the
  417. // server regardless of whether the field is empty or not. This may be
  418. // used to include empty fields in Patch requests.
  419. ForceSendFields []string `json:"-"`
  420. // NullFields is a list of field names (e.g. "ExpirationTime") to
  421. // include in API requests with the JSON null value. By default, fields
  422. // with empty values are omitted from API requests. However, any field
  423. // with an empty value appearing in NullFields will be sent to the
  424. // server as null. It is an error if a field in this list has a
  425. // non-empty value. This may be used to include null fields in Patch
  426. // requests.
  427. NullFields []string `json:"-"`
  428. }
  429. func (s *DeviceCredential) MarshalJSON() ([]byte, error) {
  430. type NoMethod DeviceCredential
  431. raw := NoMethod(*s)
  432. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  433. }
  434. // DeviceRegistry: A container for a group of devices.
  435. type DeviceRegistry struct {
  436. // Credentials: The credentials used to verify the device credentials.
  437. // No more than 10
  438. // credentials can be bound to a single registry at a time. The
  439. // verification
  440. // process occurs at the time of device creation or update. If this
  441. // field is
  442. // empty, no verification is performed. Otherwise, the credentials of a
  443. // newly
  444. // created device or added credentials of an updated device should be
  445. // signed
  446. // with one of these registry credentials.
  447. //
  448. // Note, however, that existing devices will never be affected
  449. // by
  450. // modifications to this list of credentials: after a device has
  451. // been
  452. // successfully created in a registry, it should be able to connect even
  453. // if
  454. // its registry credentials are revoked, deleted, or modified.
  455. Credentials []*RegistryCredential `json:"credentials,omitempty"`
  456. // EventNotificationConfigs: The configuration for notification of
  457. // telemetry events received from the
  458. // device. All telemetry events that were successfully published by
  459. // the
  460. // device and acknowledged by Cloud IoT Core are guaranteed to
  461. // be
  462. // delivered to Cloud Pub/Sub. If multiple configurations match a
  463. // message,
  464. // only the first matching configuration is used. If you try to publish
  465. // a
  466. // device telemetry event using MQTT without specifying a Cloud Pub/Sub
  467. // topic
  468. // for the device's registry, the connection closes automatically. If
  469. // you try
  470. // to do so using an HTTP connection, an error is returned. Up to
  471. // 10
  472. // configurations may be provided.
  473. EventNotificationConfigs []*EventNotificationConfig `json:"eventNotificationConfigs,omitempty"`
  474. // HttpConfig: The DeviceService (HTTP) configuration for this device
  475. // registry.
  476. HttpConfig *HttpConfig `json:"httpConfig,omitempty"`
  477. // Id: The identifier of this device registry. For example,
  478. // `myRegistry`.
  479. Id string `json:"id,omitempty"`
  480. // MqttConfig: The MQTT configuration for this device registry.
  481. MqttConfig *MqttConfig `json:"mqttConfig,omitempty"`
  482. // Name: The resource path name. For
  483. // example,
  484. // `projects/example-project/locations/us-central1/registries/my
  485. // -registry`.
  486. Name string `json:"name,omitempty"`
  487. // StateNotificationConfig: The configuration for notification of new
  488. // states received from the device.
  489. // State updates are guaranteed to be stored in the state history,
  490. // but
  491. // notifications to Cloud Pub/Sub are not guaranteed. For example,
  492. // if
  493. // permissions are misconfigured or the specified topic doesn't exist,
  494. // no
  495. // notification will be published but the state will still be stored in
  496. // Cloud
  497. // IoT Core.
  498. StateNotificationConfig *StateNotificationConfig `json:"stateNotificationConfig,omitempty"`
  499. // ServerResponse contains the HTTP response code and headers from the
  500. // server.
  501. googleapi.ServerResponse `json:"-"`
  502. // ForceSendFields is a list of field names (e.g. "Credentials") to
  503. // unconditionally include in API requests. By default, fields with
  504. // empty values are omitted from API requests. However, any non-pointer,
  505. // non-interface field appearing in ForceSendFields will be sent to the
  506. // server regardless of whether the field is empty or not. This may be
  507. // used to include empty fields in Patch requests.
  508. ForceSendFields []string `json:"-"`
  509. // NullFields is a list of field names (e.g. "Credentials") to include
  510. // in API requests with the JSON null value. By default, fields with
  511. // empty values are omitted from API requests. However, any field with
  512. // an empty value appearing in NullFields will be sent to the server as
  513. // null. It is an error if a field in this list has a non-empty value.
  514. // This may be used to include null fields in Patch requests.
  515. NullFields []string `json:"-"`
  516. }
  517. func (s *DeviceRegistry) MarshalJSON() ([]byte, error) {
  518. type NoMethod DeviceRegistry
  519. raw := NoMethod(*s)
  520. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  521. }
  522. // DeviceState: The device state, as reported by the device.
  523. type DeviceState struct {
  524. // BinaryData: The device state data.
  525. BinaryData string `json:"binaryData,omitempty"`
  526. // UpdateTime: [Output only] The time at which this state version was
  527. // updated in Cloud
  528. // IoT Core.
  529. UpdateTime string `json:"updateTime,omitempty"`
  530. // ForceSendFields is a list of field names (e.g. "BinaryData") to
  531. // unconditionally include in API requests. By default, fields with
  532. // empty values are omitted from API requests. However, any non-pointer,
  533. // non-interface field appearing in ForceSendFields will be sent to the
  534. // server regardless of whether the field is empty or not. This may be
  535. // used to include empty fields in Patch requests.
  536. ForceSendFields []string `json:"-"`
  537. // NullFields is a list of field names (e.g. "BinaryData") to include in
  538. // API requests with the JSON null value. By default, fields with empty
  539. // values are omitted from API requests. However, any field with an
  540. // empty value appearing in NullFields will be sent to the server as
  541. // null. It is an error if a field in this list has a non-empty value.
  542. // This may be used to include null fields in Patch requests.
  543. NullFields []string `json:"-"`
  544. }
  545. func (s *DeviceState) MarshalJSON() ([]byte, error) {
  546. type NoMethod DeviceState
  547. raw := NoMethod(*s)
  548. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  549. }
  550. // Empty: A generic empty message that you can re-use to avoid defining
  551. // duplicated
  552. // empty messages in your APIs. A typical example is to use it as the
  553. // request
  554. // or the response type of an API method. For instance:
  555. //
  556. // service Foo {
  557. // rpc Bar(google.protobuf.Empty) returns
  558. // (google.protobuf.Empty);
  559. // }
  560. //
  561. // The JSON representation for `Empty` is empty JSON object `{}`.
  562. type Empty struct {
  563. // ServerResponse contains the HTTP response code and headers from the
  564. // server.
  565. googleapi.ServerResponse `json:"-"`
  566. }
  567. // EventNotificationConfig: The configuration for forwarding telemetry
  568. // events.
  569. type EventNotificationConfig struct {
  570. // PubsubTopicName: A Cloud Pub/Sub topic name. For
  571. // example,
  572. // `projects/myProject/topics/deviceEvents`.
  573. PubsubTopicName string `json:"pubsubTopicName,omitempty"`
  574. // SubfolderMatches: If the subfolder name matches this string exactly,
  575. // this configuration will
  576. // be used. The string must not include the leading '/' character. If
  577. // empty,
  578. // all strings are matched. This field is used only for telemetry
  579. // events;
  580. // subfolders are not supported for state changes.
  581. SubfolderMatches string `json:"subfolderMatches,omitempty"`
  582. // ForceSendFields is a list of field names (e.g. "PubsubTopicName") to
  583. // unconditionally include in API requests. By default, fields with
  584. // empty values are omitted from API requests. However, any non-pointer,
  585. // non-interface field appearing in ForceSendFields will be sent to the
  586. // server regardless of whether the field is empty or not. This may be
  587. // used to include empty fields in Patch requests.
  588. ForceSendFields []string `json:"-"`
  589. // NullFields is a list of field names (e.g. "PubsubTopicName") to
  590. // include in API requests with the JSON null value. By default, fields
  591. // with empty values are omitted from API requests. However, any field
  592. // with an empty value appearing in NullFields will be sent to the
  593. // server as null. It is an error if a field in this list has a
  594. // non-empty value. This may be used to include null fields in Patch
  595. // requests.
  596. NullFields []string `json:"-"`
  597. }
  598. func (s *EventNotificationConfig) MarshalJSON() ([]byte, error) {
  599. type NoMethod EventNotificationConfig
  600. raw := NoMethod(*s)
  601. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  602. }
  603. // GetIamPolicyRequest: Request message for `GetIamPolicy` method.
  604. type GetIamPolicyRequest struct {
  605. }
  606. // HttpConfig: The configuration of the HTTP bridge for a device
  607. // registry.
  608. type HttpConfig struct {
  609. // HttpEnabledState: If enabled, allows devices to use DeviceService via
  610. // the HTTP protocol.
  611. // Otherwise, any requests to DeviceService will fail for this registry.
  612. //
  613. // Possible values:
  614. // "HTTP_STATE_UNSPECIFIED" - No HTTP state specified. If not
  615. // specified, DeviceService will be
  616. // enabled by default.
  617. // "HTTP_ENABLED" - Enables DeviceService (HTTP) service for the
  618. // registry.
  619. // "HTTP_DISABLED" - Disables DeviceService (HTTP) service for the
  620. // registry.
  621. HttpEnabledState string `json:"httpEnabledState,omitempty"`
  622. // ForceSendFields is a list of field names (e.g. "HttpEnabledState") to
  623. // unconditionally include in API requests. By default, fields with
  624. // empty values are omitted from API requests. However, any non-pointer,
  625. // non-interface field appearing in ForceSendFields will be sent to the
  626. // server regardless of whether the field is empty or not. This may be
  627. // used to include empty fields in Patch requests.
  628. ForceSendFields []string `json:"-"`
  629. // NullFields is a list of field names (e.g. "HttpEnabledState") to
  630. // include in API requests with the JSON null value. By default, fields
  631. // with empty values are omitted from API requests. However, any field
  632. // with an empty value appearing in NullFields will be sent to the
  633. // server as null. It is an error if a field in this list has a
  634. // non-empty value. This may be used to include null fields in Patch
  635. // requests.
  636. NullFields []string `json:"-"`
  637. }
  638. func (s *HttpConfig) MarshalJSON() ([]byte, error) {
  639. type NoMethod HttpConfig
  640. raw := NoMethod(*s)
  641. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  642. }
  643. // ListDeviceConfigVersionsResponse: Response for
  644. // `ListDeviceConfigVersions`.
  645. type ListDeviceConfigVersionsResponse struct {
  646. // DeviceConfigs: The device configuration for the last few versions.
  647. // Versions are listed
  648. // in decreasing order, starting from the most recent one.
  649. DeviceConfigs []*DeviceConfig `json:"deviceConfigs,omitempty"`
  650. // ServerResponse contains the HTTP response code and headers from the
  651. // server.
  652. googleapi.ServerResponse `json:"-"`
  653. // ForceSendFields is a list of field names (e.g. "DeviceConfigs") to
  654. // unconditionally include in API requests. By default, fields with
  655. // empty values are omitted from API requests. However, any non-pointer,
  656. // non-interface field appearing in ForceSendFields will be sent to the
  657. // server regardless of whether the field is empty or not. This may be
  658. // used to include empty fields in Patch requests.
  659. ForceSendFields []string `json:"-"`
  660. // NullFields is a list of field names (e.g. "DeviceConfigs") to include
  661. // in API requests with the JSON null value. By default, fields with
  662. // empty values are omitted from API requests. However, any field with
  663. // an empty value appearing in NullFields will be sent to the server as
  664. // null. It is an error if a field in this list has a non-empty value.
  665. // This may be used to include null fields in Patch requests.
  666. NullFields []string `json:"-"`
  667. }
  668. func (s *ListDeviceConfigVersionsResponse) MarshalJSON() ([]byte, error) {
  669. type NoMethod ListDeviceConfigVersionsResponse
  670. raw := NoMethod(*s)
  671. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  672. }
  673. // ListDeviceRegistriesResponse: Response for `ListDeviceRegistries`.
  674. type ListDeviceRegistriesResponse struct {
  675. // DeviceRegistries: The registries that matched the query.
  676. DeviceRegistries []*DeviceRegistry `json:"deviceRegistries,omitempty"`
  677. // NextPageToken: If not empty, indicates that there may be more
  678. // registries that match the
  679. // request; this value should be passed in a
  680. // new
  681. // `ListDeviceRegistriesRequest`.
  682. NextPageToken string `json:"nextPageToken,omitempty"`
  683. // ServerResponse contains the HTTP response code and headers from the
  684. // server.
  685. googleapi.ServerResponse `json:"-"`
  686. // ForceSendFields is a list of field names (e.g. "DeviceRegistries") to
  687. // unconditionally include in API requests. By default, fields with
  688. // empty values are omitted from API requests. However, any non-pointer,
  689. // non-interface field appearing in ForceSendFields will be sent to the
  690. // server regardless of whether the field is empty or not. This may be
  691. // used to include empty fields in Patch requests.
  692. ForceSendFields []string `json:"-"`
  693. // NullFields is a list of field names (e.g. "DeviceRegistries") to
  694. // include in API requests with the JSON null value. By default, fields
  695. // with empty values are omitted from API requests. However, any field
  696. // with an empty value appearing in NullFields will be sent to the
  697. // server as null. It is an error if a field in this list has a
  698. // non-empty value. This may be used to include null fields in Patch
  699. // requests.
  700. NullFields []string `json:"-"`
  701. }
  702. func (s *ListDeviceRegistriesResponse) MarshalJSON() ([]byte, error) {
  703. type NoMethod ListDeviceRegistriesResponse
  704. raw := NoMethod(*s)
  705. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  706. }
  707. // ListDeviceStatesResponse: Response for `ListDeviceStates`.
  708. type ListDeviceStatesResponse struct {
  709. // DeviceStates: The last few device states. States are listed in
  710. // descending order of server
  711. // update time, starting from the most recent one.
  712. DeviceStates []*DeviceState `json:"deviceStates,omitempty"`
  713. // ServerResponse contains the HTTP response code and headers from the
  714. // server.
  715. googleapi.ServerResponse `json:"-"`
  716. // ForceSendFields is a list of field names (e.g. "DeviceStates") to
  717. // unconditionally include in API requests. By default, fields with
  718. // empty values are omitted from API requests. However, any non-pointer,
  719. // non-interface field appearing in ForceSendFields will be sent to the
  720. // server regardless of whether the field is empty or not. This may be
  721. // used to include empty fields in Patch requests.
  722. ForceSendFields []string `json:"-"`
  723. // NullFields is a list of field names (e.g. "DeviceStates") to include
  724. // in API requests with the JSON null value. By default, fields with
  725. // empty values are omitted from API requests. However, any field with
  726. // an empty value appearing in NullFields will be sent to the server as
  727. // null. It is an error if a field in this list has a non-empty value.
  728. // This may be used to include null fields in Patch requests.
  729. NullFields []string `json:"-"`
  730. }
  731. func (s *ListDeviceStatesResponse) MarshalJSON() ([]byte, error) {
  732. type NoMethod ListDeviceStatesResponse
  733. raw := NoMethod(*s)
  734. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  735. }
  736. // ListDevicesResponse: Response for `ListDevices`.
  737. type ListDevicesResponse struct {
  738. // Devices: The devices that match the request.
  739. Devices []*Device `json:"devices,omitempty"`
  740. // NextPageToken: If not empty, indicates that there may be more devices
  741. // that match the
  742. // request; this value should be passed in a new `ListDevicesRequest`.
  743. NextPageToken string `json:"nextPageToken,omitempty"`
  744. // ServerResponse contains the HTTP response code and headers from the
  745. // server.
  746. googleapi.ServerResponse `json:"-"`
  747. // ForceSendFields is a list of field names (e.g. "Devices") to
  748. // unconditionally include in API requests. By default, fields with
  749. // empty values are omitted from API requests. However, any non-pointer,
  750. // non-interface field appearing in ForceSendFields will be sent to the
  751. // server regardless of whether the field is empty or not. This may be
  752. // used to include empty fields in Patch requests.
  753. ForceSendFields []string `json:"-"`
  754. // NullFields is a list of field names (e.g. "Devices") to include in
  755. // API requests with the JSON null value. By default, fields with empty
  756. // values are omitted from API requests. However, any field with an
  757. // empty value appearing in NullFields will be sent to the server as
  758. // null. It is an error if a field in this list has a non-empty value.
  759. // This may be used to include null fields in Patch requests.
  760. NullFields []string `json:"-"`
  761. }
  762. func (s *ListDevicesResponse) MarshalJSON() ([]byte, error) {
  763. type NoMethod ListDevicesResponse
  764. raw := NoMethod(*s)
  765. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  766. }
  767. // ModifyCloudToDeviceConfigRequest: Request for
  768. // `ModifyCloudToDeviceConfig`.
  769. type ModifyCloudToDeviceConfigRequest struct {
  770. // BinaryData: The configuration data for the device.
  771. BinaryData string `json:"binaryData,omitempty"`
  772. // VersionToUpdate: The version number to update. If this value is zero,
  773. // it will not check the
  774. // version number of the server and will always update the current
  775. // version;
  776. // otherwise, this update will fail if the version number found on the
  777. // server
  778. // does not match this version number. This is used to support
  779. // multiple
  780. // simultaneous updates without losing data.
  781. VersionToUpdate int64 `json:"versionToUpdate,omitempty,string"`
  782. // ForceSendFields is a list of field names (e.g. "BinaryData") to
  783. // unconditionally include in API requests. By default, fields with
  784. // empty values are omitted from API requests. However, any non-pointer,
  785. // non-interface field appearing in ForceSendFields will be sent to the
  786. // server regardless of whether the field is empty or not. This may be
  787. // used to include empty fields in Patch requests.
  788. ForceSendFields []string `json:"-"`
  789. // NullFields is a list of field names (e.g. "BinaryData") to include in
  790. // API requests with the JSON null value. By default, fields with empty
  791. // values are omitted from API requests. However, any field with an
  792. // empty value appearing in NullFields will be sent to the server as
  793. // null. It is an error if a field in this list has a non-empty value.
  794. // This may be used to include null fields in Patch requests.
  795. NullFields []string `json:"-"`
  796. }
  797. func (s *ModifyCloudToDeviceConfigRequest) MarshalJSON() ([]byte, error) {
  798. type NoMethod ModifyCloudToDeviceConfigRequest
  799. raw := NoMethod(*s)
  800. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  801. }
  802. // MqttConfig: The configuration of MQTT for a device registry.
  803. type MqttConfig struct {
  804. // MqttEnabledState: If enabled, allows connections using the MQTT
  805. // protocol. Otherwise, MQTT
  806. // connections to this registry will fail.
  807. //
  808. // Possible values:
  809. // "MQTT_STATE_UNSPECIFIED" - No MQTT state specified. If not
  810. // specified, MQTT will be enabled by default.
  811. // "MQTT_ENABLED" - Enables a MQTT connection.
  812. // "MQTT_DISABLED" - Disables a MQTT connection.
  813. MqttEnabledState string `json:"mqttEnabledState,omitempty"`
  814. // ForceSendFields is a list of field names (e.g. "MqttEnabledState") to
  815. // unconditionally include in API requests. By default, fields with
  816. // empty values are omitted from API requests. However, any non-pointer,
  817. // non-interface field appearing in ForceSendFields will be sent to the
  818. // server regardless of whether the field is empty or not. This may be
  819. // used to include empty fields in Patch requests.
  820. ForceSendFields []string `json:"-"`
  821. // NullFields is a list of field names (e.g. "MqttEnabledState") to
  822. // include in API requests with the JSON null value. By default, fields
  823. // with empty values are omitted from API requests. However, any field
  824. // with an empty value appearing in NullFields will be sent to the
  825. // server as null. It is an error if a field in this list has a
  826. // non-empty value. This may be used to include null fields in Patch
  827. // requests.
  828. NullFields []string `json:"-"`
  829. }
  830. func (s *MqttConfig) MarshalJSON() ([]byte, error) {
  831. type NoMethod MqttConfig
  832. raw := NoMethod(*s)
  833. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  834. }
  835. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  836. // used to
  837. // specify access control policies for Cloud Platform resources.
  838. //
  839. //
  840. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  841. // of
  842. // `members` to a `role`, where the members can be user accounts, Google
  843. // groups,
  844. // Google domains, and service accounts. A `role` is a named list of
  845. // permissions
  846. // defined by IAM.
  847. //
  848. // **JSON Example**
  849. //
  850. // {
  851. // "bindings": [
  852. // {
  853. // "role": "roles/owner",
  854. // "members": [
  855. // "user:mike@example.com",
  856. // "group:admins@example.com",
  857. // "domain:google.com",
  858. //
  859. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  860. // ]
  861. // },
  862. // {
  863. // "role": "roles/viewer",
  864. // "members": ["user:sean@example.com"]
  865. // }
  866. // ]
  867. // }
  868. //
  869. // **YAML Example**
  870. //
  871. // bindings:
  872. // - members:
  873. // - user:mike@example.com
  874. // - group:admins@example.com
  875. // - domain:google.com
  876. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  877. // role: roles/owner
  878. // - members:
  879. // - user:sean@example.com
  880. // role: roles/viewer
  881. //
  882. //
  883. // For a description of IAM and its features, see the
  884. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  885. type Policy struct {
  886. // Bindings: Associates a list of `members` to a `role`.
  887. // `bindings` with no members will result in an error.
  888. Bindings []*Binding `json:"bindings,omitempty"`
  889. // Etag: `etag` is used for optimistic concurrency control as a way to
  890. // help
  891. // prevent simultaneous updates of a policy from overwriting each
  892. // other.
  893. // It is strongly suggested that systems make use of the `etag` in
  894. // the
  895. // read-modify-write cycle to perform policy updates in order to avoid
  896. // race
  897. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  898. // and
  899. // systems are expected to put that etag in the request to
  900. // `setIamPolicy` to
  901. // ensure that their change will be applied to the same version of the
  902. // policy.
  903. //
  904. // If no `etag` is provided in the call to `setIamPolicy`, then the
  905. // existing
  906. // policy is overwritten blindly.
  907. Etag string `json:"etag,omitempty"`
  908. // Version: Deprecated.
  909. Version int64 `json:"version,omitempty"`
  910. // ServerResponse contains the HTTP response code and headers from the
  911. // server.
  912. googleapi.ServerResponse `json:"-"`
  913. // ForceSendFields is a list of field names (e.g. "Bindings") to
  914. // unconditionally include in API requests. By default, fields with
  915. // empty values are omitted from API requests. However, any non-pointer,
  916. // non-interface field appearing in ForceSendFields will be sent to the
  917. // server regardless of whether the field is empty or not. This may be
  918. // used to include empty fields in Patch requests.
  919. ForceSendFields []string `json:"-"`
  920. // NullFields is a list of field names (e.g. "Bindings") to include in
  921. // API requests with the JSON null value. By default, fields with empty
  922. // values are omitted from API requests. However, any field with an
  923. // empty value appearing in NullFields will be sent to the server as
  924. // null. It is an error if a field in this list has a non-empty value.
  925. // This may be used to include null fields in Patch requests.
  926. NullFields []string `json:"-"`
  927. }
  928. func (s *Policy) MarshalJSON() ([]byte, error) {
  929. type NoMethod Policy
  930. raw := NoMethod(*s)
  931. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  932. }
  933. // PublicKeyCertificate: A public key certificate format and data.
  934. type PublicKeyCertificate struct {
  935. // Certificate: The certificate data.
  936. Certificate string `json:"certificate,omitempty"`
  937. // Format: The certificate format.
  938. //
  939. // Possible values:
  940. // "UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT" - The format has not
  941. // been specified. This is an invalid default value and
  942. // must not be used.
  943. // "X509_CERTIFICATE_PEM" - An X.509v3 certificate
  944. // ([RFC5280](https://www.ietf.org/rfc/rfc5280.txt)),
  945. // encoded in base64, and wrapped by `-----BEGIN CERTIFICATE-----`
  946. // and
  947. // `-----END CERTIFICATE-----`.
  948. Format string `json:"format,omitempty"`
  949. // X509Details: [Output only] The certificate details. Used only for
  950. // X.509 certificates.
  951. X509Details *X509CertificateDetails `json:"x509Details,omitempty"`
  952. // ForceSendFields is a list of field names (e.g. "Certificate") to
  953. // unconditionally include in API requests. By default, fields with
  954. // empty values are omitted from API requests. However, any non-pointer,
  955. // non-interface field appearing in ForceSendFields will be sent to the
  956. // server regardless of whether the field is empty or not. This may be
  957. // used to include empty fields in Patch requests.
  958. ForceSendFields []string `json:"-"`
  959. // NullFields is a list of field names (e.g. "Certificate") to include
  960. // in API requests with the JSON null value. By default, fields with
  961. // empty values are omitted from API requests. However, any field with
  962. // an empty value appearing in NullFields will be sent to the server as
  963. // null. It is an error if a field in this list has a non-empty value.
  964. // This may be used to include null fields in Patch requests.
  965. NullFields []string `json:"-"`
  966. }
  967. func (s *PublicKeyCertificate) MarshalJSON() ([]byte, error) {
  968. type NoMethod PublicKeyCertificate
  969. raw := NoMethod(*s)
  970. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  971. }
  972. // PublicKeyCredential: A public key format and data.
  973. type PublicKeyCredential struct {
  974. // Format: The format of the key.
  975. //
  976. // Possible values:
  977. // "UNSPECIFIED_PUBLIC_KEY_FORMAT" - The format has not been
  978. // specified. This is an invalid default value and
  979. // must not be used.
  980. // "RSA_PEM" - An RSA public key encoded in base64, and wrapped
  981. // by
  982. // `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----`. This can
  983. // be
  984. // used to verify `RS256` signatures in JWT tokens
  985. // ([RFC7518](
  986. // https://www.ietf.org/rfc/rfc7518.txt)).
  987. // "RSA_X509_PEM" - As RSA_PEM, but wrapped in an X.509v3 certificate
  988. // ([RFC5280](
  989. // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and
  990. // wrapped by
  991. // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.
  992. // "ES256_PEM" - Public key for the ECDSA algorithm using P-256 and
  993. // SHA-256, encoded in
  994. // base64, and wrapped by `-----BEGIN PUBLIC KEY-----` and
  995. // `-----END
  996. // PUBLIC KEY-----`. This can be used to verify JWT tokens with the
  997. // `ES256`
  998. // algorithm ([RFC7518](https://www.ietf.org/rfc/rfc7518.txt)). This
  999. // curve is
  1000. // defined in [OpenSSL](https://www.openssl.org/) as the `prime256v1`
  1001. // curve.
  1002. // "ES256_X509_PEM" - As ES256_PEM, but wrapped in an X.509v3
  1003. // certificate ([RFC5280](
  1004. // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and
  1005. // wrapped by
  1006. // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.
  1007. Format string `json:"format,omitempty"`
  1008. // Key: The key data.
  1009. Key string `json:"key,omitempty"`
  1010. // ForceSendFields is a list of field names (e.g. "Format") to
  1011. // unconditionally include in API requests. By default, fields with
  1012. // empty values are omitted from API requests. However, any non-pointer,
  1013. // non-interface field appearing in ForceSendFields will be sent to the
  1014. // server regardless of whether the field is empty or not. This may be
  1015. // used to include empty fields in Patch requests.
  1016. ForceSendFields []string `json:"-"`
  1017. // NullFields is a list of field names (e.g. "Format") to include in API
  1018. // requests with the JSON null value. By default, fields with empty
  1019. // values are omitted from API requests. However, any field with an
  1020. // empty value appearing in NullFields will be sent to the server as
  1021. // null. It is an error if a field in this list has a non-empty value.
  1022. // This may be used to include null fields in Patch requests.
  1023. NullFields []string `json:"-"`
  1024. }
  1025. func (s *PublicKeyCredential) MarshalJSON() ([]byte, error) {
  1026. type NoMethod PublicKeyCredential
  1027. raw := NoMethod(*s)
  1028. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1029. }
  1030. // RegistryCredential: A server-stored registry credential used to
  1031. // validate device credentials.
  1032. type RegistryCredential struct {
  1033. // PublicKeyCertificate: A public key certificate used to verify the
  1034. // device credentials.
  1035. PublicKeyCertificate *PublicKeyCertificate `json:"publicKeyCertificate,omitempty"`
  1036. // ForceSendFields is a list of field names (e.g.
  1037. // "PublicKeyCertificate") to unconditionally include in API requests.
  1038. // By default, fields with empty values are omitted from API requests.
  1039. // However, any non-pointer, non-interface field appearing in
  1040. // ForceSendFields will be sent to the server regardless of whether the
  1041. // field is empty or not. This may be used to include empty fields in
  1042. // Patch requests.
  1043. ForceSendFields []string `json:"-"`
  1044. // NullFields is a list of field names (e.g. "PublicKeyCertificate") to
  1045. // include in API requests with the JSON null value. By default, fields
  1046. // with empty values are omitted from API requests. However, any field
  1047. // with an empty value appearing in NullFields will be sent to the
  1048. // server as null. It is an error if a field in this list has a
  1049. // non-empty value. This may be used to include null fields in Patch
  1050. // requests.
  1051. NullFields []string `json:"-"`
  1052. }
  1053. func (s *RegistryCredential) MarshalJSON() ([]byte, error) {
  1054. type NoMethod RegistryCredential
  1055. raw := NoMethod(*s)
  1056. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1057. }
  1058. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1059. type SetIamPolicyRequest struct {
  1060. // Policy: REQUIRED: The complete policy to be applied to the
  1061. // `resource`. The size of
  1062. // the policy is limited to a few 10s of KB. An empty policy is a
  1063. // valid policy but certain Cloud Platform services (such as
  1064. // Projects)
  1065. // might reject them.
  1066. Policy *Policy `json:"policy,omitempty"`
  1067. // ForceSendFields is a list of field names (e.g. "Policy") to
  1068. // unconditionally include in API requests. By default, fields with
  1069. // empty values are omitted from API requests. However, any non-pointer,
  1070. // non-interface field appearing in ForceSendFields will be sent to the
  1071. // server regardless of whether the field is empty or not. This may be
  1072. // used to include empty fields in Patch requests.
  1073. ForceSendFields []string `json:"-"`
  1074. // NullFields is a list of field names (e.g. "Policy") to include in API
  1075. // requests with the JSON null value. By default, fields with empty
  1076. // values are omitted from API requests. However, any field with an
  1077. // empty value appearing in NullFields will be sent to the server as
  1078. // null. It is an error if a field in this list has a non-empty value.
  1079. // This may be used to include null fields in Patch requests.
  1080. NullFields []string `json:"-"`
  1081. }
  1082. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1083. type NoMethod SetIamPolicyRequest
  1084. raw := NoMethod(*s)
  1085. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1086. }
  1087. // StateNotificationConfig: The configuration for notification of new
  1088. // states received from the device.
  1089. type StateNotificationConfig struct {
  1090. // PubsubTopicName: A Cloud Pub/Sub topic name. For
  1091. // example,
  1092. // `projects/myProject/topics/deviceEvents`.
  1093. PubsubTopicName string `json:"pubsubTopicName,omitempty"`
  1094. // ForceSendFields is a list of field names (e.g. "PubsubTopicName") to
  1095. // unconditionally include in API requests. By default, fields with
  1096. // empty values are omitted from API requests. However, any non-pointer,
  1097. // non-interface field appearing in ForceSendFields will be sent to the
  1098. // server regardless of whether the field is empty or not. This may be
  1099. // used to include empty fields in Patch requests.
  1100. ForceSendFields []string `json:"-"`
  1101. // NullFields is a list of field names (e.g. "PubsubTopicName") to
  1102. // include in API requests with the JSON null value. By default, fields
  1103. // with empty values are omitted from API requests. However, any field
  1104. // with an empty value appearing in NullFields will be sent to the
  1105. // server as null. It is an error if a field in this list has a
  1106. // non-empty value. This may be used to include null fields in Patch
  1107. // requests.
  1108. NullFields []string `json:"-"`
  1109. }
  1110. func (s *StateNotificationConfig) MarshalJSON() ([]byte, error) {
  1111. type NoMethod StateNotificationConfig
  1112. raw := NoMethod(*s)
  1113. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1114. }
  1115. // Status: The `Status` type defines a logical error model that is
  1116. // suitable for different
  1117. // programming environments, including REST APIs and RPC APIs. It is
  1118. // used by
  1119. // [gRPC](https://github.com/grpc). The error model is designed to
  1120. // be:
  1121. //
  1122. // - Simple to use and understand for most users
  1123. // - Flexible enough to meet unexpected needs
  1124. //
  1125. // # Overview
  1126. //
  1127. // The `Status` message contains three pieces of data: error code, error
  1128. // message,
  1129. // and error details. The error code should be an enum value
  1130. // of
  1131. // google.rpc.Code, but it may accept additional error codes if needed.
  1132. // The
  1133. // error message should be a developer-facing English message that
  1134. // helps
  1135. // developers *understand* and *resolve* the error. If a localized
  1136. // user-facing
  1137. // error message is needed, put the localized message in the error
  1138. // details or
  1139. // localize it in the client. The optional error details may contain
  1140. // arbitrary
  1141. // information about the error. There is a predefined set of error
  1142. // detail types
  1143. // in the package `google.rpc` that can be used for common error
  1144. // conditions.
  1145. //
  1146. // # Language mapping
  1147. //
  1148. // The `Status` message is the logical representation of the error
  1149. // model, but it
  1150. // is not necessarily the actual wire format. When the `Status` message
  1151. // is
  1152. // exposed in different client libraries and different wire protocols,
  1153. // it can be
  1154. // mapped differently. For example, it will likely be mapped to some
  1155. // exceptions
  1156. // in Java, but more likely mapped to some error codes in C.
  1157. //
  1158. // # Other uses
  1159. //
  1160. // The error model and the `Status` message can be used in a variety
  1161. // of
  1162. // environments, either with or without APIs, to provide a
  1163. // consistent developer experience across different
  1164. // environments.
  1165. //
  1166. // Example uses of this error model include:
  1167. //
  1168. // - Partial errors. If a service needs to return partial errors to the
  1169. // client,
  1170. // it may embed the `Status` in the normal response to indicate the
  1171. // partial
  1172. // errors.
  1173. //
  1174. // - Workflow errors. A typical workflow has multiple steps. Each step
  1175. // may
  1176. // have a `Status` message for error reporting.
  1177. //
  1178. // - Batch operations. If a client uses batch request and batch
  1179. // response, the
  1180. // `Status` message should be used directly inside batch response,
  1181. // one for
  1182. // each error sub-response.
  1183. //
  1184. // - Asynchronous operations. If an API call embeds asynchronous
  1185. // operation
  1186. // results in its response, the status of those operations should
  1187. // be
  1188. // represented directly using the `Status` message.
  1189. //
  1190. // - Logging. If some API errors are stored in logs, the message
  1191. // `Status` could
  1192. // be used directly after any stripping needed for security/privacy
  1193. // reasons.
  1194. type Status struct {
  1195. // Code: The status code, which should be an enum value of
  1196. // google.rpc.Code.
  1197. Code int64 `json:"code,omitempty"`
  1198. // Details: A list of messages that carry the error details. There is a
  1199. // common set of
  1200. // message types for APIs to use.
  1201. Details []googleapi.RawMessage `json:"details,omitempty"`
  1202. // Message: A developer-facing error message, which should be in
  1203. // English. Any
  1204. // user-facing error message should be localized and sent in
  1205. // the
  1206. // google.rpc.Status.details field, or localized by the client.
  1207. Message string `json:"message,omitempty"`
  1208. // ForceSendFields is a list of field names (e.g. "Code") to
  1209. // unconditionally include in API requests. By default, fields with
  1210. // empty values are omitted from API requests. However, any non-pointer,
  1211. // non-interface field appearing in ForceSendFields will be sent to the
  1212. // server regardless of whether the field is empty or not. This may be
  1213. // used to include empty fields in Patch requests.
  1214. ForceSendFields []string `json:"-"`
  1215. // NullFields is a list of field names (e.g. "Code") to include in API
  1216. // requests with the JSON null value. By default, fields with empty
  1217. // values are omitted from API requests. However, any field with an
  1218. // empty value appearing in NullFields will be sent to the server as
  1219. // null. It is an error if a field in this list has a non-empty value.
  1220. // This may be used to include null fields in Patch requests.
  1221. NullFields []string `json:"-"`
  1222. }
  1223. func (s *Status) MarshalJSON() ([]byte, error) {
  1224. type NoMethod Status
  1225. raw := NoMethod(*s)
  1226. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1227. }
  1228. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  1229. // method.
  1230. type TestIamPermissionsRequest struct {
  1231. // Permissions: The set of permissions to check for the `resource`.
  1232. // Permissions with
  1233. // wildcards (such as '*' or 'storage.*') are not allowed. For
  1234. // more
  1235. // information see
  1236. // [IAM
  1237. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  1238. Permissions []string `json:"permissions,omitempty"`
  1239. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1240. // unconditionally include in API requests. By default, fields with
  1241. // empty values are omitted from API requests. However, any non-pointer,
  1242. // non-interface field appearing in ForceSendFields will be sent to the
  1243. // server regardless of whether the field is empty or not. This may be
  1244. // used to include empty fields in Patch requests.
  1245. ForceSendFields []string `json:"-"`
  1246. // NullFields is a list of field names (e.g. "Permissions") to include
  1247. // in API requests with the JSON null value. By default, fields with
  1248. // empty values are omitted from API requests. However, any field with
  1249. // an empty value appearing in NullFields will be sent to the server as
  1250. // null. It is an error if a field in this list has a non-empty value.
  1251. // This may be used to include null fields in Patch requests.
  1252. NullFields []string `json:"-"`
  1253. }
  1254. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  1255. type NoMethod TestIamPermissionsRequest
  1256. raw := NoMethod(*s)
  1257. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1258. }
  1259. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1260. // method.
  1261. type TestIamPermissionsResponse struct {
  1262. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1263. // the caller is
  1264. // allowed.
  1265. Permissions []string `json:"permissions,omitempty"`
  1266. // ServerResponse contains the HTTP response code and headers from the
  1267. // server.
  1268. googleapi.ServerResponse `json:"-"`
  1269. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1270. // unconditionally include in API requests. By default, fields with
  1271. // empty values are omitted from API requests. However, any non-pointer,
  1272. // non-interface field appearing in ForceSendFields will be sent to the
  1273. // server regardless of whether the field is empty or not. This may be
  1274. // used to include empty fields in Patch requests.
  1275. ForceSendFields []string `json:"-"`
  1276. // NullFields is a list of field names (e.g. "Permissions") to include
  1277. // in API requests with the JSON null value. By default, fields with
  1278. // empty values are omitted from API requests. However, any field with
  1279. // an empty value appearing in NullFields will be sent to the server as
  1280. // null. It is an error if a field in this list has a non-empty value.
  1281. // This may be used to include null fields in Patch requests.
  1282. NullFields []string `json:"-"`
  1283. }
  1284. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1285. type NoMethod TestIamPermissionsResponse
  1286. raw := NoMethod(*s)
  1287. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1288. }
  1289. // X509CertificateDetails: Details of an X.509 certificate. For
  1290. // informational purposes only.
  1291. type X509CertificateDetails struct {
  1292. // ExpiryTime: The time the certificate becomes invalid.
  1293. ExpiryTime string `json:"expiryTime,omitempty"`
  1294. // Issuer: The entity that signed the certificate.
  1295. Issuer string `json:"issuer,omitempty"`
  1296. // PublicKeyType: The type of public key in the certificate.
  1297. PublicKeyType string `json:"publicKeyType,omitempty"`
  1298. // SignatureAlgorithm: The algorithm used to sign the certificate.
  1299. SignatureAlgorithm string `json:"signatureAlgorithm,omitempty"`
  1300. // StartTime: The time the certificate becomes valid.
  1301. StartTime string `json:"startTime,omitempty"`
  1302. // Subject: The entity the certificate and public key belong to.
  1303. Subject string `json:"subject,omitempty"`
  1304. // ForceSendFields is a list of field names (e.g. "ExpiryTime") to
  1305. // unconditionally include in API requests. By default, fields with
  1306. // empty values are omitted from API requests. However, any non-pointer,
  1307. // non-interface field appearing in ForceSendFields will be sent to the
  1308. // server regardless of whether the field is empty or not. This may be
  1309. // used to include empty fields in Patch requests.
  1310. ForceSendFields []string `json:"-"`
  1311. // NullFields is a list of field names (e.g. "ExpiryTime") to include in
  1312. // API requests with the JSON null value. By default, fields with empty
  1313. // values are omitted from API requests. However, any field with an
  1314. // empty value appearing in NullFields will be sent to the server as
  1315. // null. It is an error if a field in this list has a non-empty value.
  1316. // This may be used to include null fields in Patch requests.
  1317. NullFields []string `json:"-"`
  1318. }
  1319. func (s *X509CertificateDetails) MarshalJSON() ([]byte, error) {
  1320. type NoMethod X509CertificateDetails
  1321. raw := NoMethod(*s)
  1322. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1323. }
  1324. // method id "cloudiot.projects.locations.registries.create":
  1325. type ProjectsLocationsRegistriesCreateCall struct {
  1326. s *Service
  1327. parent string
  1328. deviceregistry *DeviceRegistry
  1329. urlParams_ gensupport.URLParams
  1330. ctx_ context.Context
  1331. header_ http.Header
  1332. }
  1333. // Create: Creates a device registry that contains devices.
  1334. func (r *ProjectsLocationsRegistriesService) Create(parent string, deviceregistry *DeviceRegistry) *ProjectsLocationsRegistriesCreateCall {
  1335. c := &ProjectsLocationsRegistriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1336. c.parent = parent
  1337. c.deviceregistry = deviceregistry
  1338. return c
  1339. }
  1340. // Fields allows partial responses to be retrieved. See
  1341. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1342. // for more information.
  1343. func (c *ProjectsLocationsRegistriesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesCreateCall {
  1344. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1345. return c
  1346. }
  1347. // Context sets the context to be used in this call's Do method. Any
  1348. // pending HTTP request will be aborted if the provided context is
  1349. // canceled.
  1350. func (c *ProjectsLocationsRegistriesCreateCall) Context(ctx context.Context) *ProjectsLocationsRegistriesCreateCall {
  1351. c.ctx_ = ctx
  1352. return c
  1353. }
  1354. // Header returns an http.Header that can be modified by the caller to
  1355. // add HTTP headers to the request.
  1356. func (c *ProjectsLocationsRegistriesCreateCall) Header() http.Header {
  1357. if c.header_ == nil {
  1358. c.header_ = make(http.Header)
  1359. }
  1360. return c.header_
  1361. }
  1362. func (c *ProjectsLocationsRegistriesCreateCall) doRequest(alt string) (*http.Response, error) {
  1363. reqHeaders := make(http.Header)
  1364. for k, v := range c.header_ {
  1365. reqHeaders[k] = v
  1366. }
  1367. reqHeaders.Set("User-Agent", c.s.userAgent())
  1368. var body io.Reader = nil
  1369. body, err := googleapi.WithoutDataWrapper.JSONReader(c.deviceregistry)
  1370. if err != nil {
  1371. return nil, err
  1372. }
  1373. reqHeaders.Set("Content-Type", "application/json")
  1374. c.urlParams_.Set("alt", alt)
  1375. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/registries")
  1376. urls += "?" + c.urlParams_.Encode()
  1377. req, _ := http.NewRequest("POST", urls, body)
  1378. req.Header = reqHeaders
  1379. googleapi.Expand(req.URL, map[string]string{
  1380. "parent": c.parent,
  1381. })
  1382. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1383. }
  1384. // Do executes the "cloudiot.projects.locations.registries.create" call.
  1385. // Exactly one of *DeviceRegistry or error will be non-nil. Any non-2xx
  1386. // status code is an error. Response headers are in either
  1387. // *DeviceRegistry.ServerResponse.Header or (if a response was returned
  1388. // at all) in error.(*googleapi.Error).Header. Use
  1389. // googleapi.IsNotModified to check whether the returned error was
  1390. // because http.StatusNotModified was returned.
  1391. func (c *ProjectsLocationsRegistriesCreateCall) Do(opts ...googleapi.CallOption) (*DeviceRegistry, error) {
  1392. gensupport.SetOptions(c.urlParams_, opts...)
  1393. res, err := c.doRequest("json")
  1394. if res != nil && res.StatusCode == http.StatusNotModified {
  1395. if res.Body != nil {
  1396. res.Body.Close()
  1397. }
  1398. return nil, &googleapi.Error{
  1399. Code: res.StatusCode,
  1400. Header: res.Header,
  1401. }
  1402. }
  1403. if err != nil {
  1404. return nil, err
  1405. }
  1406. defer googleapi.CloseBody(res)
  1407. if err := googleapi.CheckResponse(res); err != nil {
  1408. return nil, err
  1409. }
  1410. ret := &DeviceRegistry{
  1411. ServerResponse: googleapi.ServerResponse{
  1412. Header: res.Header,
  1413. HTTPStatusCode: res.StatusCode,
  1414. },
  1415. }
  1416. target := &ret
  1417. if err := gensupport.DecodeResponse(target, res); err != nil {
  1418. return nil, err
  1419. }
  1420. return ret, nil
  1421. // {
  1422. // "description": "Creates a device registry that contains devices.",
  1423. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries",
  1424. // "httpMethod": "POST",
  1425. // "id": "cloudiot.projects.locations.registries.create",
  1426. // "parameterOrder": [
  1427. // "parent"
  1428. // ],
  1429. // "parameters": {
  1430. // "parent": {
  1431. // "description": "The project and cloud region where this device registry must be created.\nFor example, `projects/example-project/locations/us-central1`.",
  1432. // "location": "path",
  1433. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1434. // "required": true,
  1435. // "type": "string"
  1436. // }
  1437. // },
  1438. // "path": "v1/{+parent}/registries",
  1439. // "request": {
  1440. // "$ref": "DeviceRegistry"
  1441. // },
  1442. // "response": {
  1443. // "$ref": "DeviceRegistry"
  1444. // },
  1445. // "scopes": [
  1446. // "https://www.googleapis.com/auth/cloud-platform",
  1447. // "https://www.googleapis.com/auth/cloudiot"
  1448. // ]
  1449. // }
  1450. }
  1451. // method id "cloudiot.projects.locations.registries.delete":
  1452. type ProjectsLocationsRegistriesDeleteCall struct {
  1453. s *Service
  1454. name string
  1455. urlParams_ gensupport.URLParams
  1456. ctx_ context.Context
  1457. header_ http.Header
  1458. }
  1459. // Delete: Deletes a device registry configuration.
  1460. func (r *ProjectsLocationsRegistriesService) Delete(name string) *ProjectsLocationsRegistriesDeleteCall {
  1461. c := &ProjectsLocationsRegistriesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1462. c.name = name
  1463. return c
  1464. }
  1465. // Fields allows partial responses to be retrieved. See
  1466. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1467. // for more information.
  1468. func (c *ProjectsLocationsRegistriesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDeleteCall {
  1469. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1470. return c
  1471. }
  1472. // Context sets the context to be used in this call's Do method. Any
  1473. // pending HTTP request will be aborted if the provided context is
  1474. // canceled.
  1475. func (c *ProjectsLocationsRegistriesDeleteCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDeleteCall {
  1476. c.ctx_ = ctx
  1477. return c
  1478. }
  1479. // Header returns an http.Header that can be modified by the caller to
  1480. // add HTTP headers to the request.
  1481. func (c *ProjectsLocationsRegistriesDeleteCall) Header() http.Header {
  1482. if c.header_ == nil {
  1483. c.header_ = make(http.Header)
  1484. }
  1485. return c.header_
  1486. }
  1487. func (c *ProjectsLocationsRegistriesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1488. reqHeaders := make(http.Header)
  1489. for k, v := range c.header_ {
  1490. reqHeaders[k] = v
  1491. }
  1492. reqHeaders.Set("User-Agent", c.s.userAgent())
  1493. var body io.Reader = nil
  1494. c.urlParams_.Set("alt", alt)
  1495. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1496. urls += "?" + c.urlParams_.Encode()
  1497. req, _ := http.NewRequest("DELETE", urls, body)
  1498. req.Header = reqHeaders
  1499. googleapi.Expand(req.URL, map[string]string{
  1500. "name": c.name,
  1501. })
  1502. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1503. }
  1504. // Do executes the "cloudiot.projects.locations.registries.delete" call.
  1505. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1506. // code is an error. Response headers are in either
  1507. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1508. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1509. // check whether the returned error was because http.StatusNotModified
  1510. // was returned.
  1511. func (c *ProjectsLocationsRegistriesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1512. gensupport.SetOptions(c.urlParams_, opts...)
  1513. res, err := c.doRequest("json")
  1514. if res != nil && res.StatusCode == http.StatusNotModified {
  1515. if res.Body != nil {
  1516. res.Body.Close()
  1517. }
  1518. return nil, &googleapi.Error{
  1519. Code: res.StatusCode,
  1520. Header: res.Header,
  1521. }
  1522. }
  1523. if err != nil {
  1524. return nil, err
  1525. }
  1526. defer googleapi.CloseBody(res)
  1527. if err := googleapi.CheckResponse(res); err != nil {
  1528. return nil, err
  1529. }
  1530. ret := &Empty{
  1531. ServerResponse: googleapi.ServerResponse{
  1532. Header: res.Header,
  1533. HTTPStatusCode: res.StatusCode,
  1534. },
  1535. }
  1536. target := &ret
  1537. if err := gensupport.DecodeResponse(target, res); err != nil {
  1538. return nil, err
  1539. }
  1540. return ret, nil
  1541. // {
  1542. // "description": "Deletes a device registry configuration.",
  1543. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}",
  1544. // "httpMethod": "DELETE",
  1545. // "id": "cloudiot.projects.locations.registries.delete",
  1546. // "parameterOrder": [
  1547. // "name"
  1548. // ],
  1549. // "parameters": {
  1550. // "name": {
  1551. // "description": "The name of the device registry. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  1552. // "location": "path",
  1553. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  1554. // "required": true,
  1555. // "type": "string"
  1556. // }
  1557. // },
  1558. // "path": "v1/{+name}",
  1559. // "response": {
  1560. // "$ref": "Empty"
  1561. // },
  1562. // "scopes": [
  1563. // "https://www.googleapis.com/auth/cloud-platform",
  1564. // "https://www.googleapis.com/auth/cloudiot"
  1565. // ]
  1566. // }
  1567. }
  1568. // method id "cloudiot.projects.locations.registries.get":
  1569. type ProjectsLocationsRegistriesGetCall struct {
  1570. s *Service
  1571. name string
  1572. urlParams_ gensupport.URLParams
  1573. ifNoneMatch_ string
  1574. ctx_ context.Context
  1575. header_ http.Header
  1576. }
  1577. // Get: Gets a device registry configuration.
  1578. func (r *ProjectsLocationsRegistriesService) Get(name string) *ProjectsLocationsRegistriesGetCall {
  1579. c := &ProjectsLocationsRegistriesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1580. c.name = name
  1581. return c
  1582. }
  1583. // Fields allows partial responses to be retrieved. See
  1584. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1585. // for more information.
  1586. func (c *ProjectsLocationsRegistriesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGetCall {
  1587. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1588. return c
  1589. }
  1590. // IfNoneMatch sets the optional parameter which makes the operation
  1591. // fail if the object's ETag matches the given value. This is useful for
  1592. // getting updates only after the object has changed since the last
  1593. // request. Use googleapi.IsNotModified to check whether the response
  1594. // error from Do is the result of In-None-Match.
  1595. func (c *ProjectsLocationsRegistriesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesGetCall {
  1596. c.ifNoneMatch_ = entityTag
  1597. return c
  1598. }
  1599. // Context sets the context to be used in this call's Do method. Any
  1600. // pending HTTP request will be aborted if the provided context is
  1601. // canceled.
  1602. func (c *ProjectsLocationsRegistriesGetCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGetCall {
  1603. c.ctx_ = ctx
  1604. return c
  1605. }
  1606. // Header returns an http.Header that can be modified by the caller to
  1607. // add HTTP headers to the request.
  1608. func (c *ProjectsLocationsRegistriesGetCall) Header() http.Header {
  1609. if c.header_ == nil {
  1610. c.header_ = make(http.Header)
  1611. }
  1612. return c.header_
  1613. }
  1614. func (c *ProjectsLocationsRegistriesGetCall) doRequest(alt string) (*http.Response, error) {
  1615. reqHeaders := make(http.Header)
  1616. for k, v := range c.header_ {
  1617. reqHeaders[k] = v
  1618. }
  1619. reqHeaders.Set("User-Agent", c.s.userAgent())
  1620. if c.ifNoneMatch_ != "" {
  1621. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1622. }
  1623. var body io.Reader = nil
  1624. c.urlParams_.Set("alt", alt)
  1625. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1626. urls += "?" + c.urlParams_.Encode()
  1627. req, _ := http.NewRequest("GET", urls, body)
  1628. req.Header = reqHeaders
  1629. googleapi.Expand(req.URL, map[string]string{
  1630. "name": c.name,
  1631. })
  1632. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1633. }
  1634. // Do executes the "cloudiot.projects.locations.registries.get" call.
  1635. // Exactly one of *DeviceRegistry or error will be non-nil. Any non-2xx
  1636. // status code is an error. Response headers are in either
  1637. // *DeviceRegistry.ServerResponse.Header or (if a response was returned
  1638. // at all) in error.(*googleapi.Error).Header. Use
  1639. // googleapi.IsNotModified to check whether the returned error was
  1640. // because http.StatusNotModified was returned.
  1641. func (c *ProjectsLocationsRegistriesGetCall) Do(opts ...googleapi.CallOption) (*DeviceRegistry, error) {
  1642. gensupport.SetOptions(c.urlParams_, opts...)
  1643. res, err := c.doRequest("json")
  1644. if res != nil && res.StatusCode == http.StatusNotModified {
  1645. if res.Body != nil {
  1646. res.Body.Close()
  1647. }
  1648. return nil, &googleapi.Error{
  1649. Code: res.StatusCode,
  1650. Header: res.Header,
  1651. }
  1652. }
  1653. if err != nil {
  1654. return nil, err
  1655. }
  1656. defer googleapi.CloseBody(res)
  1657. if err := googleapi.CheckResponse(res); err != nil {
  1658. return nil, err
  1659. }
  1660. ret := &DeviceRegistry{
  1661. ServerResponse: googleapi.ServerResponse{
  1662. Header: res.Header,
  1663. HTTPStatusCode: res.StatusCode,
  1664. },
  1665. }
  1666. target := &ret
  1667. if err := gensupport.DecodeResponse(target, res); err != nil {
  1668. return nil, err
  1669. }
  1670. return ret, nil
  1671. // {
  1672. // "description": "Gets a device registry configuration.",
  1673. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}",
  1674. // "httpMethod": "GET",
  1675. // "id": "cloudiot.projects.locations.registries.get",
  1676. // "parameterOrder": [
  1677. // "name"
  1678. // ],
  1679. // "parameters": {
  1680. // "name": {
  1681. // "description": "The name of the device registry. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  1682. // "location": "path",
  1683. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  1684. // "required": true,
  1685. // "type": "string"
  1686. // }
  1687. // },
  1688. // "path": "v1/{+name}",
  1689. // "response": {
  1690. // "$ref": "DeviceRegistry"
  1691. // },
  1692. // "scopes": [
  1693. // "https://www.googleapis.com/auth/cloud-platform",
  1694. // "https://www.googleapis.com/auth/cloudiot"
  1695. // ]
  1696. // }
  1697. }
  1698. // method id "cloudiot.projects.locations.registries.getIamPolicy":
  1699. type ProjectsLocationsRegistriesGetIamPolicyCall struct {
  1700. s *Service
  1701. resource string
  1702. getiampolicyrequest *GetIamPolicyRequest
  1703. urlParams_ gensupport.URLParams
  1704. ctx_ context.Context
  1705. header_ http.Header
  1706. }
  1707. // GetIamPolicy: Gets the access control policy for a resource.
  1708. // Returns an empty policy if the resource exists and does not have a
  1709. // policy
  1710. // set.
  1711. func (r *ProjectsLocationsRegistriesService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsLocationsRegistriesGetIamPolicyCall {
  1712. c := &ProjectsLocationsRegistriesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1713. c.resource = resource
  1714. c.getiampolicyrequest = getiampolicyrequest
  1715. return c
  1716. }
  1717. // Fields allows partial responses to be retrieved. See
  1718. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1719. // for more information.
  1720. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGetIamPolicyCall {
  1721. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1722. return c
  1723. }
  1724. // Context sets the context to be used in this call's Do method. Any
  1725. // pending HTTP request will be aborted if the provided context is
  1726. // canceled.
  1727. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGetIamPolicyCall {
  1728. c.ctx_ = ctx
  1729. return c
  1730. }
  1731. // Header returns an http.Header that can be modified by the caller to
  1732. // add HTTP headers to the request.
  1733. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Header() http.Header {
  1734. if c.header_ == nil {
  1735. c.header_ = make(http.Header)
  1736. }
  1737. return c.header_
  1738. }
  1739. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  1740. reqHeaders := make(http.Header)
  1741. for k, v := range c.header_ {
  1742. reqHeaders[k] = v
  1743. }
  1744. reqHeaders.Set("User-Agent", c.s.userAgent())
  1745. var body io.Reader = nil
  1746. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  1747. if err != nil {
  1748. return nil, err
  1749. }
  1750. reqHeaders.Set("Content-Type", "application/json")
  1751. c.urlParams_.Set("alt", alt)
  1752. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  1753. urls += "?" + c.urlParams_.Encode()
  1754. req, _ := http.NewRequest("POST", urls, body)
  1755. req.Header = reqHeaders
  1756. googleapi.Expand(req.URL, map[string]string{
  1757. "resource": c.resource,
  1758. })
  1759. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1760. }
  1761. // Do executes the "cloudiot.projects.locations.registries.getIamPolicy" call.
  1762. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  1763. // code is an error. Response headers are in either
  1764. // *Policy.ServerResponse.Header or (if a response was returned at all)
  1765. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1766. // check whether the returned error was because http.StatusNotModified
  1767. // was returned.
  1768. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  1769. gensupport.SetOptions(c.urlParams_, opts...)
  1770. res, err := c.doRequest("json")
  1771. if res != nil && res.StatusCode == http.StatusNotModified {
  1772. if res.Body != nil {
  1773. res.Body.Close()
  1774. }
  1775. return nil, &googleapi.Error{
  1776. Code: res.StatusCode,
  1777. Header: res.Header,
  1778. }
  1779. }
  1780. if err != nil {
  1781. return nil, err
  1782. }
  1783. defer googleapi.CloseBody(res)
  1784. if err := googleapi.CheckResponse(res); err != nil {
  1785. return nil, err
  1786. }
  1787. ret := &Policy{
  1788. ServerResponse: googleapi.ServerResponse{
  1789. Header: res.Header,
  1790. HTTPStatusCode: res.StatusCode,
  1791. },
  1792. }
  1793. target := &ret
  1794. if err := gensupport.DecodeResponse(target, res); err != nil {
  1795. return nil, err
  1796. }
  1797. return ret, nil
  1798. // {
  1799. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  1800. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:getIamPolicy",
  1801. // "httpMethod": "POST",
  1802. // "id": "cloudiot.projects.locations.registries.getIamPolicy",
  1803. // "parameterOrder": [
  1804. // "resource"
  1805. // ],
  1806. // "parameters": {
  1807. // "resource": {
  1808. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  1809. // "location": "path",
  1810. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  1811. // "required": true,
  1812. // "type": "string"
  1813. // }
  1814. // },
  1815. // "path": "v1/{+resource}:getIamPolicy",
  1816. // "request": {
  1817. // "$ref": "GetIamPolicyRequest"
  1818. // },
  1819. // "response": {
  1820. // "$ref": "Policy"
  1821. // },
  1822. // "scopes": [
  1823. // "https://www.googleapis.com/auth/cloud-platform",
  1824. // "https://www.googleapis.com/auth/cloudiot"
  1825. // ]
  1826. // }
  1827. }
  1828. // method id "cloudiot.projects.locations.registries.list":
  1829. type ProjectsLocationsRegistriesListCall struct {
  1830. s *Service
  1831. parent string
  1832. urlParams_ gensupport.URLParams
  1833. ifNoneMatch_ string
  1834. ctx_ context.Context
  1835. header_ http.Header
  1836. }
  1837. // List: Lists device registries.
  1838. func (r *ProjectsLocationsRegistriesService) List(parent string) *ProjectsLocationsRegistriesListCall {
  1839. c := &ProjectsLocationsRegistriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1840. c.parent = parent
  1841. return c
  1842. }
  1843. // PageSize sets the optional parameter "pageSize": The maximum number
  1844. // of registries to return in the response. If this value
  1845. // is zero, the service will select a default size. A call may return
  1846. // fewer
  1847. // objects than requested, but if there is a non-empty `page_token`,
  1848. // it
  1849. // indicates that more entries are available.
  1850. func (c *ProjectsLocationsRegistriesListCall) PageSize(pageSize int64) *ProjectsLocationsRegistriesListCall {
  1851. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1852. return c
  1853. }
  1854. // PageToken sets the optional parameter "pageToken": The value returned
  1855. // by the last `ListDeviceRegistriesResponse`; indicates
  1856. // that this is a continuation of a prior `ListDeviceRegistries` call,
  1857. // and
  1858. // that the system should return the next page of data.
  1859. func (c *ProjectsLocationsRegistriesListCall) PageToken(pageToken string) *ProjectsLocationsRegistriesListCall {
  1860. c.urlParams_.Set("pageToken", pageToken)
  1861. return c
  1862. }
  1863. // Fields allows partial responses to be retrieved. See
  1864. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1865. // for more information.
  1866. func (c *ProjectsLocationsRegistriesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesListCall {
  1867. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1868. return c
  1869. }
  1870. // IfNoneMatch sets the optional parameter which makes the operation
  1871. // fail if the object's ETag matches the given value. This is useful for
  1872. // getting updates only after the object has changed since the last
  1873. // request. Use googleapi.IsNotModified to check whether the response
  1874. // error from Do is the result of In-None-Match.
  1875. func (c *ProjectsLocationsRegistriesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesListCall {
  1876. c.ifNoneMatch_ = entityTag
  1877. return c
  1878. }
  1879. // Context sets the context to be used in this call's Do method. Any
  1880. // pending HTTP request will be aborted if the provided context is
  1881. // canceled.
  1882. func (c *ProjectsLocationsRegistriesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesListCall {
  1883. c.ctx_ = ctx
  1884. return c
  1885. }
  1886. // Header returns an http.Header that can be modified by the caller to
  1887. // add HTTP headers to the request.
  1888. func (c *ProjectsLocationsRegistriesListCall) Header() http.Header {
  1889. if c.header_ == nil {
  1890. c.header_ = make(http.Header)
  1891. }
  1892. return c.header_
  1893. }
  1894. func (c *ProjectsLocationsRegistriesListCall) doRequest(alt string) (*http.Response, error) {
  1895. reqHeaders := make(http.Header)
  1896. for k, v := range c.header_ {
  1897. reqHeaders[k] = v
  1898. }
  1899. reqHeaders.Set("User-Agent", c.s.userAgent())
  1900. if c.ifNoneMatch_ != "" {
  1901. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1902. }
  1903. var body io.Reader = nil
  1904. c.urlParams_.Set("alt", alt)
  1905. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/registries")
  1906. urls += "?" + c.urlParams_.Encode()
  1907. req, _ := http.NewRequest("GET", urls, body)
  1908. req.Header = reqHeaders
  1909. googleapi.Expand(req.URL, map[string]string{
  1910. "parent": c.parent,
  1911. })
  1912. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1913. }
  1914. // Do executes the "cloudiot.projects.locations.registries.list" call.
  1915. // Exactly one of *ListDeviceRegistriesResponse or error will be
  1916. // non-nil. Any non-2xx status code is an error. Response headers are in
  1917. // either *ListDeviceRegistriesResponse.ServerResponse.Header or (if a
  1918. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1919. // googleapi.IsNotModified to check whether the returned error was
  1920. // because http.StatusNotModified was returned.
  1921. func (c *ProjectsLocationsRegistriesListCall) Do(opts ...googleapi.CallOption) (*ListDeviceRegistriesResponse, error) {
  1922. gensupport.SetOptions(c.urlParams_, opts...)
  1923. res, err := c.doRequest("json")
  1924. if res != nil && res.StatusCode == http.StatusNotModified {
  1925. if res.Body != nil {
  1926. res.Body.Close()
  1927. }
  1928. return nil, &googleapi.Error{
  1929. Code: res.StatusCode,
  1930. Header: res.Header,
  1931. }
  1932. }
  1933. if err != nil {
  1934. return nil, err
  1935. }
  1936. defer googleapi.CloseBody(res)
  1937. if err := googleapi.CheckResponse(res); err != nil {
  1938. return nil, err
  1939. }
  1940. ret := &ListDeviceRegistriesResponse{
  1941. ServerResponse: googleapi.ServerResponse{
  1942. Header: res.Header,
  1943. HTTPStatusCode: res.StatusCode,
  1944. },
  1945. }
  1946. target := &ret
  1947. if err := gensupport.DecodeResponse(target, res); err != nil {
  1948. return nil, err
  1949. }
  1950. return ret, nil
  1951. // {
  1952. // "description": "Lists device registries.",
  1953. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries",
  1954. // "httpMethod": "GET",
  1955. // "id": "cloudiot.projects.locations.registries.list",
  1956. // "parameterOrder": [
  1957. // "parent"
  1958. // ],
  1959. // "parameters": {
  1960. // "pageSize": {
  1961. // "description": "The maximum number of registries to return in the response. If this value\nis zero, the service will select a default size. A call may return fewer\nobjects than requested, but if there is a non-empty `page_token`, it\nindicates that more entries are available.",
  1962. // "format": "int32",
  1963. // "location": "query",
  1964. // "type": "integer"
  1965. // },
  1966. // "pageToken": {
  1967. // "description": "The value returned by the last `ListDeviceRegistriesResponse`; indicates\nthat this is a continuation of a prior `ListDeviceRegistries` call, and\nthat the system should return the next page of data.",
  1968. // "location": "query",
  1969. // "type": "string"
  1970. // },
  1971. // "parent": {
  1972. // "description": "The project and cloud region path. For example,\n`projects/example-project/locations/us-central1`.",
  1973. // "location": "path",
  1974. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1975. // "required": true,
  1976. // "type": "string"
  1977. // }
  1978. // },
  1979. // "path": "v1/{+parent}/registries",
  1980. // "response": {
  1981. // "$ref": "ListDeviceRegistriesResponse"
  1982. // },
  1983. // "scopes": [
  1984. // "https://www.googleapis.com/auth/cloud-platform",
  1985. // "https://www.googleapis.com/auth/cloudiot"
  1986. // ]
  1987. // }
  1988. }
  1989. // Pages invokes f for each page of results.
  1990. // A non-nil error returned from f will halt the iteration.
  1991. // The provided context supersedes any context provided to the Context method.
  1992. func (c *ProjectsLocationsRegistriesListCall) Pages(ctx context.Context, f func(*ListDeviceRegistriesResponse) error) error {
  1993. c.ctx_ = ctx
  1994. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1995. for {
  1996. x, err := c.Do()
  1997. if err != nil {
  1998. return err
  1999. }
  2000. if err := f(x); err != nil {
  2001. return err
  2002. }
  2003. if x.NextPageToken == "" {
  2004. return nil
  2005. }
  2006. c.PageToken(x.NextPageToken)
  2007. }
  2008. }
  2009. // method id "cloudiot.projects.locations.registries.patch":
  2010. type ProjectsLocationsRegistriesPatchCall struct {
  2011. s *Service
  2012. name string
  2013. deviceregistry *DeviceRegistry
  2014. urlParams_ gensupport.URLParams
  2015. ctx_ context.Context
  2016. header_ http.Header
  2017. }
  2018. // Patch: Updates a device registry configuration.
  2019. func (r *ProjectsLocationsRegistriesService) Patch(name string, deviceregistry *DeviceRegistry) *ProjectsLocationsRegistriesPatchCall {
  2020. c := &ProjectsLocationsRegistriesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2021. c.name = name
  2022. c.deviceregistry = deviceregistry
  2023. return c
  2024. }
  2025. // UpdateMask sets the optional parameter "updateMask": Only updates the
  2026. // `device_registry` fields indicated by this mask.
  2027. // The field mask must not be empty, and it must not contain fields
  2028. // that
  2029. // are immutable or only set by the server.
  2030. // Mutable top-level fields: `event_notification_config`,
  2031. // `http_config`,
  2032. // `mqtt_config`, and `state_notification_config`.
  2033. func (c *ProjectsLocationsRegistriesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsRegistriesPatchCall {
  2034. c.urlParams_.Set("updateMask", updateMask)
  2035. return c
  2036. }
  2037. // Fields allows partial responses to be retrieved. See
  2038. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2039. // for more information.
  2040. func (c *ProjectsLocationsRegistriesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesPatchCall {
  2041. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2042. return c
  2043. }
  2044. // Context sets the context to be used in this call's Do method. Any
  2045. // pending HTTP request will be aborted if the provided context is
  2046. // canceled.
  2047. func (c *ProjectsLocationsRegistriesPatchCall) Context(ctx context.Context) *ProjectsLocationsRegistriesPatchCall {
  2048. c.ctx_ = ctx
  2049. return c
  2050. }
  2051. // Header returns an http.Header that can be modified by the caller to
  2052. // add HTTP headers to the request.
  2053. func (c *ProjectsLocationsRegistriesPatchCall) Header() http.Header {
  2054. if c.header_ == nil {
  2055. c.header_ = make(http.Header)
  2056. }
  2057. return c.header_
  2058. }
  2059. func (c *ProjectsLocationsRegistriesPatchCall) doRequest(alt string) (*http.Response, error) {
  2060. reqHeaders := make(http.Header)
  2061. for k, v := range c.header_ {
  2062. reqHeaders[k] = v
  2063. }
  2064. reqHeaders.Set("User-Agent", c.s.userAgent())
  2065. var body io.Reader = nil
  2066. body, err := googleapi.WithoutDataWrapper.JSONReader(c.deviceregistry)
  2067. if err != nil {
  2068. return nil, err
  2069. }
  2070. reqHeaders.Set("Content-Type", "application/json")
  2071. c.urlParams_.Set("alt", alt)
  2072. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2073. urls += "?" + c.urlParams_.Encode()
  2074. req, _ := http.NewRequest("PATCH", urls, body)
  2075. req.Header = reqHeaders
  2076. googleapi.Expand(req.URL, map[string]string{
  2077. "name": c.name,
  2078. })
  2079. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2080. }
  2081. // Do executes the "cloudiot.projects.locations.registries.patch" call.
  2082. // Exactly one of *DeviceRegistry or error will be non-nil. Any non-2xx
  2083. // status code is an error. Response headers are in either
  2084. // *DeviceRegistry.ServerResponse.Header or (if a response was returned
  2085. // at all) in error.(*googleapi.Error).Header. Use
  2086. // googleapi.IsNotModified to check whether the returned error was
  2087. // because http.StatusNotModified was returned.
  2088. func (c *ProjectsLocationsRegistriesPatchCall) Do(opts ...googleapi.CallOption) (*DeviceRegistry, error) {
  2089. gensupport.SetOptions(c.urlParams_, opts...)
  2090. res, err := c.doRequest("json")
  2091. if res != nil && res.StatusCode == http.StatusNotModified {
  2092. if res.Body != nil {
  2093. res.Body.Close()
  2094. }
  2095. return nil, &googleapi.Error{
  2096. Code: res.StatusCode,
  2097. Header: res.Header,
  2098. }
  2099. }
  2100. if err != nil {
  2101. return nil, err
  2102. }
  2103. defer googleapi.CloseBody(res)
  2104. if err := googleapi.CheckResponse(res); err != nil {
  2105. return nil, err
  2106. }
  2107. ret := &DeviceRegistry{
  2108. ServerResponse: googleapi.ServerResponse{
  2109. Header: res.Header,
  2110. HTTPStatusCode: res.StatusCode,
  2111. },
  2112. }
  2113. target := &ret
  2114. if err := gensupport.DecodeResponse(target, res); err != nil {
  2115. return nil, err
  2116. }
  2117. return ret, nil
  2118. // {
  2119. // "description": "Updates a device registry configuration.",
  2120. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}",
  2121. // "httpMethod": "PATCH",
  2122. // "id": "cloudiot.projects.locations.registries.patch",
  2123. // "parameterOrder": [
  2124. // "name"
  2125. // ],
  2126. // "parameters": {
  2127. // "name": {
  2128. // "description": "The resource path name. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  2129. // "location": "path",
  2130. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2131. // "required": true,
  2132. // "type": "string"
  2133. // },
  2134. // "updateMask": {
  2135. // "description": "Only updates the `device_registry` fields indicated by this mask.\nThe field mask must not be empty, and it must not contain fields that\nare immutable or only set by the server.\nMutable top-level fields: `event_notification_config`, `http_config`,\n`mqtt_config`, and `state_notification_config`.",
  2136. // "format": "google-fieldmask",
  2137. // "location": "query",
  2138. // "type": "string"
  2139. // }
  2140. // },
  2141. // "path": "v1/{+name}",
  2142. // "request": {
  2143. // "$ref": "DeviceRegistry"
  2144. // },
  2145. // "response": {
  2146. // "$ref": "DeviceRegistry"
  2147. // },
  2148. // "scopes": [
  2149. // "https://www.googleapis.com/auth/cloud-platform",
  2150. // "https://www.googleapis.com/auth/cloudiot"
  2151. // ]
  2152. // }
  2153. }
  2154. // method id "cloudiot.projects.locations.registries.setIamPolicy":
  2155. type ProjectsLocationsRegistriesSetIamPolicyCall struct {
  2156. s *Service
  2157. resource string
  2158. setiampolicyrequest *SetIamPolicyRequest
  2159. urlParams_ gensupport.URLParams
  2160. ctx_ context.Context
  2161. header_ http.Header
  2162. }
  2163. // SetIamPolicy: Sets the access control policy on the specified
  2164. // resource. Replaces any
  2165. // existing policy.
  2166. func (r *ProjectsLocationsRegistriesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsRegistriesSetIamPolicyCall {
  2167. c := &ProjectsLocationsRegistriesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2168. c.resource = resource
  2169. c.setiampolicyrequest = setiampolicyrequest
  2170. return c
  2171. }
  2172. // Fields allows partial responses to be retrieved. See
  2173. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2174. // for more information.
  2175. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesSetIamPolicyCall {
  2176. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2177. return c
  2178. }
  2179. // Context sets the context to be used in this call's Do method. Any
  2180. // pending HTTP request will be aborted if the provided context is
  2181. // canceled.
  2182. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesSetIamPolicyCall {
  2183. c.ctx_ = ctx
  2184. return c
  2185. }
  2186. // Header returns an http.Header that can be modified by the caller to
  2187. // add HTTP headers to the request.
  2188. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Header() http.Header {
  2189. if c.header_ == nil {
  2190. c.header_ = make(http.Header)
  2191. }
  2192. return c.header_
  2193. }
  2194. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2195. reqHeaders := make(http.Header)
  2196. for k, v := range c.header_ {
  2197. reqHeaders[k] = v
  2198. }
  2199. reqHeaders.Set("User-Agent", c.s.userAgent())
  2200. var body io.Reader = nil
  2201. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2202. if err != nil {
  2203. return nil, err
  2204. }
  2205. reqHeaders.Set("Content-Type", "application/json")
  2206. c.urlParams_.Set("alt", alt)
  2207. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  2208. urls += "?" + c.urlParams_.Encode()
  2209. req, _ := http.NewRequest("POST", urls, body)
  2210. req.Header = reqHeaders
  2211. googleapi.Expand(req.URL, map[string]string{
  2212. "resource": c.resource,
  2213. })
  2214. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2215. }
  2216. // Do executes the "cloudiot.projects.locations.registries.setIamPolicy" call.
  2217. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2218. // code is an error. Response headers are in either
  2219. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2220. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2221. // check whether the returned error was because http.StatusNotModified
  2222. // was returned.
  2223. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2224. gensupport.SetOptions(c.urlParams_, opts...)
  2225. res, err := c.doRequest("json")
  2226. if res != nil && res.StatusCode == http.StatusNotModified {
  2227. if res.Body != nil {
  2228. res.Body.Close()
  2229. }
  2230. return nil, &googleapi.Error{
  2231. Code: res.StatusCode,
  2232. Header: res.Header,
  2233. }
  2234. }
  2235. if err != nil {
  2236. return nil, err
  2237. }
  2238. defer googleapi.CloseBody(res)
  2239. if err := googleapi.CheckResponse(res); err != nil {
  2240. return nil, err
  2241. }
  2242. ret := &Policy{
  2243. ServerResponse: googleapi.ServerResponse{
  2244. Header: res.Header,
  2245. HTTPStatusCode: res.StatusCode,
  2246. },
  2247. }
  2248. target := &ret
  2249. if err := gensupport.DecodeResponse(target, res); err != nil {
  2250. return nil, err
  2251. }
  2252. return ret, nil
  2253. // {
  2254. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  2255. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:setIamPolicy",
  2256. // "httpMethod": "POST",
  2257. // "id": "cloudiot.projects.locations.registries.setIamPolicy",
  2258. // "parameterOrder": [
  2259. // "resource"
  2260. // ],
  2261. // "parameters": {
  2262. // "resource": {
  2263. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2264. // "location": "path",
  2265. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2266. // "required": true,
  2267. // "type": "string"
  2268. // }
  2269. // },
  2270. // "path": "v1/{+resource}:setIamPolicy",
  2271. // "request": {
  2272. // "$ref": "SetIamPolicyRequest"
  2273. // },
  2274. // "response": {
  2275. // "$ref": "Policy"
  2276. // },
  2277. // "scopes": [
  2278. // "https://www.googleapis.com/auth/cloud-platform",
  2279. // "https://www.googleapis.com/auth/cloudiot"
  2280. // ]
  2281. // }
  2282. }
  2283. // method id "cloudiot.projects.locations.registries.testIamPermissions":
  2284. type ProjectsLocationsRegistriesTestIamPermissionsCall struct {
  2285. s *Service
  2286. resource string
  2287. testiampermissionsrequest *TestIamPermissionsRequest
  2288. urlParams_ gensupport.URLParams
  2289. ctx_ context.Context
  2290. header_ http.Header
  2291. }
  2292. // TestIamPermissions: Returns permissions that a caller has on the
  2293. // specified resource.
  2294. // If the resource does not exist, this will return an empty set
  2295. // of
  2296. // permissions, not a NOT_FOUND error.
  2297. func (r *ProjectsLocationsRegistriesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsRegistriesTestIamPermissionsCall {
  2298. c := &ProjectsLocationsRegistriesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2299. c.resource = resource
  2300. c.testiampermissionsrequest = testiampermissionsrequest
  2301. return c
  2302. }
  2303. // Fields allows partial responses to be retrieved. See
  2304. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2305. // for more information.
  2306. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesTestIamPermissionsCall {
  2307. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2308. return c
  2309. }
  2310. // Context sets the context to be used in this call's Do method. Any
  2311. // pending HTTP request will be aborted if the provided context is
  2312. // canceled.
  2313. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsRegistriesTestIamPermissionsCall {
  2314. c.ctx_ = ctx
  2315. return c
  2316. }
  2317. // Header returns an http.Header that can be modified by the caller to
  2318. // add HTTP headers to the request.
  2319. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Header() http.Header {
  2320. if c.header_ == nil {
  2321. c.header_ = make(http.Header)
  2322. }
  2323. return c.header_
  2324. }
  2325. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2326. reqHeaders := make(http.Header)
  2327. for k, v := range c.header_ {
  2328. reqHeaders[k] = v
  2329. }
  2330. reqHeaders.Set("User-Agent", c.s.userAgent())
  2331. var body io.Reader = nil
  2332. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2333. if err != nil {
  2334. return nil, err
  2335. }
  2336. reqHeaders.Set("Content-Type", "application/json")
  2337. c.urlParams_.Set("alt", alt)
  2338. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  2339. urls += "?" + c.urlParams_.Encode()
  2340. req, _ := http.NewRequest("POST", urls, body)
  2341. req.Header = reqHeaders
  2342. googleapi.Expand(req.URL, map[string]string{
  2343. "resource": c.resource,
  2344. })
  2345. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2346. }
  2347. // Do executes the "cloudiot.projects.locations.registries.testIamPermissions" call.
  2348. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2349. // Any non-2xx status code is an error. Response headers are in either
  2350. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2351. // was returned at all) in error.(*googleapi.Error).Header. Use
  2352. // googleapi.IsNotModified to check whether the returned error was
  2353. // because http.StatusNotModified was returned.
  2354. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2355. gensupport.SetOptions(c.urlParams_, opts...)
  2356. res, err := c.doRequest("json")
  2357. if res != nil && res.StatusCode == http.StatusNotModified {
  2358. if res.Body != nil {
  2359. res.Body.Close()
  2360. }
  2361. return nil, &googleapi.Error{
  2362. Code: res.StatusCode,
  2363. Header: res.Header,
  2364. }
  2365. }
  2366. if err != nil {
  2367. return nil, err
  2368. }
  2369. defer googleapi.CloseBody(res)
  2370. if err := googleapi.CheckResponse(res); err != nil {
  2371. return nil, err
  2372. }
  2373. ret := &TestIamPermissionsResponse{
  2374. ServerResponse: googleapi.ServerResponse{
  2375. Header: res.Header,
  2376. HTTPStatusCode: res.StatusCode,
  2377. },
  2378. }
  2379. target := &ret
  2380. if err := gensupport.DecodeResponse(target, res); err != nil {
  2381. return nil, err
  2382. }
  2383. return ret, nil
  2384. // {
  2385. // "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.",
  2386. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:testIamPermissions",
  2387. // "httpMethod": "POST",
  2388. // "id": "cloudiot.projects.locations.registries.testIamPermissions",
  2389. // "parameterOrder": [
  2390. // "resource"
  2391. // ],
  2392. // "parameters": {
  2393. // "resource": {
  2394. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2395. // "location": "path",
  2396. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2397. // "required": true,
  2398. // "type": "string"
  2399. // }
  2400. // },
  2401. // "path": "v1/{+resource}:testIamPermissions",
  2402. // "request": {
  2403. // "$ref": "TestIamPermissionsRequest"
  2404. // },
  2405. // "response": {
  2406. // "$ref": "TestIamPermissionsResponse"
  2407. // },
  2408. // "scopes": [
  2409. // "https://www.googleapis.com/auth/cloud-platform",
  2410. // "https://www.googleapis.com/auth/cloudiot"
  2411. // ]
  2412. // }
  2413. }
  2414. // method id "cloudiot.projects.locations.registries.devices.create":
  2415. type ProjectsLocationsRegistriesDevicesCreateCall struct {
  2416. s *Service
  2417. parent string
  2418. device *Device
  2419. urlParams_ gensupport.URLParams
  2420. ctx_ context.Context
  2421. header_ http.Header
  2422. }
  2423. // Create: Creates a device in a device registry.
  2424. func (r *ProjectsLocationsRegistriesDevicesService) Create(parent string, device *Device) *ProjectsLocationsRegistriesDevicesCreateCall {
  2425. c := &ProjectsLocationsRegistriesDevicesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2426. c.parent = parent
  2427. c.device = device
  2428. return c
  2429. }
  2430. // Fields allows partial responses to be retrieved. See
  2431. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2432. // for more information.
  2433. func (c *ProjectsLocationsRegistriesDevicesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesCreateCall {
  2434. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2435. return c
  2436. }
  2437. // Context sets the context to be used in this call's Do method. Any
  2438. // pending HTTP request will be aborted if the provided context is
  2439. // canceled.
  2440. func (c *ProjectsLocationsRegistriesDevicesCreateCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesCreateCall {
  2441. c.ctx_ = ctx
  2442. return c
  2443. }
  2444. // Header returns an http.Header that can be modified by the caller to
  2445. // add HTTP headers to the request.
  2446. func (c *ProjectsLocationsRegistriesDevicesCreateCall) Header() http.Header {
  2447. if c.header_ == nil {
  2448. c.header_ = make(http.Header)
  2449. }
  2450. return c.header_
  2451. }
  2452. func (c *ProjectsLocationsRegistriesDevicesCreateCall) doRequest(alt string) (*http.Response, error) {
  2453. reqHeaders := make(http.Header)
  2454. for k, v := range c.header_ {
  2455. reqHeaders[k] = v
  2456. }
  2457. reqHeaders.Set("User-Agent", c.s.userAgent())
  2458. var body io.Reader = nil
  2459. body, err := googleapi.WithoutDataWrapper.JSONReader(c.device)
  2460. if err != nil {
  2461. return nil, err
  2462. }
  2463. reqHeaders.Set("Content-Type", "application/json")
  2464. c.urlParams_.Set("alt", alt)
  2465. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices")
  2466. urls += "?" + c.urlParams_.Encode()
  2467. req, _ := http.NewRequest("POST", urls, body)
  2468. req.Header = reqHeaders
  2469. googleapi.Expand(req.URL, map[string]string{
  2470. "parent": c.parent,
  2471. })
  2472. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2473. }
  2474. // Do executes the "cloudiot.projects.locations.registries.devices.create" call.
  2475. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  2476. // code is an error. Response headers are in either
  2477. // *Device.ServerResponse.Header or (if a response was returned at all)
  2478. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2479. // check whether the returned error was because http.StatusNotModified
  2480. // was returned.
  2481. func (c *ProjectsLocationsRegistriesDevicesCreateCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  2482. gensupport.SetOptions(c.urlParams_, opts...)
  2483. res, err := c.doRequest("json")
  2484. if res != nil && res.StatusCode == http.StatusNotModified {
  2485. if res.Body != nil {
  2486. res.Body.Close()
  2487. }
  2488. return nil, &googleapi.Error{
  2489. Code: res.StatusCode,
  2490. Header: res.Header,
  2491. }
  2492. }
  2493. if err != nil {
  2494. return nil, err
  2495. }
  2496. defer googleapi.CloseBody(res)
  2497. if err := googleapi.CheckResponse(res); err != nil {
  2498. return nil, err
  2499. }
  2500. ret := &Device{
  2501. ServerResponse: googleapi.ServerResponse{
  2502. Header: res.Header,
  2503. HTTPStatusCode: res.StatusCode,
  2504. },
  2505. }
  2506. target := &ret
  2507. if err := gensupport.DecodeResponse(target, res); err != nil {
  2508. return nil, err
  2509. }
  2510. return ret, nil
  2511. // {
  2512. // "description": "Creates a device in a device registry.",
  2513. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices",
  2514. // "httpMethod": "POST",
  2515. // "id": "cloudiot.projects.locations.registries.devices.create",
  2516. // "parameterOrder": [
  2517. // "parent"
  2518. // ],
  2519. // "parameters": {
  2520. // "parent": {
  2521. // "description": "The name of the device registry where this device should be created.\nFor example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  2522. // "location": "path",
  2523. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2524. // "required": true,
  2525. // "type": "string"
  2526. // }
  2527. // },
  2528. // "path": "v1/{+parent}/devices",
  2529. // "request": {
  2530. // "$ref": "Device"
  2531. // },
  2532. // "response": {
  2533. // "$ref": "Device"
  2534. // },
  2535. // "scopes": [
  2536. // "https://www.googleapis.com/auth/cloud-platform",
  2537. // "https://www.googleapis.com/auth/cloudiot"
  2538. // ]
  2539. // }
  2540. }
  2541. // method id "cloudiot.projects.locations.registries.devices.delete":
  2542. type ProjectsLocationsRegistriesDevicesDeleteCall struct {
  2543. s *Service
  2544. name string
  2545. urlParams_ gensupport.URLParams
  2546. ctx_ context.Context
  2547. header_ http.Header
  2548. }
  2549. // Delete: Deletes a device.
  2550. func (r *ProjectsLocationsRegistriesDevicesService) Delete(name string) *ProjectsLocationsRegistriesDevicesDeleteCall {
  2551. c := &ProjectsLocationsRegistriesDevicesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2552. c.name = name
  2553. return c
  2554. }
  2555. // Fields allows partial responses to be retrieved. See
  2556. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2557. // for more information.
  2558. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesDeleteCall {
  2559. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2560. return c
  2561. }
  2562. // Context sets the context to be used in this call's Do method. Any
  2563. // pending HTTP request will be aborted if the provided context is
  2564. // canceled.
  2565. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesDeleteCall {
  2566. c.ctx_ = ctx
  2567. return c
  2568. }
  2569. // Header returns an http.Header that can be modified by the caller to
  2570. // add HTTP headers to the request.
  2571. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Header() http.Header {
  2572. if c.header_ == nil {
  2573. c.header_ = make(http.Header)
  2574. }
  2575. return c.header_
  2576. }
  2577. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2578. reqHeaders := make(http.Header)
  2579. for k, v := range c.header_ {
  2580. reqHeaders[k] = v
  2581. }
  2582. reqHeaders.Set("User-Agent", c.s.userAgent())
  2583. var body io.Reader = nil
  2584. c.urlParams_.Set("alt", alt)
  2585. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2586. urls += "?" + c.urlParams_.Encode()
  2587. req, _ := http.NewRequest("DELETE", urls, body)
  2588. req.Header = reqHeaders
  2589. googleapi.Expand(req.URL, map[string]string{
  2590. "name": c.name,
  2591. })
  2592. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2593. }
  2594. // Do executes the "cloudiot.projects.locations.registries.devices.delete" call.
  2595. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2596. // code is an error. Response headers are in either
  2597. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2598. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2599. // check whether the returned error was because http.StatusNotModified
  2600. // was returned.
  2601. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2602. gensupport.SetOptions(c.urlParams_, opts...)
  2603. res, err := c.doRequest("json")
  2604. if res != nil && res.StatusCode == http.StatusNotModified {
  2605. if res.Body != nil {
  2606. res.Body.Close()
  2607. }
  2608. return nil, &googleapi.Error{
  2609. Code: res.StatusCode,
  2610. Header: res.Header,
  2611. }
  2612. }
  2613. if err != nil {
  2614. return nil, err
  2615. }
  2616. defer googleapi.CloseBody(res)
  2617. if err := googleapi.CheckResponse(res); err != nil {
  2618. return nil, err
  2619. }
  2620. ret := &Empty{
  2621. ServerResponse: googleapi.ServerResponse{
  2622. Header: res.Header,
  2623. HTTPStatusCode: res.StatusCode,
  2624. },
  2625. }
  2626. target := &ret
  2627. if err := gensupport.DecodeResponse(target, res); err != nil {
  2628. return nil, err
  2629. }
  2630. return ret, nil
  2631. // {
  2632. // "description": "Deletes a device.",
  2633. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}",
  2634. // "httpMethod": "DELETE",
  2635. // "id": "cloudiot.projects.locations.registries.devices.delete",
  2636. // "parameterOrder": [
  2637. // "name"
  2638. // ],
  2639. // "parameters": {
  2640. // "name": {
  2641. // "description": "The name of the device. For example,\n`projects/p0/locations/us-central1/registries/registry0/devices/device0` or\n`projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.",
  2642. // "location": "path",
  2643. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  2644. // "required": true,
  2645. // "type": "string"
  2646. // }
  2647. // },
  2648. // "path": "v1/{+name}",
  2649. // "response": {
  2650. // "$ref": "Empty"
  2651. // },
  2652. // "scopes": [
  2653. // "https://www.googleapis.com/auth/cloud-platform",
  2654. // "https://www.googleapis.com/auth/cloudiot"
  2655. // ]
  2656. // }
  2657. }
  2658. // method id "cloudiot.projects.locations.registries.devices.get":
  2659. type ProjectsLocationsRegistriesDevicesGetCall struct {
  2660. s *Service
  2661. name string
  2662. urlParams_ gensupport.URLParams
  2663. ifNoneMatch_ string
  2664. ctx_ context.Context
  2665. header_ http.Header
  2666. }
  2667. // Get: Gets details about a device.
  2668. func (r *ProjectsLocationsRegistriesDevicesService) Get(name string) *ProjectsLocationsRegistriesDevicesGetCall {
  2669. c := &ProjectsLocationsRegistriesDevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2670. c.name = name
  2671. return c
  2672. }
  2673. // FieldMask sets the optional parameter "fieldMask": The fields of the
  2674. // `Device` resource to be returned in the response. If the
  2675. // field mask is unset or empty, all fields are returned.
  2676. func (c *ProjectsLocationsRegistriesDevicesGetCall) FieldMask(fieldMask string) *ProjectsLocationsRegistriesDevicesGetCall {
  2677. c.urlParams_.Set("fieldMask", fieldMask)
  2678. return c
  2679. }
  2680. // Fields allows partial responses to be retrieved. See
  2681. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2682. // for more information.
  2683. func (c *ProjectsLocationsRegistriesDevicesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesGetCall {
  2684. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2685. return c
  2686. }
  2687. // IfNoneMatch sets the optional parameter which makes the operation
  2688. // fail if the object's ETag matches the given value. This is useful for
  2689. // getting updates only after the object has changed since the last
  2690. // request. Use googleapi.IsNotModified to check whether the response
  2691. // error from Do is the result of In-None-Match.
  2692. func (c *ProjectsLocationsRegistriesDevicesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesGetCall {
  2693. c.ifNoneMatch_ = entityTag
  2694. return c
  2695. }
  2696. // Context sets the context to be used in this call's Do method. Any
  2697. // pending HTTP request will be aborted if the provided context is
  2698. // canceled.
  2699. func (c *ProjectsLocationsRegistriesDevicesGetCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesGetCall {
  2700. c.ctx_ = ctx
  2701. return c
  2702. }
  2703. // Header returns an http.Header that can be modified by the caller to
  2704. // add HTTP headers to the request.
  2705. func (c *ProjectsLocationsRegistriesDevicesGetCall) Header() http.Header {
  2706. if c.header_ == nil {
  2707. c.header_ = make(http.Header)
  2708. }
  2709. return c.header_
  2710. }
  2711. func (c *ProjectsLocationsRegistriesDevicesGetCall) doRequest(alt string) (*http.Response, error) {
  2712. reqHeaders := make(http.Header)
  2713. for k, v := range c.header_ {
  2714. reqHeaders[k] = v
  2715. }
  2716. reqHeaders.Set("User-Agent", c.s.userAgent())
  2717. if c.ifNoneMatch_ != "" {
  2718. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2719. }
  2720. var body io.Reader = nil
  2721. c.urlParams_.Set("alt", alt)
  2722. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2723. urls += "?" + c.urlParams_.Encode()
  2724. req, _ := http.NewRequest("GET", urls, body)
  2725. req.Header = reqHeaders
  2726. googleapi.Expand(req.URL, map[string]string{
  2727. "name": c.name,
  2728. })
  2729. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2730. }
  2731. // Do executes the "cloudiot.projects.locations.registries.devices.get" call.
  2732. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  2733. // code is an error. Response headers are in either
  2734. // *Device.ServerResponse.Header or (if a response was returned at all)
  2735. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2736. // check whether the returned error was because http.StatusNotModified
  2737. // was returned.
  2738. func (c *ProjectsLocationsRegistriesDevicesGetCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  2739. gensupport.SetOptions(c.urlParams_, opts...)
  2740. res, err := c.doRequest("json")
  2741. if res != nil && res.StatusCode == http.StatusNotModified {
  2742. if res.Body != nil {
  2743. res.Body.Close()
  2744. }
  2745. return nil, &googleapi.Error{
  2746. Code: res.StatusCode,
  2747. Header: res.Header,
  2748. }
  2749. }
  2750. if err != nil {
  2751. return nil, err
  2752. }
  2753. defer googleapi.CloseBody(res)
  2754. if err := googleapi.CheckResponse(res); err != nil {
  2755. return nil, err
  2756. }
  2757. ret := &Device{
  2758. ServerResponse: googleapi.ServerResponse{
  2759. Header: res.Header,
  2760. HTTPStatusCode: res.StatusCode,
  2761. },
  2762. }
  2763. target := &ret
  2764. if err := gensupport.DecodeResponse(target, res); err != nil {
  2765. return nil, err
  2766. }
  2767. return ret, nil
  2768. // {
  2769. // "description": "Gets details about a device.",
  2770. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}",
  2771. // "httpMethod": "GET",
  2772. // "id": "cloudiot.projects.locations.registries.devices.get",
  2773. // "parameterOrder": [
  2774. // "name"
  2775. // ],
  2776. // "parameters": {
  2777. // "fieldMask": {
  2778. // "description": "The fields of the `Device` resource to be returned in the response. If the\nfield mask is unset or empty, all fields are returned.",
  2779. // "format": "google-fieldmask",
  2780. // "location": "query",
  2781. // "type": "string"
  2782. // },
  2783. // "name": {
  2784. // "description": "The name of the device. For example,\n`projects/p0/locations/us-central1/registries/registry0/devices/device0` or\n`projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.",
  2785. // "location": "path",
  2786. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  2787. // "required": true,
  2788. // "type": "string"
  2789. // }
  2790. // },
  2791. // "path": "v1/{+name}",
  2792. // "response": {
  2793. // "$ref": "Device"
  2794. // },
  2795. // "scopes": [
  2796. // "https://www.googleapis.com/auth/cloud-platform",
  2797. // "https://www.googleapis.com/auth/cloudiot"
  2798. // ]
  2799. // }
  2800. }
  2801. // method id "cloudiot.projects.locations.registries.devices.list":
  2802. type ProjectsLocationsRegistriesDevicesListCall struct {
  2803. s *Service
  2804. parent string
  2805. urlParams_ gensupport.URLParams
  2806. ifNoneMatch_ string
  2807. ctx_ context.Context
  2808. header_ http.Header
  2809. }
  2810. // List: List devices in a device registry.
  2811. func (r *ProjectsLocationsRegistriesDevicesService) List(parent string) *ProjectsLocationsRegistriesDevicesListCall {
  2812. c := &ProjectsLocationsRegistriesDevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2813. c.parent = parent
  2814. return c
  2815. }
  2816. // DeviceIds sets the optional parameter "deviceIds": A list of device
  2817. // string identifiers. If empty, it will ignore this field.
  2818. // For example, `['device0', 'device12']`. This field cannot hold more
  2819. // than
  2820. // 10,000 entries.
  2821. func (c *ProjectsLocationsRegistriesDevicesListCall) DeviceIds(deviceIds ...string) *ProjectsLocationsRegistriesDevicesListCall {
  2822. c.urlParams_.SetMulti("deviceIds", append([]string{}, deviceIds...))
  2823. return c
  2824. }
  2825. // DeviceNumIds sets the optional parameter "deviceNumIds": A list of
  2826. // device numerical ids. If empty, it will ignore this field. This
  2827. // field cannot hold more than 10,000 entries.
  2828. func (c *ProjectsLocationsRegistriesDevicesListCall) DeviceNumIds(deviceNumIds ...uint64) *ProjectsLocationsRegistriesDevicesListCall {
  2829. var deviceNumIds_ []string
  2830. for _, v := range deviceNumIds {
  2831. deviceNumIds_ = append(deviceNumIds_, fmt.Sprint(v))
  2832. }
  2833. c.urlParams_.SetMulti("deviceNumIds", deviceNumIds_)
  2834. return c
  2835. }
  2836. // FieldMask sets the optional parameter "fieldMask": The fields of the
  2837. // `Device` resource to be returned in the response. The
  2838. // fields `id`, and `num_id` are always returned by default, along with
  2839. // any
  2840. // other fields specified.
  2841. func (c *ProjectsLocationsRegistriesDevicesListCall) FieldMask(fieldMask string) *ProjectsLocationsRegistriesDevicesListCall {
  2842. c.urlParams_.Set("fieldMask", fieldMask)
  2843. return c
  2844. }
  2845. // PageSize sets the optional parameter "pageSize": The maximum number
  2846. // of devices to return in the response. If this value
  2847. // is zero, the service will select a default size. A call may return
  2848. // fewer
  2849. // objects than requested, but if there is a non-empty `page_token`,
  2850. // it
  2851. // indicates that more entries are available.
  2852. func (c *ProjectsLocationsRegistriesDevicesListCall) PageSize(pageSize int64) *ProjectsLocationsRegistriesDevicesListCall {
  2853. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2854. return c
  2855. }
  2856. // PageToken sets the optional parameter "pageToken": The value returned
  2857. // by the last `ListDevicesResponse`; indicates
  2858. // that this is a continuation of a prior `ListDevices` call, and
  2859. // that the system should return the next page of data.
  2860. func (c *ProjectsLocationsRegistriesDevicesListCall) PageToken(pageToken string) *ProjectsLocationsRegistriesDevicesListCall {
  2861. c.urlParams_.Set("pageToken", pageToken)
  2862. return c
  2863. }
  2864. // Fields allows partial responses to be retrieved. See
  2865. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2866. // for more information.
  2867. func (c *ProjectsLocationsRegistriesDevicesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesListCall {
  2868. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2869. return c
  2870. }
  2871. // IfNoneMatch sets the optional parameter which makes the operation
  2872. // fail if the object's ETag matches the given value. This is useful for
  2873. // getting updates only after the object has changed since the last
  2874. // request. Use googleapi.IsNotModified to check whether the response
  2875. // error from Do is the result of In-None-Match.
  2876. func (c *ProjectsLocationsRegistriesDevicesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesListCall {
  2877. c.ifNoneMatch_ = entityTag
  2878. return c
  2879. }
  2880. // Context sets the context to be used in this call's Do method. Any
  2881. // pending HTTP request will be aborted if the provided context is
  2882. // canceled.
  2883. func (c *ProjectsLocationsRegistriesDevicesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesListCall {
  2884. c.ctx_ = ctx
  2885. return c
  2886. }
  2887. // Header returns an http.Header that can be modified by the caller to
  2888. // add HTTP headers to the request.
  2889. func (c *ProjectsLocationsRegistriesDevicesListCall) Header() http.Header {
  2890. if c.header_ == nil {
  2891. c.header_ = make(http.Header)
  2892. }
  2893. return c.header_
  2894. }
  2895. func (c *ProjectsLocationsRegistriesDevicesListCall) doRequest(alt string) (*http.Response, error) {
  2896. reqHeaders := make(http.Header)
  2897. for k, v := range c.header_ {
  2898. reqHeaders[k] = v
  2899. }
  2900. reqHeaders.Set("User-Agent", c.s.userAgent())
  2901. if c.ifNoneMatch_ != "" {
  2902. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2903. }
  2904. var body io.Reader = nil
  2905. c.urlParams_.Set("alt", alt)
  2906. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices")
  2907. urls += "?" + c.urlParams_.Encode()
  2908. req, _ := http.NewRequest("GET", urls, body)
  2909. req.Header = reqHeaders
  2910. googleapi.Expand(req.URL, map[string]string{
  2911. "parent": c.parent,
  2912. })
  2913. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2914. }
  2915. // Do executes the "cloudiot.projects.locations.registries.devices.list" call.
  2916. // Exactly one of *ListDevicesResponse or error will be non-nil. Any
  2917. // non-2xx status code is an error. Response headers are in either
  2918. // *ListDevicesResponse.ServerResponse.Header or (if a response was
  2919. // returned at all) in error.(*googleapi.Error).Header. Use
  2920. // googleapi.IsNotModified to check whether the returned error was
  2921. // because http.StatusNotModified was returned.
  2922. func (c *ProjectsLocationsRegistriesDevicesListCall) Do(opts ...googleapi.CallOption) (*ListDevicesResponse, error) {
  2923. gensupport.SetOptions(c.urlParams_, opts...)
  2924. res, err := c.doRequest("json")
  2925. if res != nil && res.StatusCode == http.StatusNotModified {
  2926. if res.Body != nil {
  2927. res.Body.Close()
  2928. }
  2929. return nil, &googleapi.Error{
  2930. Code: res.StatusCode,
  2931. Header: res.Header,
  2932. }
  2933. }
  2934. if err != nil {
  2935. return nil, err
  2936. }
  2937. defer googleapi.CloseBody(res)
  2938. if err := googleapi.CheckResponse(res); err != nil {
  2939. return nil, err
  2940. }
  2941. ret := &ListDevicesResponse{
  2942. ServerResponse: googleapi.ServerResponse{
  2943. Header: res.Header,
  2944. HTTPStatusCode: res.StatusCode,
  2945. },
  2946. }
  2947. target := &ret
  2948. if err := gensupport.DecodeResponse(target, res); err != nil {
  2949. return nil, err
  2950. }
  2951. return ret, nil
  2952. // {
  2953. // "description": "List devices in a device registry.",
  2954. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices",
  2955. // "httpMethod": "GET",
  2956. // "id": "cloudiot.projects.locations.registries.devices.list",
  2957. // "parameterOrder": [
  2958. // "parent"
  2959. // ],
  2960. // "parameters": {
  2961. // "deviceIds": {
  2962. // "description": "A list of device string identifiers. If empty, it will ignore this field.\nFor example, `['device0', 'device12']`. This field cannot hold more than\n10,000 entries.",
  2963. // "location": "query",
  2964. // "repeated": true,
  2965. // "type": "string"
  2966. // },
  2967. // "deviceNumIds": {
  2968. // "description": "A list of device numerical ids. If empty, it will ignore this field. This\nfield cannot hold more than 10,000 entries.",
  2969. // "format": "uint64",
  2970. // "location": "query",
  2971. // "repeated": true,
  2972. // "type": "string"
  2973. // },
  2974. // "fieldMask": {
  2975. // "description": "The fields of the `Device` resource to be returned in the response. The\nfields `id`, and `num_id` are always returned by default, along with any\nother fields specified.",
  2976. // "format": "google-fieldmask",
  2977. // "location": "query",
  2978. // "type": "string"
  2979. // },
  2980. // "pageSize": {
  2981. // "description": "The maximum number of devices to return in the response. If this value\nis zero, the service will select a default size. A call may return fewer\nobjects than requested, but if there is a non-empty `page_token`, it\nindicates that more entries are available.",
  2982. // "format": "int32",
  2983. // "location": "query",
  2984. // "type": "integer"
  2985. // },
  2986. // "pageToken": {
  2987. // "description": "The value returned by the last `ListDevicesResponse`; indicates\nthat this is a continuation of a prior `ListDevices` call, and\nthat the system should return the next page of data.",
  2988. // "location": "query",
  2989. // "type": "string"
  2990. // },
  2991. // "parent": {
  2992. // "description": "The device registry path. Required. For example,\n`projects/my-project/locations/us-central1/registries/my-registry`.",
  2993. // "location": "path",
  2994. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2995. // "required": true,
  2996. // "type": "string"
  2997. // }
  2998. // },
  2999. // "path": "v1/{+parent}/devices",
  3000. // "response": {
  3001. // "$ref": "ListDevicesResponse"
  3002. // },
  3003. // "scopes": [
  3004. // "https://www.googleapis.com/auth/cloud-platform",
  3005. // "https://www.googleapis.com/auth/cloudiot"
  3006. // ]
  3007. // }
  3008. }
  3009. // Pages invokes f for each page of results.
  3010. // A non-nil error returned from f will halt the iteration.
  3011. // The provided context supersedes any context provided to the Context method.
  3012. func (c *ProjectsLocationsRegistriesDevicesListCall) Pages(ctx context.Context, f func(*ListDevicesResponse) error) error {
  3013. c.ctx_ = ctx
  3014. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3015. for {
  3016. x, err := c.Do()
  3017. if err != nil {
  3018. return err
  3019. }
  3020. if err := f(x); err != nil {
  3021. return err
  3022. }
  3023. if x.NextPageToken == "" {
  3024. return nil
  3025. }
  3026. c.PageToken(x.NextPageToken)
  3027. }
  3028. }
  3029. // method id "cloudiot.projects.locations.registries.devices.modifyCloudToDeviceConfig":
  3030. type ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall struct {
  3031. s *Service
  3032. name string
  3033. modifycloudtodeviceconfigrequest *ModifyCloudToDeviceConfigRequest
  3034. urlParams_ gensupport.URLParams
  3035. ctx_ context.Context
  3036. header_ http.Header
  3037. }
  3038. // ModifyCloudToDeviceConfig: Modifies the configuration for the device,
  3039. // which is eventually sent from
  3040. // the Cloud IoT Core servers. Returns the modified configuration
  3041. // version and
  3042. // its metadata.
  3043. func (r *ProjectsLocationsRegistriesDevicesService) ModifyCloudToDeviceConfig(name string, modifycloudtodeviceconfigrequest *ModifyCloudToDeviceConfigRequest) *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall {
  3044. c := &ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3045. c.name = name
  3046. c.modifycloudtodeviceconfigrequest = modifycloudtodeviceconfigrequest
  3047. return c
  3048. }
  3049. // Fields allows partial responses to be retrieved. See
  3050. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3051. // for more information.
  3052. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall {
  3053. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3054. return c
  3055. }
  3056. // Context sets the context to be used in this call's Do method. Any
  3057. // pending HTTP request will be aborted if the provided context is
  3058. // canceled.
  3059. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall {
  3060. c.ctx_ = ctx
  3061. return c
  3062. }
  3063. // Header returns an http.Header that can be modified by the caller to
  3064. // add HTTP headers to the request.
  3065. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Header() http.Header {
  3066. if c.header_ == nil {
  3067. c.header_ = make(http.Header)
  3068. }
  3069. return c.header_
  3070. }
  3071. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) doRequest(alt string) (*http.Response, error) {
  3072. reqHeaders := make(http.Header)
  3073. for k, v := range c.header_ {
  3074. reqHeaders[k] = v
  3075. }
  3076. reqHeaders.Set("User-Agent", c.s.userAgent())
  3077. var body io.Reader = nil
  3078. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycloudtodeviceconfigrequest)
  3079. if err != nil {
  3080. return nil, err
  3081. }
  3082. reqHeaders.Set("Content-Type", "application/json")
  3083. c.urlParams_.Set("alt", alt)
  3084. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:modifyCloudToDeviceConfig")
  3085. urls += "?" + c.urlParams_.Encode()
  3086. req, _ := http.NewRequest("POST", urls, body)
  3087. req.Header = reqHeaders
  3088. googleapi.Expand(req.URL, map[string]string{
  3089. "name": c.name,
  3090. })
  3091. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3092. }
  3093. // Do executes the "cloudiot.projects.locations.registries.devices.modifyCloudToDeviceConfig" call.
  3094. // Exactly one of *DeviceConfig or error will be non-nil. Any non-2xx
  3095. // status code is an error. Response headers are in either
  3096. // *DeviceConfig.ServerResponse.Header or (if a response was returned at
  3097. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3098. // to check whether the returned error was because
  3099. // http.StatusNotModified was returned.
  3100. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Do(opts ...googleapi.CallOption) (*DeviceConfig, error) {
  3101. gensupport.SetOptions(c.urlParams_, opts...)
  3102. res, err := c.doRequest("json")
  3103. if res != nil && res.StatusCode == http.StatusNotModified {
  3104. if res.Body != nil {
  3105. res.Body.Close()
  3106. }
  3107. return nil, &googleapi.Error{
  3108. Code: res.StatusCode,
  3109. Header: res.Header,
  3110. }
  3111. }
  3112. if err != nil {
  3113. return nil, err
  3114. }
  3115. defer googleapi.CloseBody(res)
  3116. if err := googleapi.CheckResponse(res); err != nil {
  3117. return nil, err
  3118. }
  3119. ret := &DeviceConfig{
  3120. ServerResponse: googleapi.ServerResponse{
  3121. Header: res.Header,
  3122. HTTPStatusCode: res.StatusCode,
  3123. },
  3124. }
  3125. target := &ret
  3126. if err := gensupport.DecodeResponse(target, res); err != nil {
  3127. return nil, err
  3128. }
  3129. return ret, nil
  3130. // {
  3131. // "description": "Modifies the configuration for the device, which is eventually sent from\nthe Cloud IoT Core servers. Returns the modified configuration version and\nits metadata.",
  3132. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}:modifyCloudToDeviceConfig",
  3133. // "httpMethod": "POST",
  3134. // "id": "cloudiot.projects.locations.registries.devices.modifyCloudToDeviceConfig",
  3135. // "parameterOrder": [
  3136. // "name"
  3137. // ],
  3138. // "parameters": {
  3139. // "name": {
  3140. // "description": "The name of the device. For example,\n`projects/p0/locations/us-central1/registries/registry0/devices/device0` or\n`projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.",
  3141. // "location": "path",
  3142. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  3143. // "required": true,
  3144. // "type": "string"
  3145. // }
  3146. // },
  3147. // "path": "v1/{+name}:modifyCloudToDeviceConfig",
  3148. // "request": {
  3149. // "$ref": "ModifyCloudToDeviceConfigRequest"
  3150. // },
  3151. // "response": {
  3152. // "$ref": "DeviceConfig"
  3153. // },
  3154. // "scopes": [
  3155. // "https://www.googleapis.com/auth/cloud-platform",
  3156. // "https://www.googleapis.com/auth/cloudiot"
  3157. // ]
  3158. // }
  3159. }
  3160. // method id "cloudiot.projects.locations.registries.devices.patch":
  3161. type ProjectsLocationsRegistriesDevicesPatchCall struct {
  3162. s *Service
  3163. name string
  3164. device *Device
  3165. urlParams_ gensupport.URLParams
  3166. ctx_ context.Context
  3167. header_ http.Header
  3168. }
  3169. // Patch: Updates a device.
  3170. func (r *ProjectsLocationsRegistriesDevicesService) Patch(name string, device *Device) *ProjectsLocationsRegistriesDevicesPatchCall {
  3171. c := &ProjectsLocationsRegistriesDevicesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3172. c.name = name
  3173. c.device = device
  3174. return c
  3175. }
  3176. // UpdateMask sets the optional parameter "updateMask": Only updates the
  3177. // `device` fields indicated by this mask.
  3178. // The field mask must not be empty, and it must not contain fields
  3179. // that
  3180. // are immutable or only set by the server.
  3181. // Mutable top-level fields: `credentials`, `blocked`, and `metadata`
  3182. func (c *ProjectsLocationsRegistriesDevicesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsRegistriesDevicesPatchCall {
  3183. c.urlParams_.Set("updateMask", updateMask)
  3184. return c
  3185. }
  3186. // Fields allows partial responses to be retrieved. See
  3187. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3188. // for more information.
  3189. func (c *ProjectsLocationsRegistriesDevicesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesPatchCall {
  3190. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3191. return c
  3192. }
  3193. // Context sets the context to be used in this call's Do method. Any
  3194. // pending HTTP request will be aborted if the provided context is
  3195. // canceled.
  3196. func (c *ProjectsLocationsRegistriesDevicesPatchCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesPatchCall {
  3197. c.ctx_ = ctx
  3198. return c
  3199. }
  3200. // Header returns an http.Header that can be modified by the caller to
  3201. // add HTTP headers to the request.
  3202. func (c *ProjectsLocationsRegistriesDevicesPatchCall) Header() http.Header {
  3203. if c.header_ == nil {
  3204. c.header_ = make(http.Header)
  3205. }
  3206. return c.header_
  3207. }
  3208. func (c *ProjectsLocationsRegistriesDevicesPatchCall) doRequest(alt string) (*http.Response, error) {
  3209. reqHeaders := make(http.Header)
  3210. for k, v := range c.header_ {
  3211. reqHeaders[k] = v
  3212. }
  3213. reqHeaders.Set("User-Agent", c.s.userAgent())
  3214. var body io.Reader = nil
  3215. body, err := googleapi.WithoutDataWrapper.JSONReader(c.device)
  3216. if err != nil {
  3217. return nil, err
  3218. }
  3219. reqHeaders.Set("Content-Type", "application/json")
  3220. c.urlParams_.Set("alt", alt)
  3221. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3222. urls += "?" + c.urlParams_.Encode()
  3223. req, _ := http.NewRequest("PATCH", urls, body)
  3224. req.Header = reqHeaders
  3225. googleapi.Expand(req.URL, map[string]string{
  3226. "name": c.name,
  3227. })
  3228. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3229. }
  3230. // Do executes the "cloudiot.projects.locations.registries.devices.patch" call.
  3231. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  3232. // code is an error. Response headers are in either
  3233. // *Device.ServerResponse.Header or (if a response was returned at all)
  3234. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3235. // check whether the returned error was because http.StatusNotModified
  3236. // was returned.
  3237. func (c *ProjectsLocationsRegistriesDevicesPatchCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  3238. gensupport.SetOptions(c.urlParams_, opts...)
  3239. res, err := c.doRequest("json")
  3240. if res != nil && res.StatusCode == http.StatusNotModified {
  3241. if res.Body != nil {
  3242. res.Body.Close()
  3243. }
  3244. return nil, &googleapi.Error{
  3245. Code: res.StatusCode,
  3246. Header: res.Header,
  3247. }
  3248. }
  3249. if err != nil {
  3250. return nil, err
  3251. }
  3252. defer googleapi.CloseBody(res)
  3253. if err := googleapi.CheckResponse(res); err != nil {
  3254. return nil, err
  3255. }
  3256. ret := &Device{
  3257. ServerResponse: googleapi.ServerResponse{
  3258. Header: res.Header,
  3259. HTTPStatusCode: res.StatusCode,
  3260. },
  3261. }
  3262. target := &ret
  3263. if err := gensupport.DecodeResponse(target, res); err != nil {
  3264. return nil, err
  3265. }
  3266. return ret, nil
  3267. // {
  3268. // "description": "Updates a device.",
  3269. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}",
  3270. // "httpMethod": "PATCH",
  3271. // "id": "cloudiot.projects.locations.registries.devices.patch",
  3272. // "parameterOrder": [
  3273. // "name"
  3274. // ],
  3275. // "parameters": {
  3276. // "name": {
  3277. // "description": "The resource path name. For example,\n`projects/p1/locations/us-central1/registries/registry0/devices/dev0` or\n`projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.\nWhen `name` is populated as a response from the service, it always ends\nin the device numeric ID.",
  3278. // "location": "path",
  3279. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  3280. // "required": true,
  3281. // "type": "string"
  3282. // },
  3283. // "updateMask": {
  3284. // "description": "Only updates the `device` fields indicated by this mask.\nThe field mask must not be empty, and it must not contain fields that\nare immutable or only set by the server.\nMutable top-level fields: `credentials`, `blocked`, and `metadata`",
  3285. // "format": "google-fieldmask",
  3286. // "location": "query",
  3287. // "type": "string"
  3288. // }
  3289. // },
  3290. // "path": "v1/{+name}",
  3291. // "request": {
  3292. // "$ref": "Device"
  3293. // },
  3294. // "response": {
  3295. // "$ref": "Device"
  3296. // },
  3297. // "scopes": [
  3298. // "https://www.googleapis.com/auth/cloud-platform",
  3299. // "https://www.googleapis.com/auth/cloudiot"
  3300. // ]
  3301. // }
  3302. }
  3303. // method id "cloudiot.projects.locations.registries.devices.configVersions.list":
  3304. type ProjectsLocationsRegistriesDevicesConfigVersionsListCall struct {
  3305. s *Service
  3306. name string
  3307. urlParams_ gensupport.URLParams
  3308. ifNoneMatch_ string
  3309. ctx_ context.Context
  3310. header_ http.Header
  3311. }
  3312. // List: Lists the last few versions of the device configuration in
  3313. // descending
  3314. // order (i.e.: newest first).
  3315. func (r *ProjectsLocationsRegistriesDevicesConfigVersionsService) List(name string) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  3316. c := &ProjectsLocationsRegistriesDevicesConfigVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3317. c.name = name
  3318. return c
  3319. }
  3320. // NumVersions sets the optional parameter "numVersions": The number of
  3321. // versions to list. Versions are listed in decreasing order of
  3322. // the version number. The maximum number of versions retained is 10. If
  3323. // this
  3324. // value is zero, it will return all the versions available.
  3325. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) NumVersions(numVersions int64) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  3326. c.urlParams_.Set("numVersions", fmt.Sprint(numVersions))
  3327. return c
  3328. }
  3329. // Fields allows partial responses to be retrieved. See
  3330. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3331. // for more information.
  3332. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  3333. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3334. return c
  3335. }
  3336. // IfNoneMatch sets the optional parameter which makes the operation
  3337. // fail if the object's ETag matches the given value. This is useful for
  3338. // getting updates only after the object has changed since the last
  3339. // request. Use googleapi.IsNotModified to check whether the response
  3340. // error from Do is the result of In-None-Match.
  3341. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  3342. c.ifNoneMatch_ = entityTag
  3343. return c
  3344. }
  3345. // Context sets the context to be used in this call's Do method. Any
  3346. // pending HTTP request will be aborted if the provided context is
  3347. // canceled.
  3348. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  3349. c.ctx_ = ctx
  3350. return c
  3351. }
  3352. // Header returns an http.Header that can be modified by the caller to
  3353. // add HTTP headers to the request.
  3354. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Header() http.Header {
  3355. if c.header_ == nil {
  3356. c.header_ = make(http.Header)
  3357. }
  3358. return c.header_
  3359. }
  3360. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) doRequest(alt string) (*http.Response, error) {
  3361. reqHeaders := make(http.Header)
  3362. for k, v := range c.header_ {
  3363. reqHeaders[k] = v
  3364. }
  3365. reqHeaders.Set("User-Agent", c.s.userAgent())
  3366. if c.ifNoneMatch_ != "" {
  3367. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3368. }
  3369. var body io.Reader = nil
  3370. c.urlParams_.Set("alt", alt)
  3371. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/configVersions")
  3372. urls += "?" + c.urlParams_.Encode()
  3373. req, _ := http.NewRequest("GET", urls, body)
  3374. req.Header = reqHeaders
  3375. googleapi.Expand(req.URL, map[string]string{
  3376. "name": c.name,
  3377. })
  3378. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3379. }
  3380. // Do executes the "cloudiot.projects.locations.registries.devices.configVersions.list" call.
  3381. // Exactly one of *ListDeviceConfigVersionsResponse or error will be
  3382. // non-nil. Any non-2xx status code is an error. Response headers are in
  3383. // either *ListDeviceConfigVersionsResponse.ServerResponse.Header or (if
  3384. // a response was returned at all) in error.(*googleapi.Error).Header.
  3385. // Use googleapi.IsNotModified to check whether the returned error was
  3386. // because http.StatusNotModified was returned.
  3387. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Do(opts ...googleapi.CallOption) (*ListDeviceConfigVersionsResponse, error) {
  3388. gensupport.SetOptions(c.urlParams_, opts...)
  3389. res, err := c.doRequest("json")
  3390. if res != nil && res.StatusCode == http.StatusNotModified {
  3391. if res.Body != nil {
  3392. res.Body.Close()
  3393. }
  3394. return nil, &googleapi.Error{
  3395. Code: res.StatusCode,
  3396. Header: res.Header,
  3397. }
  3398. }
  3399. if err != nil {
  3400. return nil, err
  3401. }
  3402. defer googleapi.CloseBody(res)
  3403. if err := googleapi.CheckResponse(res); err != nil {
  3404. return nil, err
  3405. }
  3406. ret := &ListDeviceConfigVersionsResponse{
  3407. ServerResponse: googleapi.ServerResponse{
  3408. Header: res.Header,
  3409. HTTPStatusCode: res.StatusCode,
  3410. },
  3411. }
  3412. target := &ret
  3413. if err := gensupport.DecodeResponse(target, res); err != nil {
  3414. return nil, err
  3415. }
  3416. return ret, nil
  3417. // {
  3418. // "description": "Lists the last few versions of the device configuration in descending\norder (i.e.: newest first).",
  3419. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}/configVersions",
  3420. // "httpMethod": "GET",
  3421. // "id": "cloudiot.projects.locations.registries.devices.configVersions.list",
  3422. // "parameterOrder": [
  3423. // "name"
  3424. // ],
  3425. // "parameters": {
  3426. // "name": {
  3427. // "description": "The name of the device. For example,\n`projects/p0/locations/us-central1/registries/registry0/devices/device0` or\n`projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.",
  3428. // "location": "path",
  3429. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  3430. // "required": true,
  3431. // "type": "string"
  3432. // },
  3433. // "numVersions": {
  3434. // "description": "The number of versions to list. Versions are listed in decreasing order of\nthe version number. The maximum number of versions retained is 10. If this\nvalue is zero, it will return all the versions available.",
  3435. // "format": "int32",
  3436. // "location": "query",
  3437. // "type": "integer"
  3438. // }
  3439. // },
  3440. // "path": "v1/{+name}/configVersions",
  3441. // "response": {
  3442. // "$ref": "ListDeviceConfigVersionsResponse"
  3443. // },
  3444. // "scopes": [
  3445. // "https://www.googleapis.com/auth/cloud-platform",
  3446. // "https://www.googleapis.com/auth/cloudiot"
  3447. // ]
  3448. // }
  3449. }
  3450. // method id "cloudiot.projects.locations.registries.devices.states.list":
  3451. type ProjectsLocationsRegistriesDevicesStatesListCall struct {
  3452. s *Service
  3453. name string
  3454. urlParams_ gensupport.URLParams
  3455. ifNoneMatch_ string
  3456. ctx_ context.Context
  3457. header_ http.Header
  3458. }
  3459. // List: Lists the last few versions of the device state in descending
  3460. // order (i.e.:
  3461. // newest first).
  3462. func (r *ProjectsLocationsRegistriesDevicesStatesService) List(name string) *ProjectsLocationsRegistriesDevicesStatesListCall {
  3463. c := &ProjectsLocationsRegistriesDevicesStatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3464. c.name = name
  3465. return c
  3466. }
  3467. // NumStates sets the optional parameter "numStates": The number of
  3468. // states to list. States are listed in descending order of
  3469. // update time. The maximum number of states retained is 10. If
  3470. // this
  3471. // value is zero, it will return all the states available.
  3472. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) NumStates(numStates int64) *ProjectsLocationsRegistriesDevicesStatesListCall {
  3473. c.urlParams_.Set("numStates", fmt.Sprint(numStates))
  3474. return c
  3475. }
  3476. // Fields allows partial responses to be retrieved. See
  3477. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3478. // for more information.
  3479. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesStatesListCall {
  3480. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3481. return c
  3482. }
  3483. // IfNoneMatch sets the optional parameter which makes the operation
  3484. // fail if the object's ETag matches the given value. This is useful for
  3485. // getting updates only after the object has changed since the last
  3486. // request. Use googleapi.IsNotModified to check whether the response
  3487. // error from Do is the result of In-None-Match.
  3488. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesStatesListCall {
  3489. c.ifNoneMatch_ = entityTag
  3490. return c
  3491. }
  3492. // Context sets the context to be used in this call's Do method. Any
  3493. // pending HTTP request will be aborted if the provided context is
  3494. // canceled.
  3495. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesStatesListCall {
  3496. c.ctx_ = ctx
  3497. return c
  3498. }
  3499. // Header returns an http.Header that can be modified by the caller to
  3500. // add HTTP headers to the request.
  3501. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Header() http.Header {
  3502. if c.header_ == nil {
  3503. c.header_ = make(http.Header)
  3504. }
  3505. return c.header_
  3506. }
  3507. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) doRequest(alt string) (*http.Response, error) {
  3508. reqHeaders := make(http.Header)
  3509. for k, v := range c.header_ {
  3510. reqHeaders[k] = v
  3511. }
  3512. reqHeaders.Set("User-Agent", c.s.userAgent())
  3513. if c.ifNoneMatch_ != "" {
  3514. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3515. }
  3516. var body io.Reader = nil
  3517. c.urlParams_.Set("alt", alt)
  3518. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/states")
  3519. urls += "?" + c.urlParams_.Encode()
  3520. req, _ := http.NewRequest("GET", urls, body)
  3521. req.Header = reqHeaders
  3522. googleapi.Expand(req.URL, map[string]string{
  3523. "name": c.name,
  3524. })
  3525. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3526. }
  3527. // Do executes the "cloudiot.projects.locations.registries.devices.states.list" call.
  3528. // Exactly one of *ListDeviceStatesResponse or error will be non-nil.
  3529. // Any non-2xx status code is an error. Response headers are in either
  3530. // *ListDeviceStatesResponse.ServerResponse.Header or (if a response was
  3531. // returned at all) in error.(*googleapi.Error).Header. Use
  3532. // googleapi.IsNotModified to check whether the returned error was
  3533. // because http.StatusNotModified was returned.
  3534. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Do(opts ...googleapi.CallOption) (*ListDeviceStatesResponse, error) {
  3535. gensupport.SetOptions(c.urlParams_, opts...)
  3536. res, err := c.doRequest("json")
  3537. if res != nil && res.StatusCode == http.StatusNotModified {
  3538. if res.Body != nil {
  3539. res.Body.Close()
  3540. }
  3541. return nil, &googleapi.Error{
  3542. Code: res.StatusCode,
  3543. Header: res.Header,
  3544. }
  3545. }
  3546. if err != nil {
  3547. return nil, err
  3548. }
  3549. defer googleapi.CloseBody(res)
  3550. if err := googleapi.CheckResponse(res); err != nil {
  3551. return nil, err
  3552. }
  3553. ret := &ListDeviceStatesResponse{
  3554. ServerResponse: googleapi.ServerResponse{
  3555. Header: res.Header,
  3556. HTTPStatusCode: res.StatusCode,
  3557. },
  3558. }
  3559. target := &ret
  3560. if err := gensupport.DecodeResponse(target, res); err != nil {
  3561. return nil, err
  3562. }
  3563. return ret, nil
  3564. // {
  3565. // "description": "Lists the last few versions of the device state in descending order (i.e.:\nnewest first).",
  3566. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}/states",
  3567. // "httpMethod": "GET",
  3568. // "id": "cloudiot.projects.locations.registries.devices.states.list",
  3569. // "parameterOrder": [
  3570. // "name"
  3571. // ],
  3572. // "parameters": {
  3573. // "name": {
  3574. // "description": "The name of the device. For example,\n`projects/p0/locations/us-central1/registries/registry0/devices/device0` or\n`projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.",
  3575. // "location": "path",
  3576. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  3577. // "required": true,
  3578. // "type": "string"
  3579. // },
  3580. // "numStates": {
  3581. // "description": "The number of states to list. States are listed in descending order of\nupdate time. The maximum number of states retained is 10. If this\nvalue is zero, it will return all the states available.",
  3582. // "format": "int32",
  3583. // "location": "query",
  3584. // "type": "integer"
  3585. // }
  3586. // },
  3587. // "path": "v1/{+name}/states",
  3588. // "response": {
  3589. // "$ref": "ListDeviceStatesResponse"
  3590. // },
  3591. // "scopes": [
  3592. // "https://www.googleapis.com/auth/cloud-platform",
  3593. // "https://www.googleapis.com/auth/cloudiot"
  3594. // ]
  3595. // }
  3596. }