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.
 
 
 

3622 lines
130 KiB

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