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.
 
 
 

6868 lines
254 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package cloudiot provides access to the Cloud IoT API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/iot
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/cloudiot/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // cloudiotService, err := cloudiot.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // cloudiotService, err := cloudiot.NewService(ctx, option.WithScopes(cloudiot.CloudiotScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // cloudiotService, err := cloudiot.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // cloudiotService, err := cloudiot.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package cloudiot // import "google.golang.org/api/cloudiot/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "cloudiot:v1"
  71. const apiName = "cloudiot"
  72. const apiVersion = "v1"
  73. const basePath = "https://cloudiot.googleapis.com/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage your data across Google Cloud Platform services
  77. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  78. // Register and manage devices in the Google Cloud IoT service
  79. CloudiotScope = "https://www.googleapis.com/auth/cloudiot"
  80. )
  81. // NewService creates a new Service.
  82. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  83. scopesOption := option.WithScopes(
  84. "https://www.googleapis.com/auth/cloud-platform",
  85. "https://www.googleapis.com/auth/cloudiot",
  86. )
  87. // NOTE: prepend, so we don't override user-specified scopes.
  88. opts = append([]option.ClientOption{scopesOption}, opts...)
  89. client, endpoint, err := htransport.NewClient(ctx, opts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. s, err := New(client)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if endpoint != "" {
  98. s.BasePath = endpoint
  99. }
  100. return s, nil
  101. }
  102. // New creates a new Service. It uses the provided http.Client for requests.
  103. //
  104. // Deprecated: please use NewService instead.
  105. // To provide a custom HTTP client, use option.WithHTTPClient.
  106. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  107. func New(client *http.Client) (*Service, error) {
  108. if client == nil {
  109. return nil, errors.New("client is nil")
  110. }
  111. s := &Service{client: client, BasePath: basePath}
  112. s.Projects = NewProjectsService(s)
  113. return s, nil
  114. }
  115. type Service struct {
  116. client *http.Client
  117. BasePath string // API endpoint base URL
  118. UserAgent string // optional additional User-Agent fragment
  119. Projects *ProjectsService
  120. }
  121. func (s *Service) userAgent() string {
  122. if s.UserAgent == "" {
  123. return googleapi.UserAgent
  124. }
  125. return googleapi.UserAgent + " " + s.UserAgent
  126. }
  127. func NewProjectsService(s *Service) *ProjectsService {
  128. rs := &ProjectsService{s: s}
  129. rs.Locations = NewProjectsLocationsService(s)
  130. return rs
  131. }
  132. type ProjectsService struct {
  133. s *Service
  134. Locations *ProjectsLocationsService
  135. }
  136. func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
  137. rs := &ProjectsLocationsService{s: s}
  138. rs.Registries = NewProjectsLocationsRegistriesService(s)
  139. return rs
  140. }
  141. type ProjectsLocationsService struct {
  142. s *Service
  143. Registries *ProjectsLocationsRegistriesService
  144. }
  145. func NewProjectsLocationsRegistriesService(s *Service) *ProjectsLocationsRegistriesService {
  146. rs := &ProjectsLocationsRegistriesService{s: s}
  147. rs.Devices = NewProjectsLocationsRegistriesDevicesService(s)
  148. rs.Groups = NewProjectsLocationsRegistriesGroupsService(s)
  149. return rs
  150. }
  151. type ProjectsLocationsRegistriesService struct {
  152. s *Service
  153. Devices *ProjectsLocationsRegistriesDevicesService
  154. Groups *ProjectsLocationsRegistriesGroupsService
  155. }
  156. func NewProjectsLocationsRegistriesDevicesService(s *Service) *ProjectsLocationsRegistriesDevicesService {
  157. rs := &ProjectsLocationsRegistriesDevicesService{s: s}
  158. rs.ConfigVersions = NewProjectsLocationsRegistriesDevicesConfigVersionsService(s)
  159. rs.States = NewProjectsLocationsRegistriesDevicesStatesService(s)
  160. return rs
  161. }
  162. type ProjectsLocationsRegistriesDevicesService struct {
  163. s *Service
  164. ConfigVersions *ProjectsLocationsRegistriesDevicesConfigVersionsService
  165. States *ProjectsLocationsRegistriesDevicesStatesService
  166. }
  167. func NewProjectsLocationsRegistriesDevicesConfigVersionsService(s *Service) *ProjectsLocationsRegistriesDevicesConfigVersionsService {
  168. rs := &ProjectsLocationsRegistriesDevicesConfigVersionsService{s: s}
  169. return rs
  170. }
  171. type ProjectsLocationsRegistriesDevicesConfigVersionsService struct {
  172. s *Service
  173. }
  174. func NewProjectsLocationsRegistriesDevicesStatesService(s *Service) *ProjectsLocationsRegistriesDevicesStatesService {
  175. rs := &ProjectsLocationsRegistriesDevicesStatesService{s: s}
  176. return rs
  177. }
  178. type ProjectsLocationsRegistriesDevicesStatesService struct {
  179. s *Service
  180. }
  181. func NewProjectsLocationsRegistriesGroupsService(s *Service) *ProjectsLocationsRegistriesGroupsService {
  182. rs := &ProjectsLocationsRegistriesGroupsService{s: s}
  183. rs.Devices = NewProjectsLocationsRegistriesGroupsDevicesService(s)
  184. return rs
  185. }
  186. type ProjectsLocationsRegistriesGroupsService struct {
  187. s *Service
  188. Devices *ProjectsLocationsRegistriesGroupsDevicesService
  189. }
  190. func NewProjectsLocationsRegistriesGroupsDevicesService(s *Service) *ProjectsLocationsRegistriesGroupsDevicesService {
  191. rs := &ProjectsLocationsRegistriesGroupsDevicesService{s: s}
  192. rs.ConfigVersions = NewProjectsLocationsRegistriesGroupsDevicesConfigVersionsService(s)
  193. rs.States = NewProjectsLocationsRegistriesGroupsDevicesStatesService(s)
  194. return rs
  195. }
  196. type ProjectsLocationsRegistriesGroupsDevicesService struct {
  197. s *Service
  198. ConfigVersions *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsService
  199. States *ProjectsLocationsRegistriesGroupsDevicesStatesService
  200. }
  201. func NewProjectsLocationsRegistriesGroupsDevicesConfigVersionsService(s *Service) *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsService {
  202. rs := &ProjectsLocationsRegistriesGroupsDevicesConfigVersionsService{s: s}
  203. return rs
  204. }
  205. type ProjectsLocationsRegistriesGroupsDevicesConfigVersionsService struct {
  206. s *Service
  207. }
  208. func NewProjectsLocationsRegistriesGroupsDevicesStatesService(s *Service) *ProjectsLocationsRegistriesGroupsDevicesStatesService {
  209. rs := &ProjectsLocationsRegistriesGroupsDevicesStatesService{s: s}
  210. return rs
  211. }
  212. type ProjectsLocationsRegistriesGroupsDevicesStatesService struct {
  213. s *Service
  214. }
  215. // BindDeviceToGatewayRequest: Request for `BindDeviceToGateway`.
  216. type BindDeviceToGatewayRequest struct {
  217. // DeviceId: The device to associate with the specified gateway. The
  218. // value of
  219. // `device_id` can be either the device numeric ID or the user-defined
  220. // device
  221. // identifier.
  222. DeviceId string `json:"deviceId,omitempty"`
  223. // GatewayId: The value of `gateway_id` can be either the device numeric
  224. // ID or the
  225. // user-defined device identifier.
  226. GatewayId string `json:"gatewayId,omitempty"`
  227. // ForceSendFields is a list of field names (e.g. "DeviceId") to
  228. // unconditionally include in API requests. By default, fields with
  229. // empty values are omitted from API requests. However, any non-pointer,
  230. // non-interface field appearing in ForceSendFields will be sent to the
  231. // server regardless of whether the field is empty or not. This may be
  232. // used to include empty fields in Patch requests.
  233. ForceSendFields []string `json:"-"`
  234. // NullFields is a list of field names (e.g. "DeviceId") to include in
  235. // API requests with the JSON null value. By default, fields with empty
  236. // values are omitted from API requests. However, any field with an
  237. // empty value appearing in NullFields will be sent to the server as
  238. // null. It is an error if a field in this list has a non-empty value.
  239. // This may be used to include null fields in Patch requests.
  240. NullFields []string `json:"-"`
  241. }
  242. func (s *BindDeviceToGatewayRequest) MarshalJSON() ([]byte, error) {
  243. type NoMethod BindDeviceToGatewayRequest
  244. raw := NoMethod(*s)
  245. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  246. }
  247. // BindDeviceToGatewayResponse: Response for `BindDeviceToGateway`.
  248. type BindDeviceToGatewayResponse struct {
  249. // ServerResponse contains the HTTP response code and headers from the
  250. // server.
  251. googleapi.ServerResponse `json:"-"`
  252. }
  253. // Binding: Associates `members` with a `role`.
  254. type Binding struct {
  255. // Condition: Unimplemented. The condition that is associated with this
  256. // binding.
  257. // NOTE: an unsatisfied condition will not allow user access via
  258. // current
  259. // binding. Different bindings, including their conditions, are
  260. // examined
  261. // independently.
  262. Condition *Expr `json:"condition,omitempty"`
  263. // Members: Specifies the identities requesting access for a Cloud
  264. // Platform resource.
  265. // `members` can have the following values:
  266. //
  267. // * `allUsers`: A special identifier that represents anyone who is
  268. // on the internet; with or without a Google account.
  269. //
  270. // * `allAuthenticatedUsers`: A special identifier that represents
  271. // anyone
  272. // who is authenticated with a Google account or a service
  273. // account.
  274. //
  275. // * `user:{emailid}`: An email address that represents a specific
  276. // Google
  277. // account. For example, `alice@gmail.com` .
  278. //
  279. //
  280. // * `serviceAccount:{emailid}`: An email address that represents a
  281. // service
  282. // account. For example,
  283. // `my-other-app@appspot.gserviceaccount.com`.
  284. //
  285. // * `group:{emailid}`: An email address that represents a Google
  286. // group.
  287. // For example, `admins@example.com`.
  288. //
  289. //
  290. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  291. // the
  292. // users of that domain. For example, `google.com` or
  293. // `example.com`.
  294. //
  295. //
  296. Members []string `json:"members,omitempty"`
  297. // Role: Role that is assigned to `members`.
  298. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  299. Role string `json:"role,omitempty"`
  300. // ForceSendFields is a list of field names (e.g. "Condition") to
  301. // unconditionally include in API requests. By default, fields with
  302. // empty values are omitted from API requests. However, any non-pointer,
  303. // non-interface field appearing in ForceSendFields will be sent to the
  304. // server regardless of whether the field is empty or not. This may be
  305. // used to include empty fields in Patch requests.
  306. ForceSendFields []string `json:"-"`
  307. // NullFields is a list of field names (e.g. "Condition") to include in
  308. // API requests with the JSON null value. By default, fields with empty
  309. // values are omitted from API requests. However, any field with an
  310. // empty value appearing in NullFields will be sent to the server as
  311. // null. It is an error if a field in this list has a non-empty value.
  312. // This may be used to include null fields in Patch requests.
  313. NullFields []string `json:"-"`
  314. }
  315. func (s *Binding) MarshalJSON() ([]byte, error) {
  316. type NoMethod Binding
  317. raw := NoMethod(*s)
  318. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  319. }
  320. // Device: The device resource.
  321. type Device struct {
  322. // Blocked: If a device is blocked, connections or requests from this
  323. // device will fail.
  324. // Can be used to temporarily prevent the device from connecting if,
  325. // for
  326. // example, the sensor is generating bad data and needs maintenance.
  327. Blocked bool `json:"blocked,omitempty"`
  328. // Config: The most recent device configuration, which is eventually
  329. // sent from
  330. // Cloud IoT Core to the device. If not present on creation,
  331. // the
  332. // configuration will be initialized with an empty payload and version
  333. // value
  334. // of `1`. To update this field after creation, use
  335. // the
  336. // `DeviceManager.ModifyCloudToDeviceConfig` method.
  337. Config *DeviceConfig `json:"config,omitempty"`
  338. // Credentials: The credentials used to authenticate this device. To
  339. // allow credential
  340. // rotation without interruption, multiple device credentials can be
  341. // bound to
  342. // this device. No more than 3 credentials can be bound to a single
  343. // device at
  344. // a time. When new credentials are added to a device, they are
  345. // verified
  346. // against the registry credentials. For details, see the description of
  347. // the
  348. // `DeviceRegistry.credentials` field.
  349. Credentials []*DeviceCredential `json:"credentials,omitempty"`
  350. // GatewayConfig: Gateway-related configuration and state.
  351. GatewayConfig *GatewayConfig `json:"gatewayConfig,omitempty"`
  352. // Id: The user-defined device identifier. The device ID must be
  353. // unique
  354. // within a device registry.
  355. Id string `json:"id,omitempty"`
  356. // LastConfigAckTime: [Output only] The last time a cloud-to-device
  357. // config version acknowledgment
  358. // was received from the device. This field is only for
  359. // configurations
  360. // sent through MQTT.
  361. LastConfigAckTime string `json:"lastConfigAckTime,omitempty"`
  362. // LastConfigSendTime: [Output only] The last time a cloud-to-device
  363. // config version was sent to
  364. // the device.
  365. LastConfigSendTime string `json:"lastConfigSendTime,omitempty"`
  366. // LastErrorStatus: [Output only] The error message of the most recent
  367. // error, such as a failure
  368. // to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of
  369. // this
  370. // field. If no errors have occurred, this field has an empty
  371. // message
  372. // and the status code 0 == OK. Otherwise, this field is expected to
  373. // have a
  374. // status code other than OK.
  375. LastErrorStatus *Status `json:"lastErrorStatus,omitempty"`
  376. // LastErrorTime: [Output only] The time the most recent error occurred,
  377. // such as a failure to
  378. // publish to Cloud Pub/Sub. This field is the timestamp
  379. // of
  380. // 'last_error_status'.
  381. LastErrorTime string `json:"lastErrorTime,omitempty"`
  382. // LastEventTime: [Output only] The last time a telemetry event was
  383. // received. Timestamps are
  384. // periodically collected and written to storage; they may be stale by a
  385. // few
  386. // minutes.
  387. LastEventTime string `json:"lastEventTime,omitempty"`
  388. // LastHeartbeatTime: [Output only] The last time an MQTT `PINGREQ` was
  389. // received. This field
  390. // applies only to devices connecting through MQTT. MQTT clients usually
  391. // only
  392. // send `PINGREQ` messages if the connection is idle, and no other
  393. // messages
  394. // have been sent. Timestamps are periodically collected and written
  395. // to
  396. // storage; they may be stale by a few minutes.
  397. LastHeartbeatTime string `json:"lastHeartbeatTime,omitempty"`
  398. // LastStateTime: [Output only] The last time a state event was
  399. // received. Timestamps are
  400. // periodically collected and written to storage; they may be stale by a
  401. // few
  402. // minutes.
  403. LastStateTime string `json:"lastStateTime,omitempty"`
  404. // LogLevel: **Beta Feature**
  405. //
  406. // The logging verbosity for device activity. If
  407. // unspecified,
  408. // DeviceRegistry.log_level will be used.
  409. //
  410. // Possible values:
  411. // "LOG_LEVEL_UNSPECIFIED" - No logging specified. If not specified,
  412. // logging will be disabled.
  413. // "NONE" - Disables logging.
  414. // "ERROR" - Error events will be logged.
  415. // "INFO" - Informational events will be logged, such as connections
  416. // and
  417. // disconnections.
  418. // "DEBUG" - All events will be logged.
  419. LogLevel string `json:"logLevel,omitempty"`
  420. // Metadata: The metadata key-value pairs assigned to the device. This
  421. // metadata is not
  422. // interpreted or indexed by Cloud IoT Core. It can be used to add
  423. // contextual
  424. // information for the device.
  425. //
  426. // Keys must conform to the regular expression a-zA-Z+ and
  427. // be less than 128 bytes in length.
  428. //
  429. // Values are free-form strings. Each value must be less than or equal
  430. // to 32
  431. // KB in size.
  432. //
  433. // The total size of all keys and values must be less than 256 KB, and
  434. // the
  435. // maximum number of key-value pairs is 500.
  436. Metadata map[string]string `json:"metadata,omitempty"`
  437. // Name: The resource path name. For
  438. // example,
  439. // `projects/p1/locations/us-central1/registries/registry0/devic
  440. // es/dev0`
  441. // or
  442. // `projects/p1/locations/us-central1/registries/registry0/devices/{nu
  443. // m_id}`.
  444. // When `name` is populated as a response from the service, it always
  445. // ends
  446. // in the device numeric ID.
  447. Name string `json:"name,omitempty"`
  448. // NumId: [Output only] A server-defined unique numeric ID for the
  449. // device. This is a
  450. // more compact way to identify devices, and it is globally unique.
  451. NumId uint64 `json:"numId,omitempty,string"`
  452. // State: [Output only] The state most recently received from the
  453. // device. If no state
  454. // has been reported, this field is not present.
  455. State *DeviceState `json:"state,omitempty"`
  456. // ServerResponse contains the HTTP response code and headers from the
  457. // server.
  458. googleapi.ServerResponse `json:"-"`
  459. // ForceSendFields is a list of field names (e.g. "Blocked") to
  460. // unconditionally include in API requests. By default, fields with
  461. // empty values are omitted from API requests. However, any non-pointer,
  462. // non-interface field appearing in ForceSendFields will be sent to the
  463. // server regardless of whether the field is empty or not. This may be
  464. // used to include empty fields in Patch requests.
  465. ForceSendFields []string `json:"-"`
  466. // NullFields is a list of field names (e.g. "Blocked") to include in
  467. // API requests with the JSON null value. By default, fields with empty
  468. // values are omitted from API requests. However, any field with an
  469. // empty value appearing in NullFields will be sent to the server as
  470. // null. It is an error if a field in this list has a non-empty value.
  471. // This may be used to include null fields in Patch requests.
  472. NullFields []string `json:"-"`
  473. }
  474. func (s *Device) MarshalJSON() ([]byte, error) {
  475. type NoMethod Device
  476. raw := NoMethod(*s)
  477. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  478. }
  479. // DeviceConfig: The device configuration. Eventually delivered to
  480. // devices.
  481. type DeviceConfig struct {
  482. // BinaryData: The device configuration data.
  483. BinaryData string `json:"binaryData,omitempty"`
  484. // CloudUpdateTime: [Output only] The time at which this configuration
  485. // version was updated in
  486. // Cloud IoT Core. This timestamp is set by the server.
  487. CloudUpdateTime string `json:"cloudUpdateTime,omitempty"`
  488. // DeviceAckTime: [Output only] The time at which Cloud IoT Core
  489. // received the
  490. // acknowledgment from the device, indicating that the device has
  491. // received
  492. // this configuration version. If this field is not present, the device
  493. // has
  494. // not yet acknowledged that it received this version. Note that
  495. // when
  496. // the config was sent to the device, many config versions may have
  497. // been
  498. // available in Cloud IoT Core while the device was disconnected, and
  499. // on
  500. // connection, only the latest version is sent to the device.
  501. // Some
  502. // versions may never be sent to the device, and therefore are
  503. // never
  504. // acknowledged. This timestamp is set by Cloud IoT Core.
  505. DeviceAckTime string `json:"deviceAckTime,omitempty"`
  506. // Version: [Output only] The version of this update. The version number
  507. // is assigned by
  508. // the server, and is always greater than 0 after device creation.
  509. // The
  510. // version must be 0 on the `CreateDevice` request if a `config`
  511. // is
  512. // specified; the response of `CreateDevice` will always have a value of
  513. // 1.
  514. Version int64 `json:"version,omitempty,string"`
  515. // ServerResponse contains the HTTP response code and headers from the
  516. // server.
  517. googleapi.ServerResponse `json:"-"`
  518. // ForceSendFields is a list of field names (e.g. "BinaryData") to
  519. // unconditionally include in API requests. By default, fields with
  520. // empty values are omitted from API requests. However, any non-pointer,
  521. // non-interface field appearing in ForceSendFields will be sent to the
  522. // server regardless of whether the field is empty or not. This may be
  523. // used to include empty fields in Patch requests.
  524. ForceSendFields []string `json:"-"`
  525. // NullFields is a list of field names (e.g. "BinaryData") to include in
  526. // API requests with the JSON null value. By default, fields with empty
  527. // values are omitted from API requests. However, any field with an
  528. // empty value appearing in NullFields will be sent to the server as
  529. // null. It is an error if a field in this list has a non-empty value.
  530. // This may be used to include null fields in Patch requests.
  531. NullFields []string `json:"-"`
  532. }
  533. func (s *DeviceConfig) MarshalJSON() ([]byte, error) {
  534. type NoMethod DeviceConfig
  535. raw := NoMethod(*s)
  536. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  537. }
  538. // DeviceCredential: A server-stored device credential used for
  539. // authentication.
  540. type DeviceCredential struct {
  541. // ExpirationTime: [Optional] The time at which this credential becomes
  542. // invalid. This
  543. // credential will be ignored for new client authentication requests
  544. // after
  545. // this timestamp; however, it will not be automatically deleted.
  546. ExpirationTime string `json:"expirationTime,omitempty"`
  547. // PublicKey: A public key used to verify the signature of JSON Web
  548. // Tokens (JWTs).
  549. // When adding a new device credential, either via device creation or
  550. // via
  551. // modifications, this public key credential may be required to be
  552. // signed by
  553. // one of the registry level certificates. More specifically, if
  554. // the
  555. // registry contains at least one certificate, any new device
  556. // credential
  557. // must be signed by one of the registry certificates. As a result,
  558. // when the registry contains certificates, only X.509 certificates
  559. // are
  560. // accepted as device credentials. However, if the registry does
  561. // not contain a certificate, self-signed certificates and public keys
  562. // will
  563. // be accepted. New device credentials must be different from
  564. // every
  565. // registry-level certificate.
  566. PublicKey *PublicKeyCredential `json:"publicKey,omitempty"`
  567. // ForceSendFields is a list of field names (e.g. "ExpirationTime") to
  568. // unconditionally include in API requests. By default, fields with
  569. // empty values are omitted from API requests. However, any non-pointer,
  570. // non-interface field appearing in ForceSendFields will be sent to the
  571. // server regardless of whether the field is empty or not. This may be
  572. // used to include empty fields in Patch requests.
  573. ForceSendFields []string `json:"-"`
  574. // NullFields is a list of field names (e.g. "ExpirationTime") to
  575. // include in API requests with the JSON null value. By default, fields
  576. // with empty values are omitted from API requests. However, any field
  577. // with an empty value appearing in NullFields will be sent to the
  578. // server as null. It is an error if a field in this list has a
  579. // non-empty value. This may be used to include null fields in Patch
  580. // requests.
  581. NullFields []string `json:"-"`
  582. }
  583. func (s *DeviceCredential) MarshalJSON() ([]byte, error) {
  584. type NoMethod DeviceCredential
  585. raw := NoMethod(*s)
  586. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  587. }
  588. // DeviceRegistry: A container for a group of devices.
  589. type DeviceRegistry struct {
  590. // Credentials: The credentials used to verify the device credentials.
  591. // No more than 10
  592. // credentials can be bound to a single registry at a time. The
  593. // verification
  594. // process occurs at the time of device creation or update. If this
  595. // field is
  596. // empty, no verification is performed. Otherwise, the credentials of a
  597. // newly
  598. // created device or added credentials of an updated device should be
  599. // signed
  600. // with one of these registry credentials.
  601. //
  602. // Note, however, that existing devices will never be affected
  603. // by
  604. // modifications to this list of credentials: after a device has
  605. // been
  606. // successfully created in a registry, it should be able to connect even
  607. // if
  608. // its registry credentials are revoked, deleted, or modified.
  609. Credentials []*RegistryCredential `json:"credentials,omitempty"`
  610. // EventNotificationConfigs: The configuration for notification of
  611. // telemetry events received from the
  612. // device. All telemetry events that were successfully published by
  613. // the
  614. // device and acknowledged by Cloud IoT Core are guaranteed to
  615. // be
  616. // delivered to Cloud Pub/Sub. If multiple configurations match a
  617. // message,
  618. // only the first matching configuration is used. If you try to publish
  619. // a
  620. // device telemetry event using MQTT without specifying a Cloud Pub/Sub
  621. // topic
  622. // for the device's registry, the connection closes automatically. If
  623. // you try
  624. // to do so using an HTTP connection, an error is returned. Up to
  625. // 10
  626. // configurations may be provided.
  627. EventNotificationConfigs []*EventNotificationConfig `json:"eventNotificationConfigs,omitempty"`
  628. // HttpConfig: The DeviceService (HTTP) configuration for this device
  629. // registry.
  630. HttpConfig *HttpConfig `json:"httpConfig,omitempty"`
  631. // Id: The identifier of this device registry. For example,
  632. // `myRegistry`.
  633. Id string `json:"id,omitempty"`
  634. // LogLevel: **Beta Feature**
  635. //
  636. // The default logging verbosity for activity from devices in this
  637. // registry.
  638. // The verbosity level can be overridden by Device.log_level.
  639. //
  640. // Possible values:
  641. // "LOG_LEVEL_UNSPECIFIED" - No logging specified. If not specified,
  642. // logging will be disabled.
  643. // "NONE" - Disables logging.
  644. // "ERROR" - Error events will be logged.
  645. // "INFO" - Informational events will be logged, such as connections
  646. // and
  647. // disconnections.
  648. // "DEBUG" - All events will be logged.
  649. LogLevel string `json:"logLevel,omitempty"`
  650. // MqttConfig: The MQTT configuration for this device registry.
  651. MqttConfig *MqttConfig `json:"mqttConfig,omitempty"`
  652. // Name: The resource path name. For
  653. // example,
  654. // `projects/example-project/locations/us-central1/registries/my
  655. // -registry`.
  656. Name string `json:"name,omitempty"`
  657. // StateNotificationConfig: The configuration for notification of new
  658. // states received from the device.
  659. // State updates are guaranteed to be stored in the state history,
  660. // but
  661. // notifications to Cloud Pub/Sub are not guaranteed. For example,
  662. // if
  663. // permissions are misconfigured or the specified topic doesn't exist,
  664. // no
  665. // notification will be published but the state will still be stored in
  666. // Cloud
  667. // IoT Core.
  668. StateNotificationConfig *StateNotificationConfig `json:"stateNotificationConfig,omitempty"`
  669. // ServerResponse contains the HTTP response code and headers from the
  670. // server.
  671. googleapi.ServerResponse `json:"-"`
  672. // ForceSendFields is a list of field names (e.g. "Credentials") to
  673. // unconditionally include in API requests. By default, fields with
  674. // empty values are omitted from API requests. However, any non-pointer,
  675. // non-interface field appearing in ForceSendFields will be sent to the
  676. // server regardless of whether the field is empty or not. This may be
  677. // used to include empty fields in Patch requests.
  678. ForceSendFields []string `json:"-"`
  679. // NullFields is a list of field names (e.g. "Credentials") to include
  680. // in API requests with the JSON null value. By default, fields with
  681. // empty values are omitted from API requests. However, any field with
  682. // an empty value appearing in NullFields will be sent to the server as
  683. // null. It is an error if a field in this list has a non-empty value.
  684. // This may be used to include null fields in Patch requests.
  685. NullFields []string `json:"-"`
  686. }
  687. func (s *DeviceRegistry) MarshalJSON() ([]byte, error) {
  688. type NoMethod DeviceRegistry
  689. raw := NoMethod(*s)
  690. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  691. }
  692. // DeviceState: The device state, as reported by the device.
  693. type DeviceState struct {
  694. // BinaryData: The device state data.
  695. BinaryData string `json:"binaryData,omitempty"`
  696. // UpdateTime: [Output only] The time at which this state version was
  697. // updated in Cloud
  698. // IoT Core.
  699. UpdateTime string `json:"updateTime,omitempty"`
  700. // ForceSendFields is a list of field names (e.g. "BinaryData") to
  701. // unconditionally include in API requests. By default, fields with
  702. // empty values are omitted from API requests. However, any non-pointer,
  703. // non-interface field appearing in ForceSendFields will be sent to the
  704. // server regardless of whether the field is empty or not. This may be
  705. // used to include empty fields in Patch requests.
  706. ForceSendFields []string `json:"-"`
  707. // NullFields is a list of field names (e.g. "BinaryData") to include in
  708. // API requests with the JSON null value. By default, fields with empty
  709. // values are omitted from API requests. However, any field with an
  710. // empty value appearing in NullFields will be sent to the server as
  711. // null. It is an error if a field in this list has a non-empty value.
  712. // This may be used to include null fields in Patch requests.
  713. NullFields []string `json:"-"`
  714. }
  715. func (s *DeviceState) MarshalJSON() ([]byte, error) {
  716. type NoMethod DeviceState
  717. raw := NoMethod(*s)
  718. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  719. }
  720. // Empty: A generic empty message that you can re-use to avoid defining
  721. // duplicated
  722. // empty messages in your APIs. A typical example is to use it as the
  723. // request
  724. // or the response type of an API method. For instance:
  725. //
  726. // service Foo {
  727. // rpc Bar(google.protobuf.Empty) returns
  728. // (google.protobuf.Empty);
  729. // }
  730. //
  731. // The JSON representation for `Empty` is empty JSON object `{}`.
  732. type Empty struct {
  733. // ServerResponse contains the HTTP response code and headers from the
  734. // server.
  735. googleapi.ServerResponse `json:"-"`
  736. }
  737. // EventNotificationConfig: The configuration for forwarding telemetry
  738. // events.
  739. type EventNotificationConfig struct {
  740. // PubsubTopicName: A Cloud Pub/Sub topic name. For
  741. // example,
  742. // `projects/myProject/topics/deviceEvents`.
  743. PubsubTopicName string `json:"pubsubTopicName,omitempty"`
  744. // SubfolderMatches: If the subfolder name matches this string exactly,
  745. // this configuration will
  746. // be used. The string must not include the leading '/' character. If
  747. // empty,
  748. // all strings are matched. This field is used only for telemetry
  749. // events;
  750. // subfolders are not supported for state changes.
  751. SubfolderMatches string `json:"subfolderMatches,omitempty"`
  752. // ForceSendFields is a list of field names (e.g. "PubsubTopicName") to
  753. // unconditionally include in API requests. By default, fields with
  754. // empty values are omitted from API requests. However, any non-pointer,
  755. // non-interface field appearing in ForceSendFields will be sent to the
  756. // server regardless of whether the field is empty or not. This may be
  757. // used to include empty fields in Patch requests.
  758. ForceSendFields []string `json:"-"`
  759. // NullFields is a list of field names (e.g. "PubsubTopicName") to
  760. // include in API requests with the JSON null value. By default, fields
  761. // with empty values are omitted from API requests. However, any field
  762. // with an empty value appearing in NullFields will be sent to the
  763. // server as null. It is an error if a field in this list has a
  764. // non-empty value. This may be used to include null fields in Patch
  765. // requests.
  766. NullFields []string `json:"-"`
  767. }
  768. func (s *EventNotificationConfig) MarshalJSON() ([]byte, error) {
  769. type NoMethod EventNotificationConfig
  770. raw := NoMethod(*s)
  771. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  772. }
  773. // Expr: Represents an expression text. Example:
  774. //
  775. // title: "User account presence"
  776. // description: "Determines whether the request has a user account"
  777. // expression: "size(request.user) > 0"
  778. type Expr struct {
  779. // Description: An optional description of the expression. This is a
  780. // longer text which
  781. // describes the expression, e.g. when hovered over it in a UI.
  782. Description string `json:"description,omitempty"`
  783. // Expression: Textual representation of an expression in
  784. // Common Expression Language syntax.
  785. //
  786. // The application context of the containing message determines
  787. // which
  788. // well-known feature set of CEL is supported.
  789. Expression string `json:"expression,omitempty"`
  790. // Location: An optional string indicating the location of the
  791. // expression for error
  792. // reporting, e.g. a file name and a position in the file.
  793. Location string `json:"location,omitempty"`
  794. // Title: An optional title for the expression, i.e. a short string
  795. // describing
  796. // its purpose. This can be used e.g. in UIs which allow to enter
  797. // the
  798. // expression.
  799. Title string `json:"title,omitempty"`
  800. // ForceSendFields is a list of field names (e.g. "Description") to
  801. // unconditionally include in API requests. By default, fields with
  802. // empty values are omitted from API requests. However, any non-pointer,
  803. // non-interface field appearing in ForceSendFields will be sent to the
  804. // server regardless of whether the field is empty or not. This may be
  805. // used to include empty fields in Patch requests.
  806. ForceSendFields []string `json:"-"`
  807. // NullFields is a list of field names (e.g. "Description") to include
  808. // in API requests with the JSON null value. By default, fields with
  809. // empty values are omitted from API requests. However, any field with
  810. // an empty value appearing in NullFields will be sent to the server as
  811. // null. It is an error if a field in this list has a non-empty value.
  812. // This may be used to include null fields in Patch requests.
  813. NullFields []string `json:"-"`
  814. }
  815. func (s *Expr) MarshalJSON() ([]byte, error) {
  816. type NoMethod Expr
  817. raw := NoMethod(*s)
  818. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  819. }
  820. // GatewayConfig: Gateway-related configuration and state.
  821. type GatewayConfig struct {
  822. // GatewayAuthMethod: Indicates how to authorize and/or authenticate
  823. // devices to access the
  824. // gateway.
  825. //
  826. // Possible values:
  827. // "GATEWAY_AUTH_METHOD_UNSPECIFIED" - No authentication/authorization
  828. // method specified. No devices are allowed to
  829. // access the gateway.
  830. // "ASSOCIATION_ONLY" - The device is authenticated through the
  831. // gateway association only. Device
  832. // credentials are ignored even if provided.
  833. // "DEVICE_AUTH_TOKEN_ONLY" - The device is authenticated through its
  834. // own credentials. Gateway
  835. // association is not checked.
  836. // "ASSOCIATION_AND_DEVICE_AUTH_TOKEN" - The device is authenticated
  837. // through both device credentials and gateway
  838. // association. The device must be bound to the gateway and must provide
  839. // its
  840. // own credentials.
  841. GatewayAuthMethod string `json:"gatewayAuthMethod,omitempty"`
  842. // GatewayType: Indicates whether the device is a gateway.
  843. //
  844. // Possible values:
  845. // "GATEWAY_TYPE_UNSPECIFIED" - If unspecified, the device is
  846. // considered a non-gateway device.
  847. // "GATEWAY" - The device is a gateway.
  848. // "NON_GATEWAY" - The device is not a gateway.
  849. GatewayType string `json:"gatewayType,omitempty"`
  850. // LastAccessedGatewayId: [Output only] The ID of the gateway the device
  851. // accessed most recently.
  852. LastAccessedGatewayId string `json:"lastAccessedGatewayId,omitempty"`
  853. // LastAccessedGatewayTime: [Output only] The most recent time at which
  854. // the device accessed the gateway
  855. // specified in `last_accessed_gateway`.
  856. LastAccessedGatewayTime string `json:"lastAccessedGatewayTime,omitempty"`
  857. // ForceSendFields is a list of field names (e.g. "GatewayAuthMethod")
  858. // to unconditionally include in API requests. By default, fields with
  859. // empty values are omitted from API requests. However, any non-pointer,
  860. // non-interface field appearing in ForceSendFields will be sent to the
  861. // server regardless of whether the field is empty or not. This may be
  862. // used to include empty fields in Patch requests.
  863. ForceSendFields []string `json:"-"`
  864. // NullFields is a list of field names (e.g. "GatewayAuthMethod") to
  865. // include in API requests with the JSON null value. By default, fields
  866. // with empty values are omitted from API requests. However, any field
  867. // with an empty value appearing in NullFields will be sent to the
  868. // server as null. It is an error if a field in this list has a
  869. // non-empty value. This may be used to include null fields in Patch
  870. // requests.
  871. NullFields []string `json:"-"`
  872. }
  873. func (s *GatewayConfig) MarshalJSON() ([]byte, error) {
  874. type NoMethod GatewayConfig
  875. raw := NoMethod(*s)
  876. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  877. }
  878. // GetIamPolicyRequest: Request message for `GetIamPolicy` method.
  879. type GetIamPolicyRequest struct {
  880. }
  881. // HttpConfig: The configuration of the HTTP bridge for a device
  882. // registry.
  883. type HttpConfig struct {
  884. // HttpEnabledState: If enabled, allows devices to use DeviceService via
  885. // the HTTP protocol.
  886. // Otherwise, any requests to DeviceService will fail for this registry.
  887. //
  888. // Possible values:
  889. // "HTTP_STATE_UNSPECIFIED" - No HTTP state specified. If not
  890. // specified, DeviceService will be
  891. // enabled by default.
  892. // "HTTP_ENABLED" - Enables DeviceService (HTTP) service for the
  893. // registry.
  894. // "HTTP_DISABLED" - Disables DeviceService (HTTP) service for the
  895. // registry.
  896. HttpEnabledState string `json:"httpEnabledState,omitempty"`
  897. // ForceSendFields is a list of field names (e.g. "HttpEnabledState") to
  898. // unconditionally include in API requests. By default, fields with
  899. // empty values are omitted from API requests. However, any non-pointer,
  900. // non-interface field appearing in ForceSendFields will be sent to the
  901. // server regardless of whether the field is empty or not. This may be
  902. // used to include empty fields in Patch requests.
  903. ForceSendFields []string `json:"-"`
  904. // NullFields is a list of field names (e.g. "HttpEnabledState") to
  905. // include in API requests with the JSON null value. By default, fields
  906. // with empty values are omitted from API requests. However, any field
  907. // with an empty value appearing in NullFields will be sent to the
  908. // server as null. It is an error if a field in this list has a
  909. // non-empty value. This may be used to include null fields in Patch
  910. // requests.
  911. NullFields []string `json:"-"`
  912. }
  913. func (s *HttpConfig) MarshalJSON() ([]byte, error) {
  914. type NoMethod HttpConfig
  915. raw := NoMethod(*s)
  916. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  917. }
  918. // ListDeviceConfigVersionsResponse: Response for
  919. // `ListDeviceConfigVersions`.
  920. type ListDeviceConfigVersionsResponse struct {
  921. // DeviceConfigs: The device configuration for the last few versions.
  922. // Versions are listed
  923. // in decreasing order, starting from the most recent one.
  924. DeviceConfigs []*DeviceConfig `json:"deviceConfigs,omitempty"`
  925. // ServerResponse contains the HTTP response code and headers from the
  926. // server.
  927. googleapi.ServerResponse `json:"-"`
  928. // ForceSendFields is a list of field names (e.g. "DeviceConfigs") to
  929. // unconditionally include in API requests. By default, fields with
  930. // empty values are omitted from API requests. However, any non-pointer,
  931. // non-interface field appearing in ForceSendFields will be sent to the
  932. // server regardless of whether the field is empty or not. This may be
  933. // used to include empty fields in Patch requests.
  934. ForceSendFields []string `json:"-"`
  935. // NullFields is a list of field names (e.g. "DeviceConfigs") to include
  936. // in API requests with the JSON null value. By default, fields with
  937. // empty values are omitted from API requests. However, any field with
  938. // an empty value appearing in NullFields will be sent to the server as
  939. // null. It is an error if a field in this list has a non-empty value.
  940. // This may be used to include null fields in Patch requests.
  941. NullFields []string `json:"-"`
  942. }
  943. func (s *ListDeviceConfigVersionsResponse) MarshalJSON() ([]byte, error) {
  944. type NoMethod ListDeviceConfigVersionsResponse
  945. raw := NoMethod(*s)
  946. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  947. }
  948. // ListDeviceRegistriesResponse: Response for `ListDeviceRegistries`.
  949. type ListDeviceRegistriesResponse struct {
  950. // DeviceRegistries: The registries that matched the query.
  951. DeviceRegistries []*DeviceRegistry `json:"deviceRegistries,omitempty"`
  952. // NextPageToken: If not empty, indicates that there may be more
  953. // registries that match the
  954. // request; this value should be passed in a
  955. // new
  956. // `ListDeviceRegistriesRequest`.
  957. NextPageToken string `json:"nextPageToken,omitempty"`
  958. // ServerResponse contains the HTTP response code and headers from the
  959. // server.
  960. googleapi.ServerResponse `json:"-"`
  961. // ForceSendFields is a list of field names (e.g. "DeviceRegistries") to
  962. // unconditionally include in API requests. By default, fields with
  963. // empty values are omitted from API requests. However, any non-pointer,
  964. // non-interface field appearing in ForceSendFields will be sent to the
  965. // server regardless of whether the field is empty or not. This may be
  966. // used to include empty fields in Patch requests.
  967. ForceSendFields []string `json:"-"`
  968. // NullFields is a list of field names (e.g. "DeviceRegistries") to
  969. // include in API requests with the JSON null value. By default, fields
  970. // with empty values are omitted from API requests. However, any field
  971. // with an empty value appearing in NullFields will be sent to the
  972. // server as null. It is an error if a field in this list has a
  973. // non-empty value. This may be used to include null fields in Patch
  974. // requests.
  975. NullFields []string `json:"-"`
  976. }
  977. func (s *ListDeviceRegistriesResponse) MarshalJSON() ([]byte, error) {
  978. type NoMethod ListDeviceRegistriesResponse
  979. raw := NoMethod(*s)
  980. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  981. }
  982. // ListDeviceStatesResponse: Response for `ListDeviceStates`.
  983. type ListDeviceStatesResponse struct {
  984. // DeviceStates: The last few device states. States are listed in
  985. // descending order of server
  986. // update time, starting from the most recent one.
  987. DeviceStates []*DeviceState `json:"deviceStates,omitempty"`
  988. // ServerResponse contains the HTTP response code and headers from the
  989. // server.
  990. googleapi.ServerResponse `json:"-"`
  991. // ForceSendFields is a list of field names (e.g. "DeviceStates") to
  992. // unconditionally include in API requests. By default, fields with
  993. // empty values are omitted from API requests. However, any non-pointer,
  994. // non-interface field appearing in ForceSendFields will be sent to the
  995. // server regardless of whether the field is empty or not. This may be
  996. // used to include empty fields in Patch requests.
  997. ForceSendFields []string `json:"-"`
  998. // NullFields is a list of field names (e.g. "DeviceStates") to include
  999. // in API requests with the JSON null value. By default, fields with
  1000. // empty values are omitted from API requests. However, any field with
  1001. // an empty value appearing in NullFields will be sent to the server as
  1002. // null. It is an error if a field in this list has a non-empty value.
  1003. // This may be used to include null fields in Patch requests.
  1004. NullFields []string `json:"-"`
  1005. }
  1006. func (s *ListDeviceStatesResponse) MarshalJSON() ([]byte, error) {
  1007. type NoMethod ListDeviceStatesResponse
  1008. raw := NoMethod(*s)
  1009. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1010. }
  1011. // ListDevicesResponse: Response for `ListDevices`.
  1012. type ListDevicesResponse struct {
  1013. // Devices: The devices that match the request.
  1014. Devices []*Device `json:"devices,omitempty"`
  1015. // NextPageToken: If not empty, indicates that there may be more devices
  1016. // that match the
  1017. // request; this value should be passed in a new `ListDevicesRequest`.
  1018. NextPageToken string `json:"nextPageToken,omitempty"`
  1019. // ServerResponse contains the HTTP response code and headers from the
  1020. // server.
  1021. googleapi.ServerResponse `json:"-"`
  1022. // ForceSendFields is a list of field names (e.g. "Devices") to
  1023. // unconditionally include in API requests. By default, fields with
  1024. // empty values are omitted from API requests. However, any non-pointer,
  1025. // non-interface field appearing in ForceSendFields will be sent to the
  1026. // server regardless of whether the field is empty or not. This may be
  1027. // used to include empty fields in Patch requests.
  1028. ForceSendFields []string `json:"-"`
  1029. // NullFields is a list of field names (e.g. "Devices") to include in
  1030. // API requests with the JSON null value. By default, fields with empty
  1031. // values are omitted from API requests. However, any field with an
  1032. // empty value appearing in NullFields will be sent to the server as
  1033. // null. It is an error if a field in this list has a non-empty value.
  1034. // This may be used to include null fields in Patch requests.
  1035. NullFields []string `json:"-"`
  1036. }
  1037. func (s *ListDevicesResponse) MarshalJSON() ([]byte, error) {
  1038. type NoMethod ListDevicesResponse
  1039. raw := NoMethod(*s)
  1040. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1041. }
  1042. // ModifyCloudToDeviceConfigRequest: Request for
  1043. // `ModifyCloudToDeviceConfig`.
  1044. type ModifyCloudToDeviceConfigRequest struct {
  1045. // BinaryData: The configuration data for the device.
  1046. BinaryData string `json:"binaryData,omitempty"`
  1047. // VersionToUpdate: The version number to update. If this value is zero,
  1048. // it will not check the
  1049. // version number of the server and will always update the current
  1050. // version;
  1051. // otherwise, this update will fail if the version number found on the
  1052. // server
  1053. // does not match this version number. This is used to support
  1054. // multiple
  1055. // simultaneous updates without losing data.
  1056. VersionToUpdate int64 `json:"versionToUpdate,omitempty,string"`
  1057. // ForceSendFields is a list of field names (e.g. "BinaryData") to
  1058. // unconditionally include in API requests. By default, fields with
  1059. // empty values are omitted from API requests. However, any non-pointer,
  1060. // non-interface field appearing in ForceSendFields will be sent to the
  1061. // server regardless of whether the field is empty or not. This may be
  1062. // used to include empty fields in Patch requests.
  1063. ForceSendFields []string `json:"-"`
  1064. // NullFields is a list of field names (e.g. "BinaryData") to include in
  1065. // API requests with the JSON null value. By default, fields with empty
  1066. // values are omitted from API requests. However, any field with an
  1067. // empty value appearing in NullFields will be sent to the server as
  1068. // null. It is an error if a field in this list has a non-empty value.
  1069. // This may be used to include null fields in Patch requests.
  1070. NullFields []string `json:"-"`
  1071. }
  1072. func (s *ModifyCloudToDeviceConfigRequest) MarshalJSON() ([]byte, error) {
  1073. type NoMethod ModifyCloudToDeviceConfigRequest
  1074. raw := NoMethod(*s)
  1075. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1076. }
  1077. // MqttConfig: The configuration of MQTT for a device registry.
  1078. type MqttConfig struct {
  1079. // MqttEnabledState: If enabled, allows connections using the MQTT
  1080. // protocol. Otherwise, MQTT
  1081. // connections to this registry will fail.
  1082. //
  1083. // Possible values:
  1084. // "MQTT_STATE_UNSPECIFIED" - No MQTT state specified. If not
  1085. // specified, MQTT will be enabled by default.
  1086. // "MQTT_ENABLED" - Enables a MQTT connection.
  1087. // "MQTT_DISABLED" - Disables a MQTT connection.
  1088. MqttEnabledState string `json:"mqttEnabledState,omitempty"`
  1089. // ForceSendFields is a list of field names (e.g. "MqttEnabledState") to
  1090. // unconditionally include in API requests. By default, fields with
  1091. // empty values are omitted from API requests. However, any non-pointer,
  1092. // non-interface field appearing in ForceSendFields will be sent to the
  1093. // server regardless of whether the field is empty or not. This may be
  1094. // used to include empty fields in Patch requests.
  1095. ForceSendFields []string `json:"-"`
  1096. // NullFields is a list of field names (e.g. "MqttEnabledState") to
  1097. // include in API requests with the JSON null value. By default, fields
  1098. // with empty values are omitted from API requests. However, any field
  1099. // with an empty value appearing in NullFields will be sent to the
  1100. // server as null. It is an error if a field in this list has a
  1101. // non-empty value. This may be used to include null fields in Patch
  1102. // requests.
  1103. NullFields []string `json:"-"`
  1104. }
  1105. func (s *MqttConfig) MarshalJSON() ([]byte, error) {
  1106. type NoMethod MqttConfig
  1107. raw := NoMethod(*s)
  1108. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1109. }
  1110. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  1111. // used to
  1112. // specify access control policies for Cloud Platform resources.
  1113. //
  1114. //
  1115. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  1116. // of
  1117. // `members` to a `role`, where the members can be user accounts, Google
  1118. // groups,
  1119. // Google domains, and service accounts. A `role` is a named list of
  1120. // permissions
  1121. // defined by IAM.
  1122. //
  1123. // **JSON Example**
  1124. //
  1125. // {
  1126. // "bindings": [
  1127. // {
  1128. // "role": "roles/owner",
  1129. // "members": [
  1130. // "user:mike@example.com",
  1131. // "group:admins@example.com",
  1132. // "domain:google.com",
  1133. //
  1134. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  1135. // ]
  1136. // },
  1137. // {
  1138. // "role": "roles/viewer",
  1139. // "members": ["user:sean@example.com"]
  1140. // }
  1141. // ]
  1142. // }
  1143. //
  1144. // **YAML Example**
  1145. //
  1146. // bindings:
  1147. // - members:
  1148. // - user:mike@example.com
  1149. // - group:admins@example.com
  1150. // - domain:google.com
  1151. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  1152. // role: roles/owner
  1153. // - members:
  1154. // - user:sean@example.com
  1155. // role: roles/viewer
  1156. //
  1157. //
  1158. // For a description of IAM and its features, see the
  1159. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  1160. type Policy struct {
  1161. // Bindings: Associates a list of `members` to a `role`.
  1162. // `bindings` with no members will result in an error.
  1163. Bindings []*Binding `json:"bindings,omitempty"`
  1164. // Etag: `etag` is used for optimistic concurrency control as a way to
  1165. // help
  1166. // prevent simultaneous updates of a policy from overwriting each
  1167. // other.
  1168. // It is strongly suggested that systems make use of the `etag` in
  1169. // the
  1170. // read-modify-write cycle to perform policy updates in order to avoid
  1171. // race
  1172. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  1173. // and
  1174. // systems are expected to put that etag in the request to
  1175. // `setIamPolicy` to
  1176. // ensure that their change will be applied to the same version of the
  1177. // policy.
  1178. //
  1179. // If no `etag` is provided in the call to `setIamPolicy`, then the
  1180. // existing
  1181. // policy is overwritten blindly.
  1182. Etag string `json:"etag,omitempty"`
  1183. // Version: Deprecated.
  1184. Version int64 `json:"version,omitempty"`
  1185. // ServerResponse contains the HTTP response code and headers from the
  1186. // server.
  1187. googleapi.ServerResponse `json:"-"`
  1188. // ForceSendFields is a list of field names (e.g. "Bindings") to
  1189. // unconditionally include in API requests. By default, fields with
  1190. // empty values are omitted from API requests. However, any non-pointer,
  1191. // non-interface field appearing in ForceSendFields will be sent to the
  1192. // server regardless of whether the field is empty or not. This may be
  1193. // used to include empty fields in Patch requests.
  1194. ForceSendFields []string `json:"-"`
  1195. // NullFields is a list of field names (e.g. "Bindings") to include in
  1196. // API requests with the JSON null value. By default, fields with empty
  1197. // values are omitted from API requests. However, any field with an
  1198. // empty value appearing in NullFields will be sent to the server as
  1199. // null. It is an error if a field in this list has a non-empty value.
  1200. // This may be used to include null fields in Patch requests.
  1201. NullFields []string `json:"-"`
  1202. }
  1203. func (s *Policy) MarshalJSON() ([]byte, error) {
  1204. type NoMethod Policy
  1205. raw := NoMethod(*s)
  1206. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1207. }
  1208. // PublicKeyCertificate: A public key certificate format and data.
  1209. type PublicKeyCertificate struct {
  1210. // Certificate: The certificate data.
  1211. Certificate string `json:"certificate,omitempty"`
  1212. // Format: The certificate format.
  1213. //
  1214. // Possible values:
  1215. // "UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT" - The format has not
  1216. // been specified. This is an invalid default value and
  1217. // must not be used.
  1218. // "X509_CERTIFICATE_PEM" - An X.509v3 certificate
  1219. // ([RFC5280](https://www.ietf.org/rfc/rfc5280.txt)),
  1220. // encoded in base64, and wrapped by `-----BEGIN CERTIFICATE-----`
  1221. // and
  1222. // `-----END CERTIFICATE-----`.
  1223. Format string `json:"format,omitempty"`
  1224. // X509Details: [Output only] The certificate details. Used only for
  1225. // X.509 certificates.
  1226. X509Details *X509CertificateDetails `json:"x509Details,omitempty"`
  1227. // ForceSendFields is a list of field names (e.g. "Certificate") to
  1228. // unconditionally include in API requests. By default, fields with
  1229. // empty values are omitted from API requests. However, any non-pointer,
  1230. // non-interface field appearing in ForceSendFields will be sent to the
  1231. // server regardless of whether the field is empty or not. This may be
  1232. // used to include empty fields in Patch requests.
  1233. ForceSendFields []string `json:"-"`
  1234. // NullFields is a list of field names (e.g. "Certificate") to include
  1235. // in API requests with the JSON null value. By default, fields with
  1236. // empty values are omitted from API requests. However, any field with
  1237. // an empty value appearing in NullFields will be sent to the server as
  1238. // null. It is an error if a field in this list has a non-empty value.
  1239. // This may be used to include null fields in Patch requests.
  1240. NullFields []string `json:"-"`
  1241. }
  1242. func (s *PublicKeyCertificate) MarshalJSON() ([]byte, error) {
  1243. type NoMethod PublicKeyCertificate
  1244. raw := NoMethod(*s)
  1245. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1246. }
  1247. // PublicKeyCredential: A public key format and data.
  1248. type PublicKeyCredential struct {
  1249. // Format: The format of the key.
  1250. //
  1251. // Possible values:
  1252. // "UNSPECIFIED_PUBLIC_KEY_FORMAT" - The format has not been
  1253. // specified. This is an invalid default value and
  1254. // must not be used.
  1255. // "RSA_PEM" - An RSA public key encoded in base64, and wrapped
  1256. // by
  1257. // `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----`. This can
  1258. // be
  1259. // used to verify `RS256` signatures in JWT tokens
  1260. // ([RFC7518](
  1261. // https://www.ietf.org/rfc/rfc7518.txt)).
  1262. // "RSA_X509_PEM" - As RSA_PEM, but wrapped in an X.509v3 certificate
  1263. // ([RFC5280](
  1264. // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and
  1265. // wrapped by
  1266. // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.
  1267. // "ES256_PEM" - Public key for the ECDSA algorithm using P-256 and
  1268. // SHA-256, encoded in
  1269. // base64, and wrapped by `-----BEGIN PUBLIC KEY-----` and
  1270. // `-----END
  1271. // PUBLIC KEY-----`. This can be used to verify JWT tokens with the
  1272. // `ES256`
  1273. // algorithm ([RFC7518](https://www.ietf.org/rfc/rfc7518.txt)). This
  1274. // curve is
  1275. // defined in [OpenSSL](https://www.openssl.org/) as the `prime256v1`
  1276. // curve.
  1277. // "ES256_X509_PEM" - As ES256_PEM, but wrapped in an X.509v3
  1278. // certificate ([RFC5280](
  1279. // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and
  1280. // wrapped by
  1281. // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.
  1282. Format string `json:"format,omitempty"`
  1283. // Key: The key data.
  1284. Key string `json:"key,omitempty"`
  1285. // ForceSendFields is a list of field names (e.g. "Format") to
  1286. // unconditionally include in API requests. By default, fields with
  1287. // empty values are omitted from API requests. However, any non-pointer,
  1288. // non-interface field appearing in ForceSendFields will be sent to the
  1289. // server regardless of whether the field is empty or not. This may be
  1290. // used to include empty fields in Patch requests.
  1291. ForceSendFields []string `json:"-"`
  1292. // NullFields is a list of field names (e.g. "Format") to include in API
  1293. // requests with the JSON null value. By default, fields with empty
  1294. // values are omitted from API requests. However, any field with an
  1295. // empty value appearing in NullFields will be sent to the server as
  1296. // null. It is an error if a field in this list has a non-empty value.
  1297. // This may be used to include null fields in Patch requests.
  1298. NullFields []string `json:"-"`
  1299. }
  1300. func (s *PublicKeyCredential) MarshalJSON() ([]byte, error) {
  1301. type NoMethod PublicKeyCredential
  1302. raw := NoMethod(*s)
  1303. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1304. }
  1305. // RegistryCredential: A server-stored registry credential used to
  1306. // validate device credentials.
  1307. type RegistryCredential struct {
  1308. // PublicKeyCertificate: A public key certificate used to verify the
  1309. // device credentials.
  1310. PublicKeyCertificate *PublicKeyCertificate `json:"publicKeyCertificate,omitempty"`
  1311. // ForceSendFields is a list of field names (e.g.
  1312. // "PublicKeyCertificate") to unconditionally include in API requests.
  1313. // By default, fields with empty values are omitted from API requests.
  1314. // However, any non-pointer, non-interface field appearing in
  1315. // ForceSendFields will be sent to the server regardless of whether the
  1316. // field is empty or not. This may be used to include empty fields in
  1317. // Patch requests.
  1318. ForceSendFields []string `json:"-"`
  1319. // NullFields is a list of field names (e.g. "PublicKeyCertificate") to
  1320. // include in API requests with the JSON null value. By default, fields
  1321. // with empty values are omitted from API requests. However, any field
  1322. // with an empty value appearing in NullFields will be sent to the
  1323. // server as null. It is an error if a field in this list has a
  1324. // non-empty value. This may be used to include null fields in Patch
  1325. // requests.
  1326. NullFields []string `json:"-"`
  1327. }
  1328. func (s *RegistryCredential) MarshalJSON() ([]byte, error) {
  1329. type NoMethod RegistryCredential
  1330. raw := NoMethod(*s)
  1331. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1332. }
  1333. // SendCommandToDeviceRequest: Request for `SendCommandToDevice`.
  1334. type SendCommandToDeviceRequest struct {
  1335. // BinaryData: The command data to send to the device.
  1336. BinaryData string `json:"binaryData,omitempty"`
  1337. // Subfolder: Optional subfolder for the command. If empty, the command
  1338. // will be delivered
  1339. // to the /devices/{device-id}/commands topic, otherwise it will be
  1340. // delivered
  1341. // to the /devices/{device-id}/commands/{subfolder} topic.
  1342. // Multi-level
  1343. // subfolders are allowed. This field must not have more than 256
  1344. // characters,
  1345. // and must not contain any MQTT wildcards ("+" or "#") or null
  1346. // characters.
  1347. Subfolder string `json:"subfolder,omitempty"`
  1348. // ForceSendFields is a list of field names (e.g. "BinaryData") to
  1349. // unconditionally include in API requests. By default, fields with
  1350. // empty values are omitted from API requests. However, any non-pointer,
  1351. // non-interface field appearing in ForceSendFields will be sent to the
  1352. // server regardless of whether the field is empty or not. This may be
  1353. // used to include empty fields in Patch requests.
  1354. ForceSendFields []string `json:"-"`
  1355. // NullFields is a list of field names (e.g. "BinaryData") to include in
  1356. // API requests with the JSON null value. By default, fields with empty
  1357. // values are omitted from API requests. However, any field with an
  1358. // empty value appearing in NullFields will be sent to the server as
  1359. // null. It is an error if a field in this list has a non-empty value.
  1360. // This may be used to include null fields in Patch requests.
  1361. NullFields []string `json:"-"`
  1362. }
  1363. func (s *SendCommandToDeviceRequest) MarshalJSON() ([]byte, error) {
  1364. type NoMethod SendCommandToDeviceRequest
  1365. raw := NoMethod(*s)
  1366. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1367. }
  1368. // SendCommandToDeviceResponse: Response for `SendCommandToDevice`.
  1369. type SendCommandToDeviceResponse struct {
  1370. // ServerResponse contains the HTTP response code and headers from the
  1371. // server.
  1372. googleapi.ServerResponse `json:"-"`
  1373. }
  1374. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1375. type SetIamPolicyRequest struct {
  1376. // Policy: REQUIRED: The complete policy to be applied to the
  1377. // `resource`. The size of
  1378. // the policy is limited to a few 10s of KB. An empty policy is a
  1379. // valid policy but certain Cloud Platform services (such as
  1380. // Projects)
  1381. // might reject them.
  1382. Policy *Policy `json:"policy,omitempty"`
  1383. // ForceSendFields is a list of field names (e.g. "Policy") to
  1384. // unconditionally include in API requests. By default, fields with
  1385. // empty values are omitted from API requests. However, any non-pointer,
  1386. // non-interface field appearing in ForceSendFields will be sent to the
  1387. // server regardless of whether the field is empty or not. This may be
  1388. // used to include empty fields in Patch requests.
  1389. ForceSendFields []string `json:"-"`
  1390. // NullFields is a list of field names (e.g. "Policy") to include in API
  1391. // requests with the JSON null value. By default, fields with empty
  1392. // values are omitted from API requests. However, any field with an
  1393. // empty value appearing in NullFields will be sent to the server as
  1394. // null. It is an error if a field in this list has a non-empty value.
  1395. // This may be used to include null fields in Patch requests.
  1396. NullFields []string `json:"-"`
  1397. }
  1398. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1399. type NoMethod SetIamPolicyRequest
  1400. raw := NoMethod(*s)
  1401. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1402. }
  1403. // StateNotificationConfig: The configuration for notification of new
  1404. // states received from the device.
  1405. type StateNotificationConfig struct {
  1406. // PubsubTopicName: A Cloud Pub/Sub topic name. For
  1407. // example,
  1408. // `projects/myProject/topics/deviceEvents`.
  1409. PubsubTopicName string `json:"pubsubTopicName,omitempty"`
  1410. // ForceSendFields is a list of field names (e.g. "PubsubTopicName") to
  1411. // unconditionally include in API requests. By default, fields with
  1412. // empty values are omitted from API requests. However, any non-pointer,
  1413. // non-interface field appearing in ForceSendFields will be sent to the
  1414. // server regardless of whether the field is empty or not. This may be
  1415. // used to include empty fields in Patch requests.
  1416. ForceSendFields []string `json:"-"`
  1417. // NullFields is a list of field names (e.g. "PubsubTopicName") to
  1418. // include in API requests with the JSON null value. By default, fields
  1419. // with empty values are omitted from API requests. However, any field
  1420. // with an empty value appearing in NullFields will be sent to the
  1421. // server as null. It is an error if a field in this list has a
  1422. // non-empty value. This may be used to include null fields in Patch
  1423. // requests.
  1424. NullFields []string `json:"-"`
  1425. }
  1426. func (s *StateNotificationConfig) MarshalJSON() ([]byte, error) {
  1427. type NoMethod StateNotificationConfig
  1428. raw := NoMethod(*s)
  1429. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1430. }
  1431. // Status: The `Status` type defines a logical error model that is
  1432. // suitable for
  1433. // different programming environments, including REST APIs and RPC APIs.
  1434. // It is
  1435. // used by [gRPC](https://github.com/grpc). The error model is designed
  1436. // to be:
  1437. //
  1438. // - Simple to use and understand for most users
  1439. // - Flexible enough to meet unexpected needs
  1440. //
  1441. // # Overview
  1442. //
  1443. // The `Status` message contains three pieces of data: error code,
  1444. // error
  1445. // message, and error details. The error code should be an enum value
  1446. // of
  1447. // google.rpc.Code, but it may accept additional error codes if needed.
  1448. // The
  1449. // error message should be a developer-facing English message that
  1450. // helps
  1451. // developers *understand* and *resolve* the error. If a localized
  1452. // user-facing
  1453. // error message is needed, put the localized message in the error
  1454. // details or
  1455. // localize it in the client. The optional error details may contain
  1456. // arbitrary
  1457. // information about the error. There is a predefined set of error
  1458. // detail types
  1459. // in the package `google.rpc` that can be used for common error
  1460. // conditions.
  1461. //
  1462. // # Language mapping
  1463. //
  1464. // The `Status` message is the logical representation of the error
  1465. // model, but it
  1466. // is not necessarily the actual wire format. When the `Status` message
  1467. // is
  1468. // exposed in different client libraries and different wire protocols,
  1469. // it can be
  1470. // mapped differently. For example, it will likely be mapped to some
  1471. // exceptions
  1472. // in Java, but more likely mapped to some error codes in C.
  1473. //
  1474. // # Other uses
  1475. //
  1476. // The error model and the `Status` message can be used in a variety
  1477. // of
  1478. // environments, either with or without APIs, to provide a
  1479. // consistent developer experience across different
  1480. // environments.
  1481. //
  1482. // Example uses of this error model include:
  1483. //
  1484. // - Partial errors. If a service needs to return partial errors to the
  1485. // client,
  1486. // it may embed the `Status` in the normal response to indicate the
  1487. // partial
  1488. // errors.
  1489. //
  1490. // - Workflow errors. A typical workflow has multiple steps. Each step
  1491. // may
  1492. // have a `Status` message for error reporting.
  1493. //
  1494. // - Batch operations. If a client uses batch request and batch
  1495. // response, the
  1496. // `Status` message should be used directly inside batch response,
  1497. // one for
  1498. // each error sub-response.
  1499. //
  1500. // - Asynchronous operations. If an API call embeds asynchronous
  1501. // operation
  1502. // results in its response, the status of those operations should
  1503. // be
  1504. // represented directly using the `Status` message.
  1505. //
  1506. // - Logging. If some API errors are stored in logs, the message
  1507. // `Status` could
  1508. // be used directly after any stripping needed for security/privacy
  1509. // reasons.
  1510. type Status struct {
  1511. // Code: The status code, which should be an enum value of
  1512. // google.rpc.Code.
  1513. Code int64 `json:"code,omitempty"`
  1514. // Details: A list of messages that carry the error details. There is a
  1515. // common set of
  1516. // message types for APIs to use.
  1517. Details []googleapi.RawMessage `json:"details,omitempty"`
  1518. // Message: A developer-facing error message, which should be in
  1519. // English. Any
  1520. // user-facing error message should be localized and sent in
  1521. // the
  1522. // google.rpc.Status.details field, or localized by the client.
  1523. Message string `json:"message,omitempty"`
  1524. // ForceSendFields is a list of field names (e.g. "Code") to
  1525. // unconditionally include in API requests. By default, fields with
  1526. // empty values are omitted from API requests. However, any non-pointer,
  1527. // non-interface field appearing in ForceSendFields will be sent to the
  1528. // server regardless of whether the field is empty or not. This may be
  1529. // used to include empty fields in Patch requests.
  1530. ForceSendFields []string `json:"-"`
  1531. // NullFields is a list of field names (e.g. "Code") to include in API
  1532. // requests with the JSON null value. By default, fields with empty
  1533. // values are omitted from API requests. However, any field with an
  1534. // empty value appearing in NullFields will be sent to the server as
  1535. // null. It is an error if a field in this list has a non-empty value.
  1536. // This may be used to include null fields in Patch requests.
  1537. NullFields []string `json:"-"`
  1538. }
  1539. func (s *Status) MarshalJSON() ([]byte, error) {
  1540. type NoMethod Status
  1541. raw := NoMethod(*s)
  1542. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1543. }
  1544. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  1545. // method.
  1546. type TestIamPermissionsRequest struct {
  1547. // Permissions: The set of permissions to check for the `resource`.
  1548. // Permissions with
  1549. // wildcards (such as '*' or 'storage.*') are not allowed. For
  1550. // more
  1551. // information see
  1552. // [IAM
  1553. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  1554. Permissions []string `json:"permissions,omitempty"`
  1555. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1556. // unconditionally include in API requests. By default, fields with
  1557. // empty values are omitted from API requests. However, any non-pointer,
  1558. // non-interface field appearing in ForceSendFields will be sent to the
  1559. // server regardless of whether the field is empty or not. This may be
  1560. // used to include empty fields in Patch requests.
  1561. ForceSendFields []string `json:"-"`
  1562. // NullFields is a list of field names (e.g. "Permissions") to include
  1563. // in API requests with the JSON null value. By default, fields with
  1564. // empty values are omitted from API requests. However, any field with
  1565. // an empty value appearing in NullFields will be sent to the server as
  1566. // null. It is an error if a field in this list has a non-empty value.
  1567. // This may be used to include null fields in Patch requests.
  1568. NullFields []string `json:"-"`
  1569. }
  1570. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  1571. type NoMethod TestIamPermissionsRequest
  1572. raw := NoMethod(*s)
  1573. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1574. }
  1575. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1576. // method.
  1577. type TestIamPermissionsResponse struct {
  1578. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1579. // the caller is
  1580. // allowed.
  1581. Permissions []string `json:"permissions,omitempty"`
  1582. // ServerResponse contains the HTTP response code and headers from the
  1583. // server.
  1584. googleapi.ServerResponse `json:"-"`
  1585. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1586. // unconditionally include in API requests. By default, fields with
  1587. // empty values are omitted from API requests. However, any non-pointer,
  1588. // non-interface field appearing in ForceSendFields will be sent to the
  1589. // server regardless of whether the field is empty or not. This may be
  1590. // used to include empty fields in Patch requests.
  1591. ForceSendFields []string `json:"-"`
  1592. // NullFields is a list of field names (e.g. "Permissions") to include
  1593. // in API requests with the JSON null value. By default, fields with
  1594. // empty values are omitted from API requests. However, any field with
  1595. // an empty value appearing in NullFields will be sent to the server as
  1596. // null. It is an error if a field in this list has a non-empty value.
  1597. // This may be used to include null fields in Patch requests.
  1598. NullFields []string `json:"-"`
  1599. }
  1600. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1601. type NoMethod TestIamPermissionsResponse
  1602. raw := NoMethod(*s)
  1603. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1604. }
  1605. // UnbindDeviceFromGatewayRequest: Request for
  1606. // `UnbindDeviceFromGateway`.
  1607. type UnbindDeviceFromGatewayRequest struct {
  1608. // DeviceId: The device to disassociate from the specified gateway. The
  1609. // value of
  1610. // `device_id` can be either the device numeric ID or the user-defined
  1611. // device
  1612. // identifier.
  1613. DeviceId string `json:"deviceId,omitempty"`
  1614. // GatewayId: The value of `gateway_id` can be either the device numeric
  1615. // ID or the
  1616. // user-defined device identifier.
  1617. GatewayId string `json:"gatewayId,omitempty"`
  1618. // ForceSendFields is a list of field names (e.g. "DeviceId") to
  1619. // unconditionally include in API requests. By default, fields with
  1620. // empty values are omitted from API requests. However, any non-pointer,
  1621. // non-interface field appearing in ForceSendFields will be sent to the
  1622. // server regardless of whether the field is empty or not. This may be
  1623. // used to include empty fields in Patch requests.
  1624. ForceSendFields []string `json:"-"`
  1625. // NullFields is a list of field names (e.g. "DeviceId") to include in
  1626. // API requests with the JSON null value. By default, fields with empty
  1627. // values are omitted from API requests. However, any field with an
  1628. // empty value appearing in NullFields will be sent to the server as
  1629. // null. It is an error if a field in this list has a non-empty value.
  1630. // This may be used to include null fields in Patch requests.
  1631. NullFields []string `json:"-"`
  1632. }
  1633. func (s *UnbindDeviceFromGatewayRequest) MarshalJSON() ([]byte, error) {
  1634. type NoMethod UnbindDeviceFromGatewayRequest
  1635. raw := NoMethod(*s)
  1636. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1637. }
  1638. // UnbindDeviceFromGatewayResponse: Response for
  1639. // `UnbindDeviceFromGateway`.
  1640. type UnbindDeviceFromGatewayResponse struct {
  1641. // ServerResponse contains the HTTP response code and headers from the
  1642. // server.
  1643. googleapi.ServerResponse `json:"-"`
  1644. }
  1645. // X509CertificateDetails: Details of an X.509 certificate. For
  1646. // informational purposes only.
  1647. type X509CertificateDetails struct {
  1648. // ExpiryTime: The time the certificate becomes invalid.
  1649. ExpiryTime string `json:"expiryTime,omitempty"`
  1650. // Issuer: The entity that signed the certificate.
  1651. Issuer string `json:"issuer,omitempty"`
  1652. // PublicKeyType: The type of public key in the certificate.
  1653. PublicKeyType string `json:"publicKeyType,omitempty"`
  1654. // SignatureAlgorithm: The algorithm used to sign the certificate.
  1655. SignatureAlgorithm string `json:"signatureAlgorithm,omitempty"`
  1656. // StartTime: The time the certificate becomes valid.
  1657. StartTime string `json:"startTime,omitempty"`
  1658. // Subject: The entity the certificate and public key belong to.
  1659. Subject string `json:"subject,omitempty"`
  1660. // ForceSendFields is a list of field names (e.g. "ExpiryTime") to
  1661. // unconditionally include in API requests. By default, fields with
  1662. // empty values are omitted from API requests. However, any non-pointer,
  1663. // non-interface field appearing in ForceSendFields will be sent to the
  1664. // server regardless of whether the field is empty or not. This may be
  1665. // used to include empty fields in Patch requests.
  1666. ForceSendFields []string `json:"-"`
  1667. // NullFields is a list of field names (e.g. "ExpiryTime") to include in
  1668. // API requests with the JSON null value. By default, fields with empty
  1669. // values are omitted from API requests. However, any field with an
  1670. // empty value appearing in NullFields will be sent to the server as
  1671. // null. It is an error if a field in this list has a non-empty value.
  1672. // This may be used to include null fields in Patch requests.
  1673. NullFields []string `json:"-"`
  1674. }
  1675. func (s *X509CertificateDetails) MarshalJSON() ([]byte, error) {
  1676. type NoMethod X509CertificateDetails
  1677. raw := NoMethod(*s)
  1678. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1679. }
  1680. // method id "cloudiot.projects.locations.registries.bindDeviceToGateway":
  1681. type ProjectsLocationsRegistriesBindDeviceToGatewayCall struct {
  1682. s *Service
  1683. parent string
  1684. binddevicetogatewayrequest *BindDeviceToGatewayRequest
  1685. urlParams_ gensupport.URLParams
  1686. ctx_ context.Context
  1687. header_ http.Header
  1688. }
  1689. // BindDeviceToGateway: Associates the device with the gateway.
  1690. func (r *ProjectsLocationsRegistriesService) BindDeviceToGateway(parent string, binddevicetogatewayrequest *BindDeviceToGatewayRequest) *ProjectsLocationsRegistriesBindDeviceToGatewayCall {
  1691. c := &ProjectsLocationsRegistriesBindDeviceToGatewayCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1692. c.parent = parent
  1693. c.binddevicetogatewayrequest = binddevicetogatewayrequest
  1694. return c
  1695. }
  1696. // Fields allows partial responses to be retrieved. See
  1697. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1698. // for more information.
  1699. func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesBindDeviceToGatewayCall {
  1700. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1701. return c
  1702. }
  1703. // Context sets the context to be used in this call's Do method. Any
  1704. // pending HTTP request will be aborted if the provided context is
  1705. // canceled.
  1706. func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) Context(ctx context.Context) *ProjectsLocationsRegistriesBindDeviceToGatewayCall {
  1707. c.ctx_ = ctx
  1708. return c
  1709. }
  1710. // Header returns an http.Header that can be modified by the caller to
  1711. // add HTTP headers to the request.
  1712. func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) Header() http.Header {
  1713. if c.header_ == nil {
  1714. c.header_ = make(http.Header)
  1715. }
  1716. return c.header_
  1717. }
  1718. func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) doRequest(alt string) (*http.Response, error) {
  1719. reqHeaders := make(http.Header)
  1720. for k, v := range c.header_ {
  1721. reqHeaders[k] = v
  1722. }
  1723. reqHeaders.Set("User-Agent", c.s.userAgent())
  1724. var body io.Reader = nil
  1725. body, err := googleapi.WithoutDataWrapper.JSONReader(c.binddevicetogatewayrequest)
  1726. if err != nil {
  1727. return nil, err
  1728. }
  1729. reqHeaders.Set("Content-Type", "application/json")
  1730. c.urlParams_.Set("alt", alt)
  1731. c.urlParams_.Set("prettyPrint", "false")
  1732. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:bindDeviceToGateway")
  1733. urls += "?" + c.urlParams_.Encode()
  1734. req, err := http.NewRequest("POST", urls, body)
  1735. if err != nil {
  1736. return nil, err
  1737. }
  1738. req.Header = reqHeaders
  1739. googleapi.Expand(req.URL, map[string]string{
  1740. "parent": c.parent,
  1741. })
  1742. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1743. }
  1744. // Do executes the "cloudiot.projects.locations.registries.bindDeviceToGateway" call.
  1745. // Exactly one of *BindDeviceToGatewayResponse or error will be non-nil.
  1746. // Any non-2xx status code is an error. Response headers are in either
  1747. // *BindDeviceToGatewayResponse.ServerResponse.Header or (if a response
  1748. // was returned at all) in error.(*googleapi.Error).Header. Use
  1749. // googleapi.IsNotModified to check whether the returned error was
  1750. // because http.StatusNotModified was returned.
  1751. func (c *ProjectsLocationsRegistriesBindDeviceToGatewayCall) Do(opts ...googleapi.CallOption) (*BindDeviceToGatewayResponse, error) {
  1752. gensupport.SetOptions(c.urlParams_, opts...)
  1753. res, err := c.doRequest("json")
  1754. if res != nil && res.StatusCode == http.StatusNotModified {
  1755. if res.Body != nil {
  1756. res.Body.Close()
  1757. }
  1758. return nil, &googleapi.Error{
  1759. Code: res.StatusCode,
  1760. Header: res.Header,
  1761. }
  1762. }
  1763. if err != nil {
  1764. return nil, err
  1765. }
  1766. defer googleapi.CloseBody(res)
  1767. if err := googleapi.CheckResponse(res); err != nil {
  1768. return nil, err
  1769. }
  1770. ret := &BindDeviceToGatewayResponse{
  1771. ServerResponse: googleapi.ServerResponse{
  1772. Header: res.Header,
  1773. HTTPStatusCode: res.StatusCode,
  1774. },
  1775. }
  1776. target := &ret
  1777. if err := gensupport.DecodeResponse(target, res); err != nil {
  1778. return nil, err
  1779. }
  1780. return ret, nil
  1781. // {
  1782. // "description": "Associates the device with the gateway.",
  1783. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:bindDeviceToGateway",
  1784. // "httpMethod": "POST",
  1785. // "id": "cloudiot.projects.locations.registries.bindDeviceToGateway",
  1786. // "parameterOrder": [
  1787. // "parent"
  1788. // ],
  1789. // "parameters": {
  1790. // "parent": {
  1791. // "description": "The name of the registry. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  1792. // "location": "path",
  1793. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  1794. // "required": true,
  1795. // "type": "string"
  1796. // }
  1797. // },
  1798. // "path": "v1/{+parent}:bindDeviceToGateway",
  1799. // "request": {
  1800. // "$ref": "BindDeviceToGatewayRequest"
  1801. // },
  1802. // "response": {
  1803. // "$ref": "BindDeviceToGatewayResponse"
  1804. // },
  1805. // "scopes": [
  1806. // "https://www.googleapis.com/auth/cloud-platform",
  1807. // "https://www.googleapis.com/auth/cloudiot"
  1808. // ]
  1809. // }
  1810. }
  1811. // method id "cloudiot.projects.locations.registries.create":
  1812. type ProjectsLocationsRegistriesCreateCall struct {
  1813. s *Service
  1814. parent string
  1815. deviceregistry *DeviceRegistry
  1816. urlParams_ gensupport.URLParams
  1817. ctx_ context.Context
  1818. header_ http.Header
  1819. }
  1820. // Create: Creates a device registry that contains devices.
  1821. func (r *ProjectsLocationsRegistriesService) Create(parent string, deviceregistry *DeviceRegistry) *ProjectsLocationsRegistriesCreateCall {
  1822. c := &ProjectsLocationsRegistriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1823. c.parent = parent
  1824. c.deviceregistry = deviceregistry
  1825. return c
  1826. }
  1827. // Fields allows partial responses to be retrieved. See
  1828. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1829. // for more information.
  1830. func (c *ProjectsLocationsRegistriesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesCreateCall {
  1831. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1832. return c
  1833. }
  1834. // Context sets the context to be used in this call's Do method. Any
  1835. // pending HTTP request will be aborted if the provided context is
  1836. // canceled.
  1837. func (c *ProjectsLocationsRegistriesCreateCall) Context(ctx context.Context) *ProjectsLocationsRegistriesCreateCall {
  1838. c.ctx_ = ctx
  1839. return c
  1840. }
  1841. // Header returns an http.Header that can be modified by the caller to
  1842. // add HTTP headers to the request.
  1843. func (c *ProjectsLocationsRegistriesCreateCall) Header() http.Header {
  1844. if c.header_ == nil {
  1845. c.header_ = make(http.Header)
  1846. }
  1847. return c.header_
  1848. }
  1849. func (c *ProjectsLocationsRegistriesCreateCall) doRequest(alt string) (*http.Response, error) {
  1850. reqHeaders := make(http.Header)
  1851. for k, v := range c.header_ {
  1852. reqHeaders[k] = v
  1853. }
  1854. reqHeaders.Set("User-Agent", c.s.userAgent())
  1855. var body io.Reader = nil
  1856. body, err := googleapi.WithoutDataWrapper.JSONReader(c.deviceregistry)
  1857. if err != nil {
  1858. return nil, err
  1859. }
  1860. reqHeaders.Set("Content-Type", "application/json")
  1861. c.urlParams_.Set("alt", alt)
  1862. c.urlParams_.Set("prettyPrint", "false")
  1863. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/registries")
  1864. urls += "?" + c.urlParams_.Encode()
  1865. req, err := http.NewRequest("POST", urls, body)
  1866. if err != nil {
  1867. return nil, err
  1868. }
  1869. req.Header = reqHeaders
  1870. googleapi.Expand(req.URL, map[string]string{
  1871. "parent": c.parent,
  1872. })
  1873. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1874. }
  1875. // Do executes the "cloudiot.projects.locations.registries.create" call.
  1876. // Exactly one of *DeviceRegistry or error will be non-nil. Any non-2xx
  1877. // status code is an error. Response headers are in either
  1878. // *DeviceRegistry.ServerResponse.Header or (if a response was returned
  1879. // at all) in error.(*googleapi.Error).Header. Use
  1880. // googleapi.IsNotModified to check whether the returned error was
  1881. // because http.StatusNotModified was returned.
  1882. func (c *ProjectsLocationsRegistriesCreateCall) Do(opts ...googleapi.CallOption) (*DeviceRegistry, error) {
  1883. gensupport.SetOptions(c.urlParams_, opts...)
  1884. res, err := c.doRequest("json")
  1885. if res != nil && res.StatusCode == http.StatusNotModified {
  1886. if res.Body != nil {
  1887. res.Body.Close()
  1888. }
  1889. return nil, &googleapi.Error{
  1890. Code: res.StatusCode,
  1891. Header: res.Header,
  1892. }
  1893. }
  1894. if err != nil {
  1895. return nil, err
  1896. }
  1897. defer googleapi.CloseBody(res)
  1898. if err := googleapi.CheckResponse(res); err != nil {
  1899. return nil, err
  1900. }
  1901. ret := &DeviceRegistry{
  1902. ServerResponse: googleapi.ServerResponse{
  1903. Header: res.Header,
  1904. HTTPStatusCode: res.StatusCode,
  1905. },
  1906. }
  1907. target := &ret
  1908. if err := gensupport.DecodeResponse(target, res); err != nil {
  1909. return nil, err
  1910. }
  1911. return ret, nil
  1912. // {
  1913. // "description": "Creates a device registry that contains devices.",
  1914. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries",
  1915. // "httpMethod": "POST",
  1916. // "id": "cloudiot.projects.locations.registries.create",
  1917. // "parameterOrder": [
  1918. // "parent"
  1919. // ],
  1920. // "parameters": {
  1921. // "parent": {
  1922. // "description": "The project and cloud region where this device registry must be created.\nFor example, `projects/example-project/locations/us-central1`.",
  1923. // "location": "path",
  1924. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1925. // "required": true,
  1926. // "type": "string"
  1927. // }
  1928. // },
  1929. // "path": "v1/{+parent}/registries",
  1930. // "request": {
  1931. // "$ref": "DeviceRegistry"
  1932. // },
  1933. // "response": {
  1934. // "$ref": "DeviceRegistry"
  1935. // },
  1936. // "scopes": [
  1937. // "https://www.googleapis.com/auth/cloud-platform",
  1938. // "https://www.googleapis.com/auth/cloudiot"
  1939. // ]
  1940. // }
  1941. }
  1942. // method id "cloudiot.projects.locations.registries.delete":
  1943. type ProjectsLocationsRegistriesDeleteCall struct {
  1944. s *Service
  1945. name string
  1946. urlParams_ gensupport.URLParams
  1947. ctx_ context.Context
  1948. header_ http.Header
  1949. }
  1950. // Delete: Deletes a device registry configuration.
  1951. func (r *ProjectsLocationsRegistriesService) Delete(name string) *ProjectsLocationsRegistriesDeleteCall {
  1952. c := &ProjectsLocationsRegistriesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1953. c.name = name
  1954. return c
  1955. }
  1956. // Fields allows partial responses to be retrieved. See
  1957. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1958. // for more information.
  1959. func (c *ProjectsLocationsRegistriesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDeleteCall {
  1960. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1961. return c
  1962. }
  1963. // Context sets the context to be used in this call's Do method. Any
  1964. // pending HTTP request will be aborted if the provided context is
  1965. // canceled.
  1966. func (c *ProjectsLocationsRegistriesDeleteCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDeleteCall {
  1967. c.ctx_ = ctx
  1968. return c
  1969. }
  1970. // Header returns an http.Header that can be modified by the caller to
  1971. // add HTTP headers to the request.
  1972. func (c *ProjectsLocationsRegistriesDeleteCall) Header() http.Header {
  1973. if c.header_ == nil {
  1974. c.header_ = make(http.Header)
  1975. }
  1976. return c.header_
  1977. }
  1978. func (c *ProjectsLocationsRegistriesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1979. reqHeaders := make(http.Header)
  1980. for k, v := range c.header_ {
  1981. reqHeaders[k] = v
  1982. }
  1983. reqHeaders.Set("User-Agent", c.s.userAgent())
  1984. var body io.Reader = nil
  1985. c.urlParams_.Set("alt", alt)
  1986. c.urlParams_.Set("prettyPrint", "false")
  1987. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1988. urls += "?" + c.urlParams_.Encode()
  1989. req, err := http.NewRequest("DELETE", urls, body)
  1990. if err != nil {
  1991. return nil, err
  1992. }
  1993. req.Header = reqHeaders
  1994. googleapi.Expand(req.URL, map[string]string{
  1995. "name": c.name,
  1996. })
  1997. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1998. }
  1999. // Do executes the "cloudiot.projects.locations.registries.delete" call.
  2000. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2001. // code is an error. Response headers are in either
  2002. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2003. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2004. // check whether the returned error was because http.StatusNotModified
  2005. // was returned.
  2006. func (c *ProjectsLocationsRegistriesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2007. gensupport.SetOptions(c.urlParams_, opts...)
  2008. res, err := c.doRequest("json")
  2009. if res != nil && res.StatusCode == http.StatusNotModified {
  2010. if res.Body != nil {
  2011. res.Body.Close()
  2012. }
  2013. return nil, &googleapi.Error{
  2014. Code: res.StatusCode,
  2015. Header: res.Header,
  2016. }
  2017. }
  2018. if err != nil {
  2019. return nil, err
  2020. }
  2021. defer googleapi.CloseBody(res)
  2022. if err := googleapi.CheckResponse(res); err != nil {
  2023. return nil, err
  2024. }
  2025. ret := &Empty{
  2026. ServerResponse: googleapi.ServerResponse{
  2027. Header: res.Header,
  2028. HTTPStatusCode: res.StatusCode,
  2029. },
  2030. }
  2031. target := &ret
  2032. if err := gensupport.DecodeResponse(target, res); err != nil {
  2033. return nil, err
  2034. }
  2035. return ret, nil
  2036. // {
  2037. // "description": "Deletes a device registry configuration.",
  2038. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}",
  2039. // "httpMethod": "DELETE",
  2040. // "id": "cloudiot.projects.locations.registries.delete",
  2041. // "parameterOrder": [
  2042. // "name"
  2043. // ],
  2044. // "parameters": {
  2045. // "name": {
  2046. // "description": "The name of the device registry. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  2047. // "location": "path",
  2048. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2049. // "required": true,
  2050. // "type": "string"
  2051. // }
  2052. // },
  2053. // "path": "v1/{+name}",
  2054. // "response": {
  2055. // "$ref": "Empty"
  2056. // },
  2057. // "scopes": [
  2058. // "https://www.googleapis.com/auth/cloud-platform",
  2059. // "https://www.googleapis.com/auth/cloudiot"
  2060. // ]
  2061. // }
  2062. }
  2063. // method id "cloudiot.projects.locations.registries.get":
  2064. type ProjectsLocationsRegistriesGetCall struct {
  2065. s *Service
  2066. name string
  2067. urlParams_ gensupport.URLParams
  2068. ifNoneMatch_ string
  2069. ctx_ context.Context
  2070. header_ http.Header
  2071. }
  2072. // Get: Gets a device registry configuration.
  2073. func (r *ProjectsLocationsRegistriesService) Get(name string) *ProjectsLocationsRegistriesGetCall {
  2074. c := &ProjectsLocationsRegistriesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2075. c.name = name
  2076. return c
  2077. }
  2078. // Fields allows partial responses to be retrieved. See
  2079. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2080. // for more information.
  2081. func (c *ProjectsLocationsRegistriesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGetCall {
  2082. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2083. return c
  2084. }
  2085. // IfNoneMatch sets the optional parameter which makes the operation
  2086. // fail if the object's ETag matches the given value. This is useful for
  2087. // getting updates only after the object has changed since the last
  2088. // request. Use googleapi.IsNotModified to check whether the response
  2089. // error from Do is the result of In-None-Match.
  2090. func (c *ProjectsLocationsRegistriesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesGetCall {
  2091. c.ifNoneMatch_ = entityTag
  2092. return c
  2093. }
  2094. // Context sets the context to be used in this call's Do method. Any
  2095. // pending HTTP request will be aborted if the provided context is
  2096. // canceled.
  2097. func (c *ProjectsLocationsRegistriesGetCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGetCall {
  2098. c.ctx_ = ctx
  2099. return c
  2100. }
  2101. // Header returns an http.Header that can be modified by the caller to
  2102. // add HTTP headers to the request.
  2103. func (c *ProjectsLocationsRegistriesGetCall) Header() http.Header {
  2104. if c.header_ == nil {
  2105. c.header_ = make(http.Header)
  2106. }
  2107. return c.header_
  2108. }
  2109. func (c *ProjectsLocationsRegistriesGetCall) doRequest(alt string) (*http.Response, error) {
  2110. reqHeaders := make(http.Header)
  2111. for k, v := range c.header_ {
  2112. reqHeaders[k] = v
  2113. }
  2114. reqHeaders.Set("User-Agent", c.s.userAgent())
  2115. if c.ifNoneMatch_ != "" {
  2116. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2117. }
  2118. var body io.Reader = nil
  2119. c.urlParams_.Set("alt", alt)
  2120. c.urlParams_.Set("prettyPrint", "false")
  2121. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2122. urls += "?" + c.urlParams_.Encode()
  2123. req, err := http.NewRequest("GET", urls, body)
  2124. if err != nil {
  2125. return nil, err
  2126. }
  2127. req.Header = reqHeaders
  2128. googleapi.Expand(req.URL, map[string]string{
  2129. "name": c.name,
  2130. })
  2131. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2132. }
  2133. // Do executes the "cloudiot.projects.locations.registries.get" call.
  2134. // Exactly one of *DeviceRegistry or error will be non-nil. Any non-2xx
  2135. // status code is an error. Response headers are in either
  2136. // *DeviceRegistry.ServerResponse.Header or (if a response was returned
  2137. // at all) in error.(*googleapi.Error).Header. Use
  2138. // googleapi.IsNotModified to check whether the returned error was
  2139. // because http.StatusNotModified was returned.
  2140. func (c *ProjectsLocationsRegistriesGetCall) Do(opts ...googleapi.CallOption) (*DeviceRegistry, error) {
  2141. gensupport.SetOptions(c.urlParams_, opts...)
  2142. res, err := c.doRequest("json")
  2143. if res != nil && res.StatusCode == http.StatusNotModified {
  2144. if res.Body != nil {
  2145. res.Body.Close()
  2146. }
  2147. return nil, &googleapi.Error{
  2148. Code: res.StatusCode,
  2149. Header: res.Header,
  2150. }
  2151. }
  2152. if err != nil {
  2153. return nil, err
  2154. }
  2155. defer googleapi.CloseBody(res)
  2156. if err := googleapi.CheckResponse(res); err != nil {
  2157. return nil, err
  2158. }
  2159. ret := &DeviceRegistry{
  2160. ServerResponse: googleapi.ServerResponse{
  2161. Header: res.Header,
  2162. HTTPStatusCode: res.StatusCode,
  2163. },
  2164. }
  2165. target := &ret
  2166. if err := gensupport.DecodeResponse(target, res); err != nil {
  2167. return nil, err
  2168. }
  2169. return ret, nil
  2170. // {
  2171. // "description": "Gets a device registry configuration.",
  2172. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}",
  2173. // "httpMethod": "GET",
  2174. // "id": "cloudiot.projects.locations.registries.get",
  2175. // "parameterOrder": [
  2176. // "name"
  2177. // ],
  2178. // "parameters": {
  2179. // "name": {
  2180. // "description": "The name of the device registry. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  2181. // "location": "path",
  2182. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2183. // "required": true,
  2184. // "type": "string"
  2185. // }
  2186. // },
  2187. // "path": "v1/{+name}",
  2188. // "response": {
  2189. // "$ref": "DeviceRegistry"
  2190. // },
  2191. // "scopes": [
  2192. // "https://www.googleapis.com/auth/cloud-platform",
  2193. // "https://www.googleapis.com/auth/cloudiot"
  2194. // ]
  2195. // }
  2196. }
  2197. // method id "cloudiot.projects.locations.registries.getIamPolicy":
  2198. type ProjectsLocationsRegistriesGetIamPolicyCall struct {
  2199. s *Service
  2200. resource string
  2201. getiampolicyrequest *GetIamPolicyRequest
  2202. urlParams_ gensupport.URLParams
  2203. ctx_ context.Context
  2204. header_ http.Header
  2205. }
  2206. // GetIamPolicy: Gets the access control policy for a resource.
  2207. // Returns an empty policy if the resource exists and does not have a
  2208. // policy
  2209. // set.
  2210. func (r *ProjectsLocationsRegistriesService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsLocationsRegistriesGetIamPolicyCall {
  2211. c := &ProjectsLocationsRegistriesGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2212. c.resource = resource
  2213. c.getiampolicyrequest = getiampolicyrequest
  2214. return c
  2215. }
  2216. // Fields allows partial responses to be retrieved. See
  2217. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2218. // for more information.
  2219. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGetIamPolicyCall {
  2220. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2221. return c
  2222. }
  2223. // Context sets the context to be used in this call's Do method. Any
  2224. // pending HTTP request will be aborted if the provided context is
  2225. // canceled.
  2226. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGetIamPolicyCall {
  2227. c.ctx_ = ctx
  2228. return c
  2229. }
  2230. // Header returns an http.Header that can be modified by the caller to
  2231. // add HTTP headers to the request.
  2232. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Header() http.Header {
  2233. if c.header_ == nil {
  2234. c.header_ = make(http.Header)
  2235. }
  2236. return c.header_
  2237. }
  2238. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2239. reqHeaders := make(http.Header)
  2240. for k, v := range c.header_ {
  2241. reqHeaders[k] = v
  2242. }
  2243. reqHeaders.Set("User-Agent", c.s.userAgent())
  2244. var body io.Reader = nil
  2245. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  2246. if err != nil {
  2247. return nil, err
  2248. }
  2249. reqHeaders.Set("Content-Type", "application/json")
  2250. c.urlParams_.Set("alt", alt)
  2251. c.urlParams_.Set("prettyPrint", "false")
  2252. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  2253. urls += "?" + c.urlParams_.Encode()
  2254. req, err := http.NewRequest("POST", urls, body)
  2255. if err != nil {
  2256. return nil, err
  2257. }
  2258. req.Header = reqHeaders
  2259. googleapi.Expand(req.URL, map[string]string{
  2260. "resource": c.resource,
  2261. })
  2262. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2263. }
  2264. // Do executes the "cloudiot.projects.locations.registries.getIamPolicy" call.
  2265. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2266. // code is an error. Response headers are in either
  2267. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2268. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2269. // check whether the returned error was because http.StatusNotModified
  2270. // was returned.
  2271. func (c *ProjectsLocationsRegistriesGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2272. gensupport.SetOptions(c.urlParams_, opts...)
  2273. res, err := c.doRequest("json")
  2274. if res != nil && res.StatusCode == http.StatusNotModified {
  2275. if res.Body != nil {
  2276. res.Body.Close()
  2277. }
  2278. return nil, &googleapi.Error{
  2279. Code: res.StatusCode,
  2280. Header: res.Header,
  2281. }
  2282. }
  2283. if err != nil {
  2284. return nil, err
  2285. }
  2286. defer googleapi.CloseBody(res)
  2287. if err := googleapi.CheckResponse(res); err != nil {
  2288. return nil, err
  2289. }
  2290. ret := &Policy{
  2291. ServerResponse: googleapi.ServerResponse{
  2292. Header: res.Header,
  2293. HTTPStatusCode: res.StatusCode,
  2294. },
  2295. }
  2296. target := &ret
  2297. if err := gensupport.DecodeResponse(target, res); err != nil {
  2298. return nil, err
  2299. }
  2300. return ret, nil
  2301. // {
  2302. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  2303. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:getIamPolicy",
  2304. // "httpMethod": "POST",
  2305. // "id": "cloudiot.projects.locations.registries.getIamPolicy",
  2306. // "parameterOrder": [
  2307. // "resource"
  2308. // ],
  2309. // "parameters": {
  2310. // "resource": {
  2311. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2312. // "location": "path",
  2313. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2314. // "required": true,
  2315. // "type": "string"
  2316. // }
  2317. // },
  2318. // "path": "v1/{+resource}:getIamPolicy",
  2319. // "request": {
  2320. // "$ref": "GetIamPolicyRequest"
  2321. // },
  2322. // "response": {
  2323. // "$ref": "Policy"
  2324. // },
  2325. // "scopes": [
  2326. // "https://www.googleapis.com/auth/cloud-platform",
  2327. // "https://www.googleapis.com/auth/cloudiot"
  2328. // ]
  2329. // }
  2330. }
  2331. // method id "cloudiot.projects.locations.registries.list":
  2332. type ProjectsLocationsRegistriesListCall struct {
  2333. s *Service
  2334. parent string
  2335. urlParams_ gensupport.URLParams
  2336. ifNoneMatch_ string
  2337. ctx_ context.Context
  2338. header_ http.Header
  2339. }
  2340. // List: Lists device registries.
  2341. func (r *ProjectsLocationsRegistriesService) List(parent string) *ProjectsLocationsRegistriesListCall {
  2342. c := &ProjectsLocationsRegistriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2343. c.parent = parent
  2344. return c
  2345. }
  2346. // PageSize sets the optional parameter "pageSize": The maximum number
  2347. // of registries to return in the response. If this value
  2348. // is zero, the service will select a default size. A call may return
  2349. // fewer
  2350. // objects than requested. A non-empty `next_page_token` in the
  2351. // response
  2352. // indicates that more data is available.
  2353. func (c *ProjectsLocationsRegistriesListCall) PageSize(pageSize int64) *ProjectsLocationsRegistriesListCall {
  2354. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2355. return c
  2356. }
  2357. // PageToken sets the optional parameter "pageToken": The value returned
  2358. // by the last `ListDeviceRegistriesResponse`; indicates
  2359. // that this is a continuation of a prior `ListDeviceRegistries` call
  2360. // and
  2361. // the system should return the next page of data.
  2362. func (c *ProjectsLocationsRegistriesListCall) PageToken(pageToken string) *ProjectsLocationsRegistriesListCall {
  2363. c.urlParams_.Set("pageToken", pageToken)
  2364. return c
  2365. }
  2366. // Fields allows partial responses to be retrieved. See
  2367. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2368. // for more information.
  2369. func (c *ProjectsLocationsRegistriesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesListCall {
  2370. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2371. return c
  2372. }
  2373. // IfNoneMatch sets the optional parameter which makes the operation
  2374. // fail if the object's ETag matches the given value. This is useful for
  2375. // getting updates only after the object has changed since the last
  2376. // request. Use googleapi.IsNotModified to check whether the response
  2377. // error from Do is the result of In-None-Match.
  2378. func (c *ProjectsLocationsRegistriesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesListCall {
  2379. c.ifNoneMatch_ = entityTag
  2380. return c
  2381. }
  2382. // Context sets the context to be used in this call's Do method. Any
  2383. // pending HTTP request will be aborted if the provided context is
  2384. // canceled.
  2385. func (c *ProjectsLocationsRegistriesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesListCall {
  2386. c.ctx_ = ctx
  2387. return c
  2388. }
  2389. // Header returns an http.Header that can be modified by the caller to
  2390. // add HTTP headers to the request.
  2391. func (c *ProjectsLocationsRegistriesListCall) Header() http.Header {
  2392. if c.header_ == nil {
  2393. c.header_ = make(http.Header)
  2394. }
  2395. return c.header_
  2396. }
  2397. func (c *ProjectsLocationsRegistriesListCall) doRequest(alt string) (*http.Response, error) {
  2398. reqHeaders := make(http.Header)
  2399. for k, v := range c.header_ {
  2400. reqHeaders[k] = v
  2401. }
  2402. reqHeaders.Set("User-Agent", c.s.userAgent())
  2403. if c.ifNoneMatch_ != "" {
  2404. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2405. }
  2406. var body io.Reader = nil
  2407. c.urlParams_.Set("alt", alt)
  2408. c.urlParams_.Set("prettyPrint", "false")
  2409. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/registries")
  2410. urls += "?" + c.urlParams_.Encode()
  2411. req, err := http.NewRequest("GET", urls, body)
  2412. if err != nil {
  2413. return nil, err
  2414. }
  2415. req.Header = reqHeaders
  2416. googleapi.Expand(req.URL, map[string]string{
  2417. "parent": c.parent,
  2418. })
  2419. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2420. }
  2421. // Do executes the "cloudiot.projects.locations.registries.list" call.
  2422. // Exactly one of *ListDeviceRegistriesResponse or error will be
  2423. // non-nil. Any non-2xx status code is an error. Response headers are in
  2424. // either *ListDeviceRegistriesResponse.ServerResponse.Header or (if a
  2425. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2426. // googleapi.IsNotModified to check whether the returned error was
  2427. // because http.StatusNotModified was returned.
  2428. func (c *ProjectsLocationsRegistriesListCall) Do(opts ...googleapi.CallOption) (*ListDeviceRegistriesResponse, error) {
  2429. gensupport.SetOptions(c.urlParams_, opts...)
  2430. res, err := c.doRequest("json")
  2431. if res != nil && res.StatusCode == http.StatusNotModified {
  2432. if res.Body != nil {
  2433. res.Body.Close()
  2434. }
  2435. return nil, &googleapi.Error{
  2436. Code: res.StatusCode,
  2437. Header: res.Header,
  2438. }
  2439. }
  2440. if err != nil {
  2441. return nil, err
  2442. }
  2443. defer googleapi.CloseBody(res)
  2444. if err := googleapi.CheckResponse(res); err != nil {
  2445. return nil, err
  2446. }
  2447. ret := &ListDeviceRegistriesResponse{
  2448. ServerResponse: googleapi.ServerResponse{
  2449. Header: res.Header,
  2450. HTTPStatusCode: res.StatusCode,
  2451. },
  2452. }
  2453. target := &ret
  2454. if err := gensupport.DecodeResponse(target, res); err != nil {
  2455. return nil, err
  2456. }
  2457. return ret, nil
  2458. // {
  2459. // "description": "Lists device registries.",
  2460. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries",
  2461. // "httpMethod": "GET",
  2462. // "id": "cloudiot.projects.locations.registries.list",
  2463. // "parameterOrder": [
  2464. // "parent"
  2465. // ],
  2466. // "parameters": {
  2467. // "pageSize": {
  2468. // "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. A non-empty `next_page_token` in the response\nindicates that more data is available.",
  2469. // "format": "int32",
  2470. // "location": "query",
  2471. // "type": "integer"
  2472. // },
  2473. // "pageToken": {
  2474. // "description": "The value returned by the last `ListDeviceRegistriesResponse`; indicates\nthat this is a continuation of a prior `ListDeviceRegistries` call and\nthe system should return the next page of data.",
  2475. // "location": "query",
  2476. // "type": "string"
  2477. // },
  2478. // "parent": {
  2479. // "description": "The project and cloud region path. For example,\n`projects/example-project/locations/us-central1`.",
  2480. // "location": "path",
  2481. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2482. // "required": true,
  2483. // "type": "string"
  2484. // }
  2485. // },
  2486. // "path": "v1/{+parent}/registries",
  2487. // "response": {
  2488. // "$ref": "ListDeviceRegistriesResponse"
  2489. // },
  2490. // "scopes": [
  2491. // "https://www.googleapis.com/auth/cloud-platform",
  2492. // "https://www.googleapis.com/auth/cloudiot"
  2493. // ]
  2494. // }
  2495. }
  2496. // Pages invokes f for each page of results.
  2497. // A non-nil error returned from f will halt the iteration.
  2498. // The provided context supersedes any context provided to the Context method.
  2499. func (c *ProjectsLocationsRegistriesListCall) Pages(ctx context.Context, f func(*ListDeviceRegistriesResponse) error) error {
  2500. c.ctx_ = ctx
  2501. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2502. for {
  2503. x, err := c.Do()
  2504. if err != nil {
  2505. return err
  2506. }
  2507. if err := f(x); err != nil {
  2508. return err
  2509. }
  2510. if x.NextPageToken == "" {
  2511. return nil
  2512. }
  2513. c.PageToken(x.NextPageToken)
  2514. }
  2515. }
  2516. // method id "cloudiot.projects.locations.registries.patch":
  2517. type ProjectsLocationsRegistriesPatchCall struct {
  2518. s *Service
  2519. name string
  2520. deviceregistry *DeviceRegistry
  2521. urlParams_ gensupport.URLParams
  2522. ctx_ context.Context
  2523. header_ http.Header
  2524. }
  2525. // Patch: Updates a device registry configuration.
  2526. func (r *ProjectsLocationsRegistriesService) Patch(name string, deviceregistry *DeviceRegistry) *ProjectsLocationsRegistriesPatchCall {
  2527. c := &ProjectsLocationsRegistriesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2528. c.name = name
  2529. c.deviceregistry = deviceregistry
  2530. return c
  2531. }
  2532. // UpdateMask sets the optional parameter "updateMask": Only updates the
  2533. // `device_registry` fields indicated by this mask.
  2534. // The field mask must not be empty, and it must not contain fields
  2535. // that
  2536. // are immutable or only set by the server.
  2537. // Mutable top-level fields: `event_notification_config`,
  2538. // `http_config`,
  2539. // `mqtt_config`, and `state_notification_config`.
  2540. func (c *ProjectsLocationsRegistriesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsRegistriesPatchCall {
  2541. c.urlParams_.Set("updateMask", updateMask)
  2542. return c
  2543. }
  2544. // Fields allows partial responses to be retrieved. See
  2545. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2546. // for more information.
  2547. func (c *ProjectsLocationsRegistriesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesPatchCall {
  2548. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2549. return c
  2550. }
  2551. // Context sets the context to be used in this call's Do method. Any
  2552. // pending HTTP request will be aborted if the provided context is
  2553. // canceled.
  2554. func (c *ProjectsLocationsRegistriesPatchCall) Context(ctx context.Context) *ProjectsLocationsRegistriesPatchCall {
  2555. c.ctx_ = ctx
  2556. return c
  2557. }
  2558. // Header returns an http.Header that can be modified by the caller to
  2559. // add HTTP headers to the request.
  2560. func (c *ProjectsLocationsRegistriesPatchCall) Header() http.Header {
  2561. if c.header_ == nil {
  2562. c.header_ = make(http.Header)
  2563. }
  2564. return c.header_
  2565. }
  2566. func (c *ProjectsLocationsRegistriesPatchCall) doRequest(alt string) (*http.Response, error) {
  2567. reqHeaders := make(http.Header)
  2568. for k, v := range c.header_ {
  2569. reqHeaders[k] = v
  2570. }
  2571. reqHeaders.Set("User-Agent", c.s.userAgent())
  2572. var body io.Reader = nil
  2573. body, err := googleapi.WithoutDataWrapper.JSONReader(c.deviceregistry)
  2574. if err != nil {
  2575. return nil, err
  2576. }
  2577. reqHeaders.Set("Content-Type", "application/json")
  2578. c.urlParams_.Set("alt", alt)
  2579. c.urlParams_.Set("prettyPrint", "false")
  2580. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2581. urls += "?" + c.urlParams_.Encode()
  2582. req, err := http.NewRequest("PATCH", urls, body)
  2583. if err != nil {
  2584. return nil, err
  2585. }
  2586. req.Header = reqHeaders
  2587. googleapi.Expand(req.URL, map[string]string{
  2588. "name": c.name,
  2589. })
  2590. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2591. }
  2592. // Do executes the "cloudiot.projects.locations.registries.patch" call.
  2593. // Exactly one of *DeviceRegistry or error will be non-nil. Any non-2xx
  2594. // status code is an error. Response headers are in either
  2595. // *DeviceRegistry.ServerResponse.Header or (if a response was returned
  2596. // at all) in error.(*googleapi.Error).Header. Use
  2597. // googleapi.IsNotModified to check whether the returned error was
  2598. // because http.StatusNotModified was returned.
  2599. func (c *ProjectsLocationsRegistriesPatchCall) Do(opts ...googleapi.CallOption) (*DeviceRegistry, error) {
  2600. gensupport.SetOptions(c.urlParams_, opts...)
  2601. res, err := c.doRequest("json")
  2602. if res != nil && res.StatusCode == http.StatusNotModified {
  2603. if res.Body != nil {
  2604. res.Body.Close()
  2605. }
  2606. return nil, &googleapi.Error{
  2607. Code: res.StatusCode,
  2608. Header: res.Header,
  2609. }
  2610. }
  2611. if err != nil {
  2612. return nil, err
  2613. }
  2614. defer googleapi.CloseBody(res)
  2615. if err := googleapi.CheckResponse(res); err != nil {
  2616. return nil, err
  2617. }
  2618. ret := &DeviceRegistry{
  2619. ServerResponse: googleapi.ServerResponse{
  2620. Header: res.Header,
  2621. HTTPStatusCode: res.StatusCode,
  2622. },
  2623. }
  2624. target := &ret
  2625. if err := gensupport.DecodeResponse(target, res); err != nil {
  2626. return nil, err
  2627. }
  2628. return ret, nil
  2629. // {
  2630. // "description": "Updates a device registry configuration.",
  2631. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}",
  2632. // "httpMethod": "PATCH",
  2633. // "id": "cloudiot.projects.locations.registries.patch",
  2634. // "parameterOrder": [
  2635. // "name"
  2636. // ],
  2637. // "parameters": {
  2638. // "name": {
  2639. // "description": "The resource path name. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  2640. // "location": "path",
  2641. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2642. // "required": true,
  2643. // "type": "string"
  2644. // },
  2645. // "updateMask": {
  2646. // "description": "Only updates the `device_registry` fields indicated by this mask.\nThe field mask must not be empty, and it must not contain fields that\nare immutable or only set by the server.\nMutable top-level fields: `event_notification_config`, `http_config`,\n`mqtt_config`, and `state_notification_config`.",
  2647. // "format": "google-fieldmask",
  2648. // "location": "query",
  2649. // "type": "string"
  2650. // }
  2651. // },
  2652. // "path": "v1/{+name}",
  2653. // "request": {
  2654. // "$ref": "DeviceRegistry"
  2655. // },
  2656. // "response": {
  2657. // "$ref": "DeviceRegistry"
  2658. // },
  2659. // "scopes": [
  2660. // "https://www.googleapis.com/auth/cloud-platform",
  2661. // "https://www.googleapis.com/auth/cloudiot"
  2662. // ]
  2663. // }
  2664. }
  2665. // method id "cloudiot.projects.locations.registries.setIamPolicy":
  2666. type ProjectsLocationsRegistriesSetIamPolicyCall struct {
  2667. s *Service
  2668. resource string
  2669. setiampolicyrequest *SetIamPolicyRequest
  2670. urlParams_ gensupport.URLParams
  2671. ctx_ context.Context
  2672. header_ http.Header
  2673. }
  2674. // SetIamPolicy: Sets the access control policy on the specified
  2675. // resource. Replaces any
  2676. // existing policy.
  2677. func (r *ProjectsLocationsRegistriesService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsRegistriesSetIamPolicyCall {
  2678. c := &ProjectsLocationsRegistriesSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2679. c.resource = resource
  2680. c.setiampolicyrequest = setiampolicyrequest
  2681. return c
  2682. }
  2683. // Fields allows partial responses to be retrieved. See
  2684. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2685. // for more information.
  2686. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesSetIamPolicyCall {
  2687. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2688. return c
  2689. }
  2690. // Context sets the context to be used in this call's Do method. Any
  2691. // pending HTTP request will be aborted if the provided context is
  2692. // canceled.
  2693. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesSetIamPolicyCall {
  2694. c.ctx_ = ctx
  2695. return c
  2696. }
  2697. // Header returns an http.Header that can be modified by the caller to
  2698. // add HTTP headers to the request.
  2699. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Header() http.Header {
  2700. if c.header_ == nil {
  2701. c.header_ = make(http.Header)
  2702. }
  2703. return c.header_
  2704. }
  2705. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2706. reqHeaders := make(http.Header)
  2707. for k, v := range c.header_ {
  2708. reqHeaders[k] = v
  2709. }
  2710. reqHeaders.Set("User-Agent", c.s.userAgent())
  2711. var body io.Reader = nil
  2712. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2713. if err != nil {
  2714. return nil, err
  2715. }
  2716. reqHeaders.Set("Content-Type", "application/json")
  2717. c.urlParams_.Set("alt", alt)
  2718. c.urlParams_.Set("prettyPrint", "false")
  2719. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  2720. urls += "?" + c.urlParams_.Encode()
  2721. req, err := http.NewRequest("POST", urls, body)
  2722. if err != nil {
  2723. return nil, err
  2724. }
  2725. req.Header = reqHeaders
  2726. googleapi.Expand(req.URL, map[string]string{
  2727. "resource": c.resource,
  2728. })
  2729. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2730. }
  2731. // Do executes the "cloudiot.projects.locations.registries.setIamPolicy" call.
  2732. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2733. // code is an error. Response headers are in either
  2734. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2735. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2736. // check whether the returned error was because http.StatusNotModified
  2737. // was returned.
  2738. func (c *ProjectsLocationsRegistriesSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2739. gensupport.SetOptions(c.urlParams_, opts...)
  2740. res, err := c.doRequest("json")
  2741. if res != nil && res.StatusCode == http.StatusNotModified {
  2742. if res.Body != nil {
  2743. res.Body.Close()
  2744. }
  2745. return nil, &googleapi.Error{
  2746. Code: res.StatusCode,
  2747. Header: res.Header,
  2748. }
  2749. }
  2750. if err != nil {
  2751. return nil, err
  2752. }
  2753. defer googleapi.CloseBody(res)
  2754. if err := googleapi.CheckResponse(res); err != nil {
  2755. return nil, err
  2756. }
  2757. ret := &Policy{
  2758. ServerResponse: googleapi.ServerResponse{
  2759. Header: res.Header,
  2760. HTTPStatusCode: res.StatusCode,
  2761. },
  2762. }
  2763. target := &ret
  2764. if err := gensupport.DecodeResponse(target, res); err != nil {
  2765. return nil, err
  2766. }
  2767. return ret, nil
  2768. // {
  2769. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  2770. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:setIamPolicy",
  2771. // "httpMethod": "POST",
  2772. // "id": "cloudiot.projects.locations.registries.setIamPolicy",
  2773. // "parameterOrder": [
  2774. // "resource"
  2775. // ],
  2776. // "parameters": {
  2777. // "resource": {
  2778. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2779. // "location": "path",
  2780. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2781. // "required": true,
  2782. // "type": "string"
  2783. // }
  2784. // },
  2785. // "path": "v1/{+resource}:setIamPolicy",
  2786. // "request": {
  2787. // "$ref": "SetIamPolicyRequest"
  2788. // },
  2789. // "response": {
  2790. // "$ref": "Policy"
  2791. // },
  2792. // "scopes": [
  2793. // "https://www.googleapis.com/auth/cloud-platform",
  2794. // "https://www.googleapis.com/auth/cloudiot"
  2795. // ]
  2796. // }
  2797. }
  2798. // method id "cloudiot.projects.locations.registries.testIamPermissions":
  2799. type ProjectsLocationsRegistriesTestIamPermissionsCall struct {
  2800. s *Service
  2801. resource string
  2802. testiampermissionsrequest *TestIamPermissionsRequest
  2803. urlParams_ gensupport.URLParams
  2804. ctx_ context.Context
  2805. header_ http.Header
  2806. }
  2807. // TestIamPermissions: Returns permissions that a caller has on the
  2808. // specified resource.
  2809. // If the resource does not exist, this will return an empty set
  2810. // of
  2811. // permissions, not a NOT_FOUND error.
  2812. func (r *ProjectsLocationsRegistriesService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsRegistriesTestIamPermissionsCall {
  2813. c := &ProjectsLocationsRegistriesTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2814. c.resource = resource
  2815. c.testiampermissionsrequest = testiampermissionsrequest
  2816. return c
  2817. }
  2818. // Fields allows partial responses to be retrieved. See
  2819. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2820. // for more information.
  2821. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesTestIamPermissionsCall {
  2822. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2823. return c
  2824. }
  2825. // Context sets the context to be used in this call's Do method. Any
  2826. // pending HTTP request will be aborted if the provided context is
  2827. // canceled.
  2828. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsRegistriesTestIamPermissionsCall {
  2829. c.ctx_ = ctx
  2830. return c
  2831. }
  2832. // Header returns an http.Header that can be modified by the caller to
  2833. // add HTTP headers to the request.
  2834. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Header() http.Header {
  2835. if c.header_ == nil {
  2836. c.header_ = make(http.Header)
  2837. }
  2838. return c.header_
  2839. }
  2840. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2841. reqHeaders := make(http.Header)
  2842. for k, v := range c.header_ {
  2843. reqHeaders[k] = v
  2844. }
  2845. reqHeaders.Set("User-Agent", c.s.userAgent())
  2846. var body io.Reader = nil
  2847. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2848. if err != nil {
  2849. return nil, err
  2850. }
  2851. reqHeaders.Set("Content-Type", "application/json")
  2852. c.urlParams_.Set("alt", alt)
  2853. c.urlParams_.Set("prettyPrint", "false")
  2854. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  2855. urls += "?" + c.urlParams_.Encode()
  2856. req, err := http.NewRequest("POST", urls, body)
  2857. if err != nil {
  2858. return nil, err
  2859. }
  2860. req.Header = reqHeaders
  2861. googleapi.Expand(req.URL, map[string]string{
  2862. "resource": c.resource,
  2863. })
  2864. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2865. }
  2866. // Do executes the "cloudiot.projects.locations.registries.testIamPermissions" call.
  2867. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2868. // Any non-2xx status code is an error. Response headers are in either
  2869. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2870. // was returned at all) in error.(*googleapi.Error).Header. Use
  2871. // googleapi.IsNotModified to check whether the returned error was
  2872. // because http.StatusNotModified was returned.
  2873. func (c *ProjectsLocationsRegistriesTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2874. gensupport.SetOptions(c.urlParams_, opts...)
  2875. res, err := c.doRequest("json")
  2876. if res != nil && res.StatusCode == http.StatusNotModified {
  2877. if res.Body != nil {
  2878. res.Body.Close()
  2879. }
  2880. return nil, &googleapi.Error{
  2881. Code: res.StatusCode,
  2882. Header: res.Header,
  2883. }
  2884. }
  2885. if err != nil {
  2886. return nil, err
  2887. }
  2888. defer googleapi.CloseBody(res)
  2889. if err := googleapi.CheckResponse(res); err != nil {
  2890. return nil, err
  2891. }
  2892. ret := &TestIamPermissionsResponse{
  2893. ServerResponse: googleapi.ServerResponse{
  2894. Header: res.Header,
  2895. HTTPStatusCode: res.StatusCode,
  2896. },
  2897. }
  2898. target := &ret
  2899. if err := gensupport.DecodeResponse(target, res); err != nil {
  2900. return nil, err
  2901. }
  2902. return ret, nil
  2903. // {
  2904. // "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.",
  2905. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:testIamPermissions",
  2906. // "httpMethod": "POST",
  2907. // "id": "cloudiot.projects.locations.registries.testIamPermissions",
  2908. // "parameterOrder": [
  2909. // "resource"
  2910. // ],
  2911. // "parameters": {
  2912. // "resource": {
  2913. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2914. // "location": "path",
  2915. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  2916. // "required": true,
  2917. // "type": "string"
  2918. // }
  2919. // },
  2920. // "path": "v1/{+resource}:testIamPermissions",
  2921. // "request": {
  2922. // "$ref": "TestIamPermissionsRequest"
  2923. // },
  2924. // "response": {
  2925. // "$ref": "TestIamPermissionsResponse"
  2926. // },
  2927. // "scopes": [
  2928. // "https://www.googleapis.com/auth/cloud-platform",
  2929. // "https://www.googleapis.com/auth/cloudiot"
  2930. // ]
  2931. // }
  2932. }
  2933. // method id "cloudiot.projects.locations.registries.unbindDeviceFromGateway":
  2934. type ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall struct {
  2935. s *Service
  2936. parent string
  2937. unbinddevicefromgatewayrequest *UnbindDeviceFromGatewayRequest
  2938. urlParams_ gensupport.URLParams
  2939. ctx_ context.Context
  2940. header_ http.Header
  2941. }
  2942. // UnbindDeviceFromGateway: Deletes the association between the device
  2943. // and the gateway.
  2944. func (r *ProjectsLocationsRegistriesService) UnbindDeviceFromGateway(parent string, unbinddevicefromgatewayrequest *UnbindDeviceFromGatewayRequest) *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall {
  2945. c := &ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2946. c.parent = parent
  2947. c.unbinddevicefromgatewayrequest = unbinddevicefromgatewayrequest
  2948. return c
  2949. }
  2950. // Fields allows partial responses to be retrieved. See
  2951. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2952. // for more information.
  2953. func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall {
  2954. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2955. return c
  2956. }
  2957. // Context sets the context to be used in this call's Do method. Any
  2958. // pending HTTP request will be aborted if the provided context is
  2959. // canceled.
  2960. func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) Context(ctx context.Context) *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall {
  2961. c.ctx_ = ctx
  2962. return c
  2963. }
  2964. // Header returns an http.Header that can be modified by the caller to
  2965. // add HTTP headers to the request.
  2966. func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) Header() http.Header {
  2967. if c.header_ == nil {
  2968. c.header_ = make(http.Header)
  2969. }
  2970. return c.header_
  2971. }
  2972. func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) doRequest(alt string) (*http.Response, error) {
  2973. reqHeaders := make(http.Header)
  2974. for k, v := range c.header_ {
  2975. reqHeaders[k] = v
  2976. }
  2977. reqHeaders.Set("User-Agent", c.s.userAgent())
  2978. var body io.Reader = nil
  2979. body, err := googleapi.WithoutDataWrapper.JSONReader(c.unbinddevicefromgatewayrequest)
  2980. if err != nil {
  2981. return nil, err
  2982. }
  2983. reqHeaders.Set("Content-Type", "application/json")
  2984. c.urlParams_.Set("alt", alt)
  2985. c.urlParams_.Set("prettyPrint", "false")
  2986. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:unbindDeviceFromGateway")
  2987. urls += "?" + c.urlParams_.Encode()
  2988. req, err := http.NewRequest("POST", urls, body)
  2989. if err != nil {
  2990. return nil, err
  2991. }
  2992. req.Header = reqHeaders
  2993. googleapi.Expand(req.URL, map[string]string{
  2994. "parent": c.parent,
  2995. })
  2996. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2997. }
  2998. // Do executes the "cloudiot.projects.locations.registries.unbindDeviceFromGateway" call.
  2999. // Exactly one of *UnbindDeviceFromGatewayResponse or error will be
  3000. // non-nil. Any non-2xx status code is an error. Response headers are in
  3001. // either *UnbindDeviceFromGatewayResponse.ServerResponse.Header or (if
  3002. // a response was returned at all) in error.(*googleapi.Error).Header.
  3003. // Use googleapi.IsNotModified to check whether the returned error was
  3004. // because http.StatusNotModified was returned.
  3005. func (c *ProjectsLocationsRegistriesUnbindDeviceFromGatewayCall) Do(opts ...googleapi.CallOption) (*UnbindDeviceFromGatewayResponse, error) {
  3006. gensupport.SetOptions(c.urlParams_, opts...)
  3007. res, err := c.doRequest("json")
  3008. if res != nil && res.StatusCode == http.StatusNotModified {
  3009. if res.Body != nil {
  3010. res.Body.Close()
  3011. }
  3012. return nil, &googleapi.Error{
  3013. Code: res.StatusCode,
  3014. Header: res.Header,
  3015. }
  3016. }
  3017. if err != nil {
  3018. return nil, err
  3019. }
  3020. defer googleapi.CloseBody(res)
  3021. if err := googleapi.CheckResponse(res); err != nil {
  3022. return nil, err
  3023. }
  3024. ret := &UnbindDeviceFromGatewayResponse{
  3025. ServerResponse: googleapi.ServerResponse{
  3026. Header: res.Header,
  3027. HTTPStatusCode: res.StatusCode,
  3028. },
  3029. }
  3030. target := &ret
  3031. if err := gensupport.DecodeResponse(target, res); err != nil {
  3032. return nil, err
  3033. }
  3034. return ret, nil
  3035. // {
  3036. // "description": "Deletes the association between the device and the gateway.",
  3037. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}:unbindDeviceFromGateway",
  3038. // "httpMethod": "POST",
  3039. // "id": "cloudiot.projects.locations.registries.unbindDeviceFromGateway",
  3040. // "parameterOrder": [
  3041. // "parent"
  3042. // ],
  3043. // "parameters": {
  3044. // "parent": {
  3045. // "description": "The name of the registry. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  3046. // "location": "path",
  3047. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  3048. // "required": true,
  3049. // "type": "string"
  3050. // }
  3051. // },
  3052. // "path": "v1/{+parent}:unbindDeviceFromGateway",
  3053. // "request": {
  3054. // "$ref": "UnbindDeviceFromGatewayRequest"
  3055. // },
  3056. // "response": {
  3057. // "$ref": "UnbindDeviceFromGatewayResponse"
  3058. // },
  3059. // "scopes": [
  3060. // "https://www.googleapis.com/auth/cloud-platform",
  3061. // "https://www.googleapis.com/auth/cloudiot"
  3062. // ]
  3063. // }
  3064. }
  3065. // method id "cloudiot.projects.locations.registries.devices.create":
  3066. type ProjectsLocationsRegistriesDevicesCreateCall struct {
  3067. s *Service
  3068. parent string
  3069. device *Device
  3070. urlParams_ gensupport.URLParams
  3071. ctx_ context.Context
  3072. header_ http.Header
  3073. }
  3074. // Create: Creates a device in a device registry.
  3075. func (r *ProjectsLocationsRegistriesDevicesService) Create(parent string, device *Device) *ProjectsLocationsRegistriesDevicesCreateCall {
  3076. c := &ProjectsLocationsRegistriesDevicesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3077. c.parent = parent
  3078. c.device = device
  3079. return c
  3080. }
  3081. // Fields allows partial responses to be retrieved. See
  3082. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3083. // for more information.
  3084. func (c *ProjectsLocationsRegistriesDevicesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesCreateCall {
  3085. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3086. return c
  3087. }
  3088. // Context sets the context to be used in this call's Do method. Any
  3089. // pending HTTP request will be aborted if the provided context is
  3090. // canceled.
  3091. func (c *ProjectsLocationsRegistriesDevicesCreateCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesCreateCall {
  3092. c.ctx_ = ctx
  3093. return c
  3094. }
  3095. // Header returns an http.Header that can be modified by the caller to
  3096. // add HTTP headers to the request.
  3097. func (c *ProjectsLocationsRegistriesDevicesCreateCall) Header() http.Header {
  3098. if c.header_ == nil {
  3099. c.header_ = make(http.Header)
  3100. }
  3101. return c.header_
  3102. }
  3103. func (c *ProjectsLocationsRegistriesDevicesCreateCall) doRequest(alt string) (*http.Response, error) {
  3104. reqHeaders := make(http.Header)
  3105. for k, v := range c.header_ {
  3106. reqHeaders[k] = v
  3107. }
  3108. reqHeaders.Set("User-Agent", c.s.userAgent())
  3109. var body io.Reader = nil
  3110. body, err := googleapi.WithoutDataWrapper.JSONReader(c.device)
  3111. if err != nil {
  3112. return nil, err
  3113. }
  3114. reqHeaders.Set("Content-Type", "application/json")
  3115. c.urlParams_.Set("alt", alt)
  3116. c.urlParams_.Set("prettyPrint", "false")
  3117. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices")
  3118. urls += "?" + c.urlParams_.Encode()
  3119. req, err := http.NewRequest("POST", urls, body)
  3120. if err != nil {
  3121. return nil, err
  3122. }
  3123. req.Header = reqHeaders
  3124. googleapi.Expand(req.URL, map[string]string{
  3125. "parent": c.parent,
  3126. })
  3127. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3128. }
  3129. // Do executes the "cloudiot.projects.locations.registries.devices.create" call.
  3130. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  3131. // code is an error. Response headers are in either
  3132. // *Device.ServerResponse.Header or (if a response was returned at all)
  3133. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3134. // check whether the returned error was because http.StatusNotModified
  3135. // was returned.
  3136. func (c *ProjectsLocationsRegistriesDevicesCreateCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  3137. gensupport.SetOptions(c.urlParams_, opts...)
  3138. res, err := c.doRequest("json")
  3139. if res != nil && res.StatusCode == http.StatusNotModified {
  3140. if res.Body != nil {
  3141. res.Body.Close()
  3142. }
  3143. return nil, &googleapi.Error{
  3144. Code: res.StatusCode,
  3145. Header: res.Header,
  3146. }
  3147. }
  3148. if err != nil {
  3149. return nil, err
  3150. }
  3151. defer googleapi.CloseBody(res)
  3152. if err := googleapi.CheckResponse(res); err != nil {
  3153. return nil, err
  3154. }
  3155. ret := &Device{
  3156. ServerResponse: googleapi.ServerResponse{
  3157. Header: res.Header,
  3158. HTTPStatusCode: res.StatusCode,
  3159. },
  3160. }
  3161. target := &ret
  3162. if err := gensupport.DecodeResponse(target, res); err != nil {
  3163. return nil, err
  3164. }
  3165. return ret, nil
  3166. // {
  3167. // "description": "Creates a device in a device registry.",
  3168. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices",
  3169. // "httpMethod": "POST",
  3170. // "id": "cloudiot.projects.locations.registries.devices.create",
  3171. // "parameterOrder": [
  3172. // "parent"
  3173. // ],
  3174. // "parameters": {
  3175. // "parent": {
  3176. // "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`.",
  3177. // "location": "path",
  3178. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  3179. // "required": true,
  3180. // "type": "string"
  3181. // }
  3182. // },
  3183. // "path": "v1/{+parent}/devices",
  3184. // "request": {
  3185. // "$ref": "Device"
  3186. // },
  3187. // "response": {
  3188. // "$ref": "Device"
  3189. // },
  3190. // "scopes": [
  3191. // "https://www.googleapis.com/auth/cloud-platform",
  3192. // "https://www.googleapis.com/auth/cloudiot"
  3193. // ]
  3194. // }
  3195. }
  3196. // method id "cloudiot.projects.locations.registries.devices.delete":
  3197. type ProjectsLocationsRegistriesDevicesDeleteCall struct {
  3198. s *Service
  3199. name string
  3200. urlParams_ gensupport.URLParams
  3201. ctx_ context.Context
  3202. header_ http.Header
  3203. }
  3204. // Delete: Deletes a device.
  3205. func (r *ProjectsLocationsRegistriesDevicesService) Delete(name string) *ProjectsLocationsRegistriesDevicesDeleteCall {
  3206. c := &ProjectsLocationsRegistriesDevicesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3207. c.name = name
  3208. return c
  3209. }
  3210. // Fields allows partial responses to be retrieved. See
  3211. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3212. // for more information.
  3213. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesDeleteCall {
  3214. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3215. return c
  3216. }
  3217. // Context sets the context to be used in this call's Do method. Any
  3218. // pending HTTP request will be aborted if the provided context is
  3219. // canceled.
  3220. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesDeleteCall {
  3221. c.ctx_ = ctx
  3222. return c
  3223. }
  3224. // Header returns an http.Header that can be modified by the caller to
  3225. // add HTTP headers to the request.
  3226. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Header() http.Header {
  3227. if c.header_ == nil {
  3228. c.header_ = make(http.Header)
  3229. }
  3230. return c.header_
  3231. }
  3232. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3233. reqHeaders := make(http.Header)
  3234. for k, v := range c.header_ {
  3235. reqHeaders[k] = v
  3236. }
  3237. reqHeaders.Set("User-Agent", c.s.userAgent())
  3238. var body io.Reader = nil
  3239. c.urlParams_.Set("alt", alt)
  3240. c.urlParams_.Set("prettyPrint", "false")
  3241. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3242. urls += "?" + c.urlParams_.Encode()
  3243. req, err := http.NewRequest("DELETE", urls, body)
  3244. if err != nil {
  3245. return nil, err
  3246. }
  3247. req.Header = reqHeaders
  3248. googleapi.Expand(req.URL, map[string]string{
  3249. "name": c.name,
  3250. })
  3251. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3252. }
  3253. // Do executes the "cloudiot.projects.locations.registries.devices.delete" call.
  3254. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3255. // code is an error. Response headers are in either
  3256. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3257. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3258. // check whether the returned error was because http.StatusNotModified
  3259. // was returned.
  3260. func (c *ProjectsLocationsRegistriesDevicesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3261. gensupport.SetOptions(c.urlParams_, opts...)
  3262. res, err := c.doRequest("json")
  3263. if res != nil && res.StatusCode == http.StatusNotModified {
  3264. if res.Body != nil {
  3265. res.Body.Close()
  3266. }
  3267. return nil, &googleapi.Error{
  3268. Code: res.StatusCode,
  3269. Header: res.Header,
  3270. }
  3271. }
  3272. if err != nil {
  3273. return nil, err
  3274. }
  3275. defer googleapi.CloseBody(res)
  3276. if err := googleapi.CheckResponse(res); err != nil {
  3277. return nil, err
  3278. }
  3279. ret := &Empty{
  3280. ServerResponse: googleapi.ServerResponse{
  3281. Header: res.Header,
  3282. HTTPStatusCode: res.StatusCode,
  3283. },
  3284. }
  3285. target := &ret
  3286. if err := gensupport.DecodeResponse(target, res); err != nil {
  3287. return nil, err
  3288. }
  3289. return ret, nil
  3290. // {
  3291. // "description": "Deletes a device.",
  3292. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}",
  3293. // "httpMethod": "DELETE",
  3294. // "id": "cloudiot.projects.locations.registries.devices.delete",
  3295. // "parameterOrder": [
  3296. // "name"
  3297. // ],
  3298. // "parameters": {
  3299. // "name": {
  3300. // "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}`.",
  3301. // "location": "path",
  3302. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  3303. // "required": true,
  3304. // "type": "string"
  3305. // }
  3306. // },
  3307. // "path": "v1/{+name}",
  3308. // "response": {
  3309. // "$ref": "Empty"
  3310. // },
  3311. // "scopes": [
  3312. // "https://www.googleapis.com/auth/cloud-platform",
  3313. // "https://www.googleapis.com/auth/cloudiot"
  3314. // ]
  3315. // }
  3316. }
  3317. // method id "cloudiot.projects.locations.registries.devices.get":
  3318. type ProjectsLocationsRegistriesDevicesGetCall struct {
  3319. s *Service
  3320. name string
  3321. urlParams_ gensupport.URLParams
  3322. ifNoneMatch_ string
  3323. ctx_ context.Context
  3324. header_ http.Header
  3325. }
  3326. // Get: Gets details about a device.
  3327. func (r *ProjectsLocationsRegistriesDevicesService) Get(name string) *ProjectsLocationsRegistriesDevicesGetCall {
  3328. c := &ProjectsLocationsRegistriesDevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3329. c.name = name
  3330. return c
  3331. }
  3332. // FieldMask sets the optional parameter "fieldMask": The fields of the
  3333. // `Device` resource to be returned in the response. If the
  3334. // field mask is unset or empty, all fields are returned.
  3335. func (c *ProjectsLocationsRegistriesDevicesGetCall) FieldMask(fieldMask string) *ProjectsLocationsRegistriesDevicesGetCall {
  3336. c.urlParams_.Set("fieldMask", fieldMask)
  3337. return c
  3338. }
  3339. // Fields allows partial responses to be retrieved. See
  3340. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3341. // for more information.
  3342. func (c *ProjectsLocationsRegistriesDevicesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesGetCall {
  3343. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3344. return c
  3345. }
  3346. // IfNoneMatch sets the optional parameter which makes the operation
  3347. // fail if the object's ETag matches the given value. This is useful for
  3348. // getting updates only after the object has changed since the last
  3349. // request. Use googleapi.IsNotModified to check whether the response
  3350. // error from Do is the result of In-None-Match.
  3351. func (c *ProjectsLocationsRegistriesDevicesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesGetCall {
  3352. c.ifNoneMatch_ = entityTag
  3353. return c
  3354. }
  3355. // Context sets the context to be used in this call's Do method. Any
  3356. // pending HTTP request will be aborted if the provided context is
  3357. // canceled.
  3358. func (c *ProjectsLocationsRegistriesDevicesGetCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesGetCall {
  3359. c.ctx_ = ctx
  3360. return c
  3361. }
  3362. // Header returns an http.Header that can be modified by the caller to
  3363. // add HTTP headers to the request.
  3364. func (c *ProjectsLocationsRegistriesDevicesGetCall) Header() http.Header {
  3365. if c.header_ == nil {
  3366. c.header_ = make(http.Header)
  3367. }
  3368. return c.header_
  3369. }
  3370. func (c *ProjectsLocationsRegistriesDevicesGetCall) doRequest(alt string) (*http.Response, error) {
  3371. reqHeaders := make(http.Header)
  3372. for k, v := range c.header_ {
  3373. reqHeaders[k] = v
  3374. }
  3375. reqHeaders.Set("User-Agent", c.s.userAgent())
  3376. if c.ifNoneMatch_ != "" {
  3377. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3378. }
  3379. var body io.Reader = nil
  3380. c.urlParams_.Set("alt", alt)
  3381. c.urlParams_.Set("prettyPrint", "false")
  3382. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3383. urls += "?" + c.urlParams_.Encode()
  3384. req, err := http.NewRequest("GET", urls, body)
  3385. if err != nil {
  3386. return nil, err
  3387. }
  3388. req.Header = reqHeaders
  3389. googleapi.Expand(req.URL, map[string]string{
  3390. "name": c.name,
  3391. })
  3392. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3393. }
  3394. // Do executes the "cloudiot.projects.locations.registries.devices.get" call.
  3395. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  3396. // code is an error. Response headers are in either
  3397. // *Device.ServerResponse.Header or (if a response was returned at all)
  3398. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3399. // check whether the returned error was because http.StatusNotModified
  3400. // was returned.
  3401. func (c *ProjectsLocationsRegistriesDevicesGetCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  3402. gensupport.SetOptions(c.urlParams_, opts...)
  3403. res, err := c.doRequest("json")
  3404. if res != nil && res.StatusCode == http.StatusNotModified {
  3405. if res.Body != nil {
  3406. res.Body.Close()
  3407. }
  3408. return nil, &googleapi.Error{
  3409. Code: res.StatusCode,
  3410. Header: res.Header,
  3411. }
  3412. }
  3413. if err != nil {
  3414. return nil, err
  3415. }
  3416. defer googleapi.CloseBody(res)
  3417. if err := googleapi.CheckResponse(res); err != nil {
  3418. return nil, err
  3419. }
  3420. ret := &Device{
  3421. ServerResponse: googleapi.ServerResponse{
  3422. Header: res.Header,
  3423. HTTPStatusCode: res.StatusCode,
  3424. },
  3425. }
  3426. target := &ret
  3427. if err := gensupport.DecodeResponse(target, res); err != nil {
  3428. return nil, err
  3429. }
  3430. return ret, nil
  3431. // {
  3432. // "description": "Gets details about a device.",
  3433. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}",
  3434. // "httpMethod": "GET",
  3435. // "id": "cloudiot.projects.locations.registries.devices.get",
  3436. // "parameterOrder": [
  3437. // "name"
  3438. // ],
  3439. // "parameters": {
  3440. // "fieldMask": {
  3441. // "description": "The fields of the `Device` resource to be returned in the response. If the\nfield mask is unset or empty, all fields are returned.",
  3442. // "format": "google-fieldmask",
  3443. // "location": "query",
  3444. // "type": "string"
  3445. // },
  3446. // "name": {
  3447. // "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}`.",
  3448. // "location": "path",
  3449. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  3450. // "required": true,
  3451. // "type": "string"
  3452. // }
  3453. // },
  3454. // "path": "v1/{+name}",
  3455. // "response": {
  3456. // "$ref": "Device"
  3457. // },
  3458. // "scopes": [
  3459. // "https://www.googleapis.com/auth/cloud-platform",
  3460. // "https://www.googleapis.com/auth/cloudiot"
  3461. // ]
  3462. // }
  3463. }
  3464. // method id "cloudiot.projects.locations.registries.devices.list":
  3465. type ProjectsLocationsRegistriesDevicesListCall struct {
  3466. s *Service
  3467. parent string
  3468. urlParams_ gensupport.URLParams
  3469. ifNoneMatch_ string
  3470. ctx_ context.Context
  3471. header_ http.Header
  3472. }
  3473. // List: List devices in a device registry.
  3474. func (r *ProjectsLocationsRegistriesDevicesService) List(parent string) *ProjectsLocationsRegistriesDevicesListCall {
  3475. c := &ProjectsLocationsRegistriesDevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3476. c.parent = parent
  3477. return c
  3478. }
  3479. // DeviceIds sets the optional parameter "deviceIds": A list of device
  3480. // string IDs. For example, `['device0', 'device12']`.
  3481. // If empty, this field is ignored. Maximum IDs: 10,000
  3482. func (c *ProjectsLocationsRegistriesDevicesListCall) DeviceIds(deviceIds ...string) *ProjectsLocationsRegistriesDevicesListCall {
  3483. c.urlParams_.SetMulti("deviceIds", append([]string{}, deviceIds...))
  3484. return c
  3485. }
  3486. // DeviceNumIds sets the optional parameter "deviceNumIds": A list of
  3487. // device numeric IDs. If empty, this field is ignored. Maximum
  3488. // IDs: 10,000.
  3489. func (c *ProjectsLocationsRegistriesDevicesListCall) DeviceNumIds(deviceNumIds ...uint64) *ProjectsLocationsRegistriesDevicesListCall {
  3490. var deviceNumIds_ []string
  3491. for _, v := range deviceNumIds {
  3492. deviceNumIds_ = append(deviceNumIds_, fmt.Sprint(v))
  3493. }
  3494. c.urlParams_.SetMulti("deviceNumIds", deviceNumIds_)
  3495. return c
  3496. }
  3497. // FieldMask sets the optional parameter "fieldMask": The fields of the
  3498. // `Device` resource to be returned in the response. The
  3499. // fields `id` and `num_id` are always returned, along with any
  3500. // other fields specified.
  3501. func (c *ProjectsLocationsRegistriesDevicesListCall) FieldMask(fieldMask string) *ProjectsLocationsRegistriesDevicesListCall {
  3502. c.urlParams_.Set("fieldMask", fieldMask)
  3503. return c
  3504. }
  3505. // GatewayListOptionsAssociationsDeviceId sets the optional parameter
  3506. // "gatewayListOptions.associationsDeviceId": If set, returns only the
  3507. // gateways with which the specified device is
  3508. // associated. The device ID can be numeric (`num_id`) or the
  3509. // user-defined
  3510. // string (`id`). For example, if `456` is specified, returns only
  3511. // the
  3512. // gateways to which the device with `num_id` 456 is bound.
  3513. func (c *ProjectsLocationsRegistriesDevicesListCall) GatewayListOptionsAssociationsDeviceId(gatewayListOptionsAssociationsDeviceId string) *ProjectsLocationsRegistriesDevicesListCall {
  3514. c.urlParams_.Set("gatewayListOptions.associationsDeviceId", gatewayListOptionsAssociationsDeviceId)
  3515. return c
  3516. }
  3517. // GatewayListOptionsAssociationsGatewayId sets the optional parameter
  3518. // "gatewayListOptions.associationsGatewayId": If set, only devices
  3519. // associated with the specified gateway are returned.
  3520. // The gateway ID can be numeric (`num_id`) or the user-defined
  3521. // string
  3522. // (`id`). For example, if `123` is specified, only devices bound to
  3523. // the
  3524. // gateway with `num_id` 123 are returned.
  3525. func (c *ProjectsLocationsRegistriesDevicesListCall) GatewayListOptionsAssociationsGatewayId(gatewayListOptionsAssociationsGatewayId string) *ProjectsLocationsRegistriesDevicesListCall {
  3526. c.urlParams_.Set("gatewayListOptions.associationsGatewayId", gatewayListOptionsAssociationsGatewayId)
  3527. return c
  3528. }
  3529. // GatewayListOptionsGatewayType sets the optional parameter
  3530. // "gatewayListOptions.gatewayType": If `GATEWAY` is specified, only
  3531. // gateways are returned. If `NON_GATEWAY`
  3532. // is specified, only non-gateway devices are returned.
  3533. // If
  3534. // `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
  3535. //
  3536. // Possible values:
  3537. // "GATEWAY_TYPE_UNSPECIFIED"
  3538. // "GATEWAY"
  3539. // "NON_GATEWAY"
  3540. func (c *ProjectsLocationsRegistriesDevicesListCall) GatewayListOptionsGatewayType(gatewayListOptionsGatewayType string) *ProjectsLocationsRegistriesDevicesListCall {
  3541. c.urlParams_.Set("gatewayListOptions.gatewayType", gatewayListOptionsGatewayType)
  3542. return c
  3543. }
  3544. // PageSize sets the optional parameter "pageSize": The maximum number
  3545. // of devices to return in the response. If this value
  3546. // is zero, the service will select a default size. A call may return
  3547. // fewer
  3548. // objects than requested. A non-empty `next_page_token` in the
  3549. // response
  3550. // indicates that more data is available.
  3551. func (c *ProjectsLocationsRegistriesDevicesListCall) PageSize(pageSize int64) *ProjectsLocationsRegistriesDevicesListCall {
  3552. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3553. return c
  3554. }
  3555. // PageToken sets the optional parameter "pageToken": The value returned
  3556. // by the last `ListDevicesResponse`; indicates
  3557. // that this is a continuation of a prior `ListDevices` call and
  3558. // the system should return the next page of data.
  3559. func (c *ProjectsLocationsRegistriesDevicesListCall) PageToken(pageToken string) *ProjectsLocationsRegistriesDevicesListCall {
  3560. c.urlParams_.Set("pageToken", pageToken)
  3561. return c
  3562. }
  3563. // Fields allows partial responses to be retrieved. See
  3564. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3565. // for more information.
  3566. func (c *ProjectsLocationsRegistriesDevicesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesListCall {
  3567. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3568. return c
  3569. }
  3570. // IfNoneMatch sets the optional parameter which makes the operation
  3571. // fail if the object's ETag matches the given value. This is useful for
  3572. // getting updates only after the object has changed since the last
  3573. // request. Use googleapi.IsNotModified to check whether the response
  3574. // error from Do is the result of In-None-Match.
  3575. func (c *ProjectsLocationsRegistriesDevicesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesListCall {
  3576. c.ifNoneMatch_ = entityTag
  3577. return c
  3578. }
  3579. // Context sets the context to be used in this call's Do method. Any
  3580. // pending HTTP request will be aborted if the provided context is
  3581. // canceled.
  3582. func (c *ProjectsLocationsRegistriesDevicesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesListCall {
  3583. c.ctx_ = ctx
  3584. return c
  3585. }
  3586. // Header returns an http.Header that can be modified by the caller to
  3587. // add HTTP headers to the request.
  3588. func (c *ProjectsLocationsRegistriesDevicesListCall) Header() http.Header {
  3589. if c.header_ == nil {
  3590. c.header_ = make(http.Header)
  3591. }
  3592. return c.header_
  3593. }
  3594. func (c *ProjectsLocationsRegistriesDevicesListCall) doRequest(alt string) (*http.Response, error) {
  3595. reqHeaders := make(http.Header)
  3596. for k, v := range c.header_ {
  3597. reqHeaders[k] = v
  3598. }
  3599. reqHeaders.Set("User-Agent", c.s.userAgent())
  3600. if c.ifNoneMatch_ != "" {
  3601. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3602. }
  3603. var body io.Reader = nil
  3604. c.urlParams_.Set("alt", alt)
  3605. c.urlParams_.Set("prettyPrint", "false")
  3606. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices")
  3607. urls += "?" + c.urlParams_.Encode()
  3608. req, err := http.NewRequest("GET", urls, body)
  3609. if err != nil {
  3610. return nil, err
  3611. }
  3612. req.Header = reqHeaders
  3613. googleapi.Expand(req.URL, map[string]string{
  3614. "parent": c.parent,
  3615. })
  3616. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3617. }
  3618. // Do executes the "cloudiot.projects.locations.registries.devices.list" call.
  3619. // Exactly one of *ListDevicesResponse or error will be non-nil. Any
  3620. // non-2xx status code is an error. Response headers are in either
  3621. // *ListDevicesResponse.ServerResponse.Header or (if a response was
  3622. // returned at all) in error.(*googleapi.Error).Header. Use
  3623. // googleapi.IsNotModified to check whether the returned error was
  3624. // because http.StatusNotModified was returned.
  3625. func (c *ProjectsLocationsRegistriesDevicesListCall) Do(opts ...googleapi.CallOption) (*ListDevicesResponse, error) {
  3626. gensupport.SetOptions(c.urlParams_, opts...)
  3627. res, err := c.doRequest("json")
  3628. if res != nil && res.StatusCode == http.StatusNotModified {
  3629. if res.Body != nil {
  3630. res.Body.Close()
  3631. }
  3632. return nil, &googleapi.Error{
  3633. Code: res.StatusCode,
  3634. Header: res.Header,
  3635. }
  3636. }
  3637. if err != nil {
  3638. return nil, err
  3639. }
  3640. defer googleapi.CloseBody(res)
  3641. if err := googleapi.CheckResponse(res); err != nil {
  3642. return nil, err
  3643. }
  3644. ret := &ListDevicesResponse{
  3645. ServerResponse: googleapi.ServerResponse{
  3646. Header: res.Header,
  3647. HTTPStatusCode: res.StatusCode,
  3648. },
  3649. }
  3650. target := &ret
  3651. if err := gensupport.DecodeResponse(target, res); err != nil {
  3652. return nil, err
  3653. }
  3654. return ret, nil
  3655. // {
  3656. // "description": "List devices in a device registry.",
  3657. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices",
  3658. // "httpMethod": "GET",
  3659. // "id": "cloudiot.projects.locations.registries.devices.list",
  3660. // "parameterOrder": [
  3661. // "parent"
  3662. // ],
  3663. // "parameters": {
  3664. // "deviceIds": {
  3665. // "description": "A list of device string IDs. For example, `['device0', 'device12']`.\nIf empty, this field is ignored. Maximum IDs: 10,000",
  3666. // "location": "query",
  3667. // "repeated": true,
  3668. // "type": "string"
  3669. // },
  3670. // "deviceNumIds": {
  3671. // "description": "A list of device numeric IDs. If empty, this field is ignored. Maximum\nIDs: 10,000.",
  3672. // "format": "uint64",
  3673. // "location": "query",
  3674. // "repeated": true,
  3675. // "type": "string"
  3676. // },
  3677. // "fieldMask": {
  3678. // "description": "The fields of the `Device` resource to be returned in the response. The\nfields `id` and `num_id` are always returned, along with any\nother fields specified.",
  3679. // "format": "google-fieldmask",
  3680. // "location": "query",
  3681. // "type": "string"
  3682. // },
  3683. // "gatewayListOptions.associationsDeviceId": {
  3684. // "description": "If set, returns only the gateways with which the specified device is\nassociated. The device ID can be numeric (`num_id`) or the user-defined\nstring (`id`). For example, if `456` is specified, returns only the\ngateways to which the device with `num_id` 456 is bound.",
  3685. // "location": "query",
  3686. // "type": "string"
  3687. // },
  3688. // "gatewayListOptions.associationsGatewayId": {
  3689. // "description": "If set, only devices associated with the specified gateway are returned.\nThe gateway ID can be numeric (`num_id`) or the user-defined string\n(`id`). For example, if `123` is specified, only devices bound to the\ngateway with `num_id` 123 are returned.",
  3690. // "location": "query",
  3691. // "type": "string"
  3692. // },
  3693. // "gatewayListOptions.gatewayType": {
  3694. // "description": "If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`\nis specified, only non-gateway devices are returned. If\n`GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.",
  3695. // "enum": [
  3696. // "GATEWAY_TYPE_UNSPECIFIED",
  3697. // "GATEWAY",
  3698. // "NON_GATEWAY"
  3699. // ],
  3700. // "location": "query",
  3701. // "type": "string"
  3702. // },
  3703. // "pageSize": {
  3704. // "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. A non-empty `next_page_token` in the response\nindicates that more data is available.",
  3705. // "format": "int32",
  3706. // "location": "query",
  3707. // "type": "integer"
  3708. // },
  3709. // "pageToken": {
  3710. // "description": "The value returned by the last `ListDevicesResponse`; indicates\nthat this is a continuation of a prior `ListDevices` call and\nthe system should return the next page of data.",
  3711. // "location": "query",
  3712. // "type": "string"
  3713. // },
  3714. // "parent": {
  3715. // "description": "The device registry path. Required. For example,\n`projects/my-project/locations/us-central1/registries/my-registry`.",
  3716. // "location": "path",
  3717. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+$",
  3718. // "required": true,
  3719. // "type": "string"
  3720. // }
  3721. // },
  3722. // "path": "v1/{+parent}/devices",
  3723. // "response": {
  3724. // "$ref": "ListDevicesResponse"
  3725. // },
  3726. // "scopes": [
  3727. // "https://www.googleapis.com/auth/cloud-platform",
  3728. // "https://www.googleapis.com/auth/cloudiot"
  3729. // ]
  3730. // }
  3731. }
  3732. // Pages invokes f for each page of results.
  3733. // A non-nil error returned from f will halt the iteration.
  3734. // The provided context supersedes any context provided to the Context method.
  3735. func (c *ProjectsLocationsRegistriesDevicesListCall) Pages(ctx context.Context, f func(*ListDevicesResponse) error) error {
  3736. c.ctx_ = ctx
  3737. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3738. for {
  3739. x, err := c.Do()
  3740. if err != nil {
  3741. return err
  3742. }
  3743. if err := f(x); err != nil {
  3744. return err
  3745. }
  3746. if x.NextPageToken == "" {
  3747. return nil
  3748. }
  3749. c.PageToken(x.NextPageToken)
  3750. }
  3751. }
  3752. // method id "cloudiot.projects.locations.registries.devices.modifyCloudToDeviceConfig":
  3753. type ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall struct {
  3754. s *Service
  3755. name string
  3756. modifycloudtodeviceconfigrequest *ModifyCloudToDeviceConfigRequest
  3757. urlParams_ gensupport.URLParams
  3758. ctx_ context.Context
  3759. header_ http.Header
  3760. }
  3761. // ModifyCloudToDeviceConfig: Modifies the configuration for the device,
  3762. // which is eventually sent from
  3763. // the Cloud IoT Core servers. Returns the modified configuration
  3764. // version and
  3765. // its metadata.
  3766. func (r *ProjectsLocationsRegistriesDevicesService) ModifyCloudToDeviceConfig(name string, modifycloudtodeviceconfigrequest *ModifyCloudToDeviceConfigRequest) *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall {
  3767. c := &ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3768. c.name = name
  3769. c.modifycloudtodeviceconfigrequest = modifycloudtodeviceconfigrequest
  3770. return c
  3771. }
  3772. // Fields allows partial responses to be retrieved. See
  3773. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3774. // for more information.
  3775. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall {
  3776. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3777. return c
  3778. }
  3779. // Context sets the context to be used in this call's Do method. Any
  3780. // pending HTTP request will be aborted if the provided context is
  3781. // canceled.
  3782. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall {
  3783. c.ctx_ = ctx
  3784. return c
  3785. }
  3786. // Header returns an http.Header that can be modified by the caller to
  3787. // add HTTP headers to the request.
  3788. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Header() http.Header {
  3789. if c.header_ == nil {
  3790. c.header_ = make(http.Header)
  3791. }
  3792. return c.header_
  3793. }
  3794. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) doRequest(alt string) (*http.Response, error) {
  3795. reqHeaders := make(http.Header)
  3796. for k, v := range c.header_ {
  3797. reqHeaders[k] = v
  3798. }
  3799. reqHeaders.Set("User-Agent", c.s.userAgent())
  3800. var body io.Reader = nil
  3801. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycloudtodeviceconfigrequest)
  3802. if err != nil {
  3803. return nil, err
  3804. }
  3805. reqHeaders.Set("Content-Type", "application/json")
  3806. c.urlParams_.Set("alt", alt)
  3807. c.urlParams_.Set("prettyPrint", "false")
  3808. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:modifyCloudToDeviceConfig")
  3809. urls += "?" + c.urlParams_.Encode()
  3810. req, err := http.NewRequest("POST", urls, body)
  3811. if err != nil {
  3812. return nil, err
  3813. }
  3814. req.Header = reqHeaders
  3815. googleapi.Expand(req.URL, map[string]string{
  3816. "name": c.name,
  3817. })
  3818. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3819. }
  3820. // Do executes the "cloudiot.projects.locations.registries.devices.modifyCloudToDeviceConfig" call.
  3821. // Exactly one of *DeviceConfig or error will be non-nil. Any non-2xx
  3822. // status code is an error. Response headers are in either
  3823. // *DeviceConfig.ServerResponse.Header or (if a response was returned at
  3824. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3825. // to check whether the returned error was because
  3826. // http.StatusNotModified was returned.
  3827. func (c *ProjectsLocationsRegistriesDevicesModifyCloudToDeviceConfigCall) Do(opts ...googleapi.CallOption) (*DeviceConfig, error) {
  3828. gensupport.SetOptions(c.urlParams_, opts...)
  3829. res, err := c.doRequest("json")
  3830. if res != nil && res.StatusCode == http.StatusNotModified {
  3831. if res.Body != nil {
  3832. res.Body.Close()
  3833. }
  3834. return nil, &googleapi.Error{
  3835. Code: res.StatusCode,
  3836. Header: res.Header,
  3837. }
  3838. }
  3839. if err != nil {
  3840. return nil, err
  3841. }
  3842. defer googleapi.CloseBody(res)
  3843. if err := googleapi.CheckResponse(res); err != nil {
  3844. return nil, err
  3845. }
  3846. ret := &DeviceConfig{
  3847. ServerResponse: googleapi.ServerResponse{
  3848. Header: res.Header,
  3849. HTTPStatusCode: res.StatusCode,
  3850. },
  3851. }
  3852. target := &ret
  3853. if err := gensupport.DecodeResponse(target, res); err != nil {
  3854. return nil, err
  3855. }
  3856. return ret, nil
  3857. // {
  3858. // "description": "Modifies the configuration for the device, which is eventually sent from\nthe Cloud IoT Core servers. Returns the modified configuration version and\nits metadata.",
  3859. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}:modifyCloudToDeviceConfig",
  3860. // "httpMethod": "POST",
  3861. // "id": "cloudiot.projects.locations.registries.devices.modifyCloudToDeviceConfig",
  3862. // "parameterOrder": [
  3863. // "name"
  3864. // ],
  3865. // "parameters": {
  3866. // "name": {
  3867. // "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}`.",
  3868. // "location": "path",
  3869. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  3870. // "required": true,
  3871. // "type": "string"
  3872. // }
  3873. // },
  3874. // "path": "v1/{+name}:modifyCloudToDeviceConfig",
  3875. // "request": {
  3876. // "$ref": "ModifyCloudToDeviceConfigRequest"
  3877. // },
  3878. // "response": {
  3879. // "$ref": "DeviceConfig"
  3880. // },
  3881. // "scopes": [
  3882. // "https://www.googleapis.com/auth/cloud-platform",
  3883. // "https://www.googleapis.com/auth/cloudiot"
  3884. // ]
  3885. // }
  3886. }
  3887. // method id "cloudiot.projects.locations.registries.devices.patch":
  3888. type ProjectsLocationsRegistriesDevicesPatchCall struct {
  3889. s *Service
  3890. name string
  3891. device *Device
  3892. urlParams_ gensupport.URLParams
  3893. ctx_ context.Context
  3894. header_ http.Header
  3895. }
  3896. // Patch: Updates a device.
  3897. func (r *ProjectsLocationsRegistriesDevicesService) Patch(name string, device *Device) *ProjectsLocationsRegistriesDevicesPatchCall {
  3898. c := &ProjectsLocationsRegistriesDevicesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3899. c.name = name
  3900. c.device = device
  3901. return c
  3902. }
  3903. // UpdateMask sets the optional parameter "updateMask": Only updates the
  3904. // `device` fields indicated by this mask.
  3905. // The field mask must not be empty, and it must not contain fields
  3906. // that
  3907. // are immutable or only set by the server.
  3908. // Mutable top-level fields: `credentials`, `blocked`, and `metadata`
  3909. func (c *ProjectsLocationsRegistriesDevicesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsRegistriesDevicesPatchCall {
  3910. c.urlParams_.Set("updateMask", updateMask)
  3911. return c
  3912. }
  3913. // Fields allows partial responses to be retrieved. See
  3914. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3915. // for more information.
  3916. func (c *ProjectsLocationsRegistriesDevicesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesPatchCall {
  3917. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3918. return c
  3919. }
  3920. // Context sets the context to be used in this call's Do method. Any
  3921. // pending HTTP request will be aborted if the provided context is
  3922. // canceled.
  3923. func (c *ProjectsLocationsRegistriesDevicesPatchCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesPatchCall {
  3924. c.ctx_ = ctx
  3925. return c
  3926. }
  3927. // Header returns an http.Header that can be modified by the caller to
  3928. // add HTTP headers to the request.
  3929. func (c *ProjectsLocationsRegistriesDevicesPatchCall) Header() http.Header {
  3930. if c.header_ == nil {
  3931. c.header_ = make(http.Header)
  3932. }
  3933. return c.header_
  3934. }
  3935. func (c *ProjectsLocationsRegistriesDevicesPatchCall) doRequest(alt string) (*http.Response, error) {
  3936. reqHeaders := make(http.Header)
  3937. for k, v := range c.header_ {
  3938. reqHeaders[k] = v
  3939. }
  3940. reqHeaders.Set("User-Agent", c.s.userAgent())
  3941. var body io.Reader = nil
  3942. body, err := googleapi.WithoutDataWrapper.JSONReader(c.device)
  3943. if err != nil {
  3944. return nil, err
  3945. }
  3946. reqHeaders.Set("Content-Type", "application/json")
  3947. c.urlParams_.Set("alt", alt)
  3948. c.urlParams_.Set("prettyPrint", "false")
  3949. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3950. urls += "?" + c.urlParams_.Encode()
  3951. req, err := http.NewRequest("PATCH", urls, body)
  3952. if err != nil {
  3953. return nil, err
  3954. }
  3955. req.Header = reqHeaders
  3956. googleapi.Expand(req.URL, map[string]string{
  3957. "name": c.name,
  3958. })
  3959. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3960. }
  3961. // Do executes the "cloudiot.projects.locations.registries.devices.patch" call.
  3962. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  3963. // code is an error. Response headers are in either
  3964. // *Device.ServerResponse.Header or (if a response was returned at all)
  3965. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3966. // check whether the returned error was because http.StatusNotModified
  3967. // was returned.
  3968. func (c *ProjectsLocationsRegistriesDevicesPatchCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  3969. gensupport.SetOptions(c.urlParams_, opts...)
  3970. res, err := c.doRequest("json")
  3971. if res != nil && res.StatusCode == http.StatusNotModified {
  3972. if res.Body != nil {
  3973. res.Body.Close()
  3974. }
  3975. return nil, &googleapi.Error{
  3976. Code: res.StatusCode,
  3977. Header: res.Header,
  3978. }
  3979. }
  3980. if err != nil {
  3981. return nil, err
  3982. }
  3983. defer googleapi.CloseBody(res)
  3984. if err := googleapi.CheckResponse(res); err != nil {
  3985. return nil, err
  3986. }
  3987. ret := &Device{
  3988. ServerResponse: googleapi.ServerResponse{
  3989. Header: res.Header,
  3990. HTTPStatusCode: res.StatusCode,
  3991. },
  3992. }
  3993. target := &ret
  3994. if err := gensupport.DecodeResponse(target, res); err != nil {
  3995. return nil, err
  3996. }
  3997. return ret, nil
  3998. // {
  3999. // "description": "Updates a device.",
  4000. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}",
  4001. // "httpMethod": "PATCH",
  4002. // "id": "cloudiot.projects.locations.registries.devices.patch",
  4003. // "parameterOrder": [
  4004. // "name"
  4005. // ],
  4006. // "parameters": {
  4007. // "name": {
  4008. // "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.",
  4009. // "location": "path",
  4010. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  4011. // "required": true,
  4012. // "type": "string"
  4013. // },
  4014. // "updateMask": {
  4015. // "description": "Only updates the `device` fields indicated by this mask.\nThe field mask must not be empty, and it must not contain fields that\nare immutable or only set by the server.\nMutable top-level fields: `credentials`, `blocked`, and `metadata`",
  4016. // "format": "google-fieldmask",
  4017. // "location": "query",
  4018. // "type": "string"
  4019. // }
  4020. // },
  4021. // "path": "v1/{+name}",
  4022. // "request": {
  4023. // "$ref": "Device"
  4024. // },
  4025. // "response": {
  4026. // "$ref": "Device"
  4027. // },
  4028. // "scopes": [
  4029. // "https://www.googleapis.com/auth/cloud-platform",
  4030. // "https://www.googleapis.com/auth/cloudiot"
  4031. // ]
  4032. // }
  4033. }
  4034. // method id "cloudiot.projects.locations.registries.devices.sendCommandToDevice":
  4035. type ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall struct {
  4036. s *Service
  4037. name string
  4038. sendcommandtodevicerequest *SendCommandToDeviceRequest
  4039. urlParams_ gensupport.URLParams
  4040. ctx_ context.Context
  4041. header_ http.Header
  4042. }
  4043. // SendCommandToDevice: Sends a command to the specified device. In
  4044. // order for a device to be able
  4045. // to receive commands, it must:
  4046. // 1) be connected to Cloud IoT Core using the MQTT protocol, and
  4047. // 2) be subscribed to the group of MQTT topics specified by
  4048. // /devices/{device-id}/commands/#. This subscription will receive
  4049. // commands
  4050. // at the top-level topic /devices/{device-id}/commands as well as
  4051. // commands
  4052. // for subfolders, like /devices/{device-id}/commands/subfolder.
  4053. // Note that subscribing to specific subfolders is not supported.
  4054. // If the command could not be delivered to the device, this method
  4055. // will
  4056. // return an error; in particular, if the device is not subscribed,
  4057. // this
  4058. // method will return FAILED_PRECONDITION. Otherwise, this method
  4059. // will
  4060. // return OK. If the subscription is QoS 1, at least once delivery will
  4061. // be
  4062. // guaranteed; for QoS 0, no acknowledgment will be expected from the
  4063. // device.
  4064. func (r *ProjectsLocationsRegistriesDevicesService) SendCommandToDevice(name string, sendcommandtodevicerequest *SendCommandToDeviceRequest) *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall {
  4065. c := &ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4066. c.name = name
  4067. c.sendcommandtodevicerequest = sendcommandtodevicerequest
  4068. return c
  4069. }
  4070. // Fields allows partial responses to be retrieved. See
  4071. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4072. // for more information.
  4073. func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall {
  4074. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4075. return c
  4076. }
  4077. // Context sets the context to be used in this call's Do method. Any
  4078. // pending HTTP request will be aborted if the provided context is
  4079. // canceled.
  4080. func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall {
  4081. c.ctx_ = ctx
  4082. return c
  4083. }
  4084. // Header returns an http.Header that can be modified by the caller to
  4085. // add HTTP headers to the request.
  4086. func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) Header() http.Header {
  4087. if c.header_ == nil {
  4088. c.header_ = make(http.Header)
  4089. }
  4090. return c.header_
  4091. }
  4092. func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) doRequest(alt string) (*http.Response, error) {
  4093. reqHeaders := make(http.Header)
  4094. for k, v := range c.header_ {
  4095. reqHeaders[k] = v
  4096. }
  4097. reqHeaders.Set("User-Agent", c.s.userAgent())
  4098. var body io.Reader = nil
  4099. body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendcommandtodevicerequest)
  4100. if err != nil {
  4101. return nil, err
  4102. }
  4103. reqHeaders.Set("Content-Type", "application/json")
  4104. c.urlParams_.Set("alt", alt)
  4105. c.urlParams_.Set("prettyPrint", "false")
  4106. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:sendCommandToDevice")
  4107. urls += "?" + c.urlParams_.Encode()
  4108. req, err := http.NewRequest("POST", urls, body)
  4109. if err != nil {
  4110. return nil, err
  4111. }
  4112. req.Header = reqHeaders
  4113. googleapi.Expand(req.URL, map[string]string{
  4114. "name": c.name,
  4115. })
  4116. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4117. }
  4118. // Do executes the "cloudiot.projects.locations.registries.devices.sendCommandToDevice" call.
  4119. // Exactly one of *SendCommandToDeviceResponse or error will be non-nil.
  4120. // Any non-2xx status code is an error. Response headers are in either
  4121. // *SendCommandToDeviceResponse.ServerResponse.Header or (if a response
  4122. // was returned at all) in error.(*googleapi.Error).Header. Use
  4123. // googleapi.IsNotModified to check whether the returned error was
  4124. // because http.StatusNotModified was returned.
  4125. func (c *ProjectsLocationsRegistriesDevicesSendCommandToDeviceCall) Do(opts ...googleapi.CallOption) (*SendCommandToDeviceResponse, error) {
  4126. gensupport.SetOptions(c.urlParams_, opts...)
  4127. res, err := c.doRequest("json")
  4128. if res != nil && res.StatusCode == http.StatusNotModified {
  4129. if res.Body != nil {
  4130. res.Body.Close()
  4131. }
  4132. return nil, &googleapi.Error{
  4133. Code: res.StatusCode,
  4134. Header: res.Header,
  4135. }
  4136. }
  4137. if err != nil {
  4138. return nil, err
  4139. }
  4140. defer googleapi.CloseBody(res)
  4141. if err := googleapi.CheckResponse(res); err != nil {
  4142. return nil, err
  4143. }
  4144. ret := &SendCommandToDeviceResponse{
  4145. ServerResponse: googleapi.ServerResponse{
  4146. Header: res.Header,
  4147. HTTPStatusCode: res.StatusCode,
  4148. },
  4149. }
  4150. target := &ret
  4151. if err := gensupport.DecodeResponse(target, res); err != nil {
  4152. return nil, err
  4153. }
  4154. return ret, nil
  4155. // {
  4156. // "description": "Sends a command to the specified device. In order for a device to be able\nto receive commands, it must:\n1) be connected to Cloud IoT Core using the MQTT protocol, and\n2) be subscribed to the group of MQTT topics specified by\n /devices/{device-id}/commands/#. This subscription will receive commands\n at the top-level topic /devices/{device-id}/commands as well as commands\n for subfolders, like /devices/{device-id}/commands/subfolder.\n Note that subscribing to specific subfolders is not supported.\nIf the command could not be delivered to the device, this method will\nreturn an error; in particular, if the device is not subscribed, this\nmethod will return FAILED_PRECONDITION. Otherwise, this method will\nreturn OK. If the subscription is QoS 1, at least once delivery will be\nguaranteed; for QoS 0, no acknowledgment will be expected from the device.",
  4157. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}:sendCommandToDevice",
  4158. // "httpMethod": "POST",
  4159. // "id": "cloudiot.projects.locations.registries.devices.sendCommandToDevice",
  4160. // "parameterOrder": [
  4161. // "name"
  4162. // ],
  4163. // "parameters": {
  4164. // "name": {
  4165. // "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}`.",
  4166. // "location": "path",
  4167. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  4168. // "required": true,
  4169. // "type": "string"
  4170. // }
  4171. // },
  4172. // "path": "v1/{+name}:sendCommandToDevice",
  4173. // "request": {
  4174. // "$ref": "SendCommandToDeviceRequest"
  4175. // },
  4176. // "response": {
  4177. // "$ref": "SendCommandToDeviceResponse"
  4178. // },
  4179. // "scopes": [
  4180. // "https://www.googleapis.com/auth/cloud-platform",
  4181. // "https://www.googleapis.com/auth/cloudiot"
  4182. // ]
  4183. // }
  4184. }
  4185. // method id "cloudiot.projects.locations.registries.devices.configVersions.list":
  4186. type ProjectsLocationsRegistriesDevicesConfigVersionsListCall struct {
  4187. s *Service
  4188. name string
  4189. urlParams_ gensupport.URLParams
  4190. ifNoneMatch_ string
  4191. ctx_ context.Context
  4192. header_ http.Header
  4193. }
  4194. // List: Lists the last few versions of the device configuration in
  4195. // descending
  4196. // order (i.e.: newest first).
  4197. func (r *ProjectsLocationsRegistriesDevicesConfigVersionsService) List(name string) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  4198. c := &ProjectsLocationsRegistriesDevicesConfigVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4199. c.name = name
  4200. return c
  4201. }
  4202. // NumVersions sets the optional parameter "numVersions": The number of
  4203. // versions to list. Versions are listed in decreasing order of
  4204. // the version number. The maximum number of versions retained is 10. If
  4205. // this
  4206. // value is zero, it will return all the versions available.
  4207. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) NumVersions(numVersions int64) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  4208. c.urlParams_.Set("numVersions", fmt.Sprint(numVersions))
  4209. return c
  4210. }
  4211. // Fields allows partial responses to be retrieved. See
  4212. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4213. // for more information.
  4214. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  4215. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4216. return c
  4217. }
  4218. // IfNoneMatch sets the optional parameter which makes the operation
  4219. // fail if the object's ETag matches the given value. This is useful for
  4220. // getting updates only after the object has changed since the last
  4221. // request. Use googleapi.IsNotModified to check whether the response
  4222. // error from Do is the result of In-None-Match.
  4223. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  4224. c.ifNoneMatch_ = entityTag
  4225. return c
  4226. }
  4227. // Context sets the context to be used in this call's Do method. Any
  4228. // pending HTTP request will be aborted if the provided context is
  4229. // canceled.
  4230. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesConfigVersionsListCall {
  4231. c.ctx_ = ctx
  4232. return c
  4233. }
  4234. // Header returns an http.Header that can be modified by the caller to
  4235. // add HTTP headers to the request.
  4236. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Header() http.Header {
  4237. if c.header_ == nil {
  4238. c.header_ = make(http.Header)
  4239. }
  4240. return c.header_
  4241. }
  4242. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) doRequest(alt string) (*http.Response, error) {
  4243. reqHeaders := make(http.Header)
  4244. for k, v := range c.header_ {
  4245. reqHeaders[k] = v
  4246. }
  4247. reqHeaders.Set("User-Agent", c.s.userAgent())
  4248. if c.ifNoneMatch_ != "" {
  4249. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4250. }
  4251. var body io.Reader = nil
  4252. c.urlParams_.Set("alt", alt)
  4253. c.urlParams_.Set("prettyPrint", "false")
  4254. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/configVersions")
  4255. urls += "?" + c.urlParams_.Encode()
  4256. req, err := http.NewRequest("GET", urls, body)
  4257. if err != nil {
  4258. return nil, err
  4259. }
  4260. req.Header = reqHeaders
  4261. googleapi.Expand(req.URL, map[string]string{
  4262. "name": c.name,
  4263. })
  4264. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4265. }
  4266. // Do executes the "cloudiot.projects.locations.registries.devices.configVersions.list" call.
  4267. // Exactly one of *ListDeviceConfigVersionsResponse or error will be
  4268. // non-nil. Any non-2xx status code is an error. Response headers are in
  4269. // either *ListDeviceConfigVersionsResponse.ServerResponse.Header or (if
  4270. // a response was returned at all) in error.(*googleapi.Error).Header.
  4271. // Use googleapi.IsNotModified to check whether the returned error was
  4272. // because http.StatusNotModified was returned.
  4273. func (c *ProjectsLocationsRegistriesDevicesConfigVersionsListCall) Do(opts ...googleapi.CallOption) (*ListDeviceConfigVersionsResponse, error) {
  4274. gensupport.SetOptions(c.urlParams_, opts...)
  4275. res, err := c.doRequest("json")
  4276. if res != nil && res.StatusCode == http.StatusNotModified {
  4277. if res.Body != nil {
  4278. res.Body.Close()
  4279. }
  4280. return nil, &googleapi.Error{
  4281. Code: res.StatusCode,
  4282. Header: res.Header,
  4283. }
  4284. }
  4285. if err != nil {
  4286. return nil, err
  4287. }
  4288. defer googleapi.CloseBody(res)
  4289. if err := googleapi.CheckResponse(res); err != nil {
  4290. return nil, err
  4291. }
  4292. ret := &ListDeviceConfigVersionsResponse{
  4293. ServerResponse: googleapi.ServerResponse{
  4294. Header: res.Header,
  4295. HTTPStatusCode: res.StatusCode,
  4296. },
  4297. }
  4298. target := &ret
  4299. if err := gensupport.DecodeResponse(target, res); err != nil {
  4300. return nil, err
  4301. }
  4302. return ret, nil
  4303. // {
  4304. // "description": "Lists the last few versions of the device configuration in descending\norder (i.e.: newest first).",
  4305. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}/configVersions",
  4306. // "httpMethod": "GET",
  4307. // "id": "cloudiot.projects.locations.registries.devices.configVersions.list",
  4308. // "parameterOrder": [
  4309. // "name"
  4310. // ],
  4311. // "parameters": {
  4312. // "name": {
  4313. // "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}`.",
  4314. // "location": "path",
  4315. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  4316. // "required": true,
  4317. // "type": "string"
  4318. // },
  4319. // "numVersions": {
  4320. // "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.",
  4321. // "format": "int32",
  4322. // "location": "query",
  4323. // "type": "integer"
  4324. // }
  4325. // },
  4326. // "path": "v1/{+name}/configVersions",
  4327. // "response": {
  4328. // "$ref": "ListDeviceConfigVersionsResponse"
  4329. // },
  4330. // "scopes": [
  4331. // "https://www.googleapis.com/auth/cloud-platform",
  4332. // "https://www.googleapis.com/auth/cloudiot"
  4333. // ]
  4334. // }
  4335. }
  4336. // method id "cloudiot.projects.locations.registries.devices.states.list":
  4337. type ProjectsLocationsRegistriesDevicesStatesListCall struct {
  4338. s *Service
  4339. name string
  4340. urlParams_ gensupport.URLParams
  4341. ifNoneMatch_ string
  4342. ctx_ context.Context
  4343. header_ http.Header
  4344. }
  4345. // List: Lists the last few versions of the device state in descending
  4346. // order (i.e.:
  4347. // newest first).
  4348. func (r *ProjectsLocationsRegistriesDevicesStatesService) List(name string) *ProjectsLocationsRegistriesDevicesStatesListCall {
  4349. c := &ProjectsLocationsRegistriesDevicesStatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4350. c.name = name
  4351. return c
  4352. }
  4353. // NumStates sets the optional parameter "numStates": The number of
  4354. // states to list. States are listed in descending order of
  4355. // update time. The maximum number of states retained is 10. If
  4356. // this
  4357. // value is zero, it will return all the states available.
  4358. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) NumStates(numStates int64) *ProjectsLocationsRegistriesDevicesStatesListCall {
  4359. c.urlParams_.Set("numStates", fmt.Sprint(numStates))
  4360. return c
  4361. }
  4362. // Fields allows partial responses to be retrieved. See
  4363. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4364. // for more information.
  4365. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesDevicesStatesListCall {
  4366. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4367. return c
  4368. }
  4369. // IfNoneMatch sets the optional parameter which makes the operation
  4370. // fail if the object's ETag matches the given value. This is useful for
  4371. // getting updates only after the object has changed since the last
  4372. // request. Use googleapi.IsNotModified to check whether the response
  4373. // error from Do is the result of In-None-Match.
  4374. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesDevicesStatesListCall {
  4375. c.ifNoneMatch_ = entityTag
  4376. return c
  4377. }
  4378. // Context sets the context to be used in this call's Do method. Any
  4379. // pending HTTP request will be aborted if the provided context is
  4380. // canceled.
  4381. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesDevicesStatesListCall {
  4382. c.ctx_ = ctx
  4383. return c
  4384. }
  4385. // Header returns an http.Header that can be modified by the caller to
  4386. // add HTTP headers to the request.
  4387. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Header() http.Header {
  4388. if c.header_ == nil {
  4389. c.header_ = make(http.Header)
  4390. }
  4391. return c.header_
  4392. }
  4393. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) doRequest(alt string) (*http.Response, error) {
  4394. reqHeaders := make(http.Header)
  4395. for k, v := range c.header_ {
  4396. reqHeaders[k] = v
  4397. }
  4398. reqHeaders.Set("User-Agent", c.s.userAgent())
  4399. if c.ifNoneMatch_ != "" {
  4400. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4401. }
  4402. var body io.Reader = nil
  4403. c.urlParams_.Set("alt", alt)
  4404. c.urlParams_.Set("prettyPrint", "false")
  4405. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/states")
  4406. urls += "?" + c.urlParams_.Encode()
  4407. req, err := http.NewRequest("GET", urls, body)
  4408. if err != nil {
  4409. return nil, err
  4410. }
  4411. req.Header = reqHeaders
  4412. googleapi.Expand(req.URL, map[string]string{
  4413. "name": c.name,
  4414. })
  4415. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4416. }
  4417. // Do executes the "cloudiot.projects.locations.registries.devices.states.list" call.
  4418. // Exactly one of *ListDeviceStatesResponse or error will be non-nil.
  4419. // Any non-2xx status code is an error. Response headers are in either
  4420. // *ListDeviceStatesResponse.ServerResponse.Header or (if a response was
  4421. // returned at all) in error.(*googleapi.Error).Header. Use
  4422. // googleapi.IsNotModified to check whether the returned error was
  4423. // because http.StatusNotModified was returned.
  4424. func (c *ProjectsLocationsRegistriesDevicesStatesListCall) Do(opts ...googleapi.CallOption) (*ListDeviceStatesResponse, error) {
  4425. gensupport.SetOptions(c.urlParams_, opts...)
  4426. res, err := c.doRequest("json")
  4427. if res != nil && res.StatusCode == http.StatusNotModified {
  4428. if res.Body != nil {
  4429. res.Body.Close()
  4430. }
  4431. return nil, &googleapi.Error{
  4432. Code: res.StatusCode,
  4433. Header: res.Header,
  4434. }
  4435. }
  4436. if err != nil {
  4437. return nil, err
  4438. }
  4439. defer googleapi.CloseBody(res)
  4440. if err := googleapi.CheckResponse(res); err != nil {
  4441. return nil, err
  4442. }
  4443. ret := &ListDeviceStatesResponse{
  4444. ServerResponse: googleapi.ServerResponse{
  4445. Header: res.Header,
  4446. HTTPStatusCode: res.StatusCode,
  4447. },
  4448. }
  4449. target := &ret
  4450. if err := gensupport.DecodeResponse(target, res); err != nil {
  4451. return nil, err
  4452. }
  4453. return ret, nil
  4454. // {
  4455. // "description": "Lists the last few versions of the device state in descending order (i.e.:\nnewest first).",
  4456. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/devices/{devicesId}/states",
  4457. // "httpMethod": "GET",
  4458. // "id": "cloudiot.projects.locations.registries.devices.states.list",
  4459. // "parameterOrder": [
  4460. // "name"
  4461. // ],
  4462. // "parameters": {
  4463. // "name": {
  4464. // "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}`.",
  4465. // "location": "path",
  4466. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/devices/[^/]+$",
  4467. // "required": true,
  4468. // "type": "string"
  4469. // },
  4470. // "numStates": {
  4471. // "description": "The number of states to list. States are listed in descending order of\nupdate time. The maximum number of states retained is 10. If this\nvalue is zero, it will return all the states available.",
  4472. // "format": "int32",
  4473. // "location": "query",
  4474. // "type": "integer"
  4475. // }
  4476. // },
  4477. // "path": "v1/{+name}/states",
  4478. // "response": {
  4479. // "$ref": "ListDeviceStatesResponse"
  4480. // },
  4481. // "scopes": [
  4482. // "https://www.googleapis.com/auth/cloud-platform",
  4483. // "https://www.googleapis.com/auth/cloudiot"
  4484. // ]
  4485. // }
  4486. }
  4487. // method id "cloudiot.projects.locations.registries.groups.bindDeviceToGateway":
  4488. type ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall struct {
  4489. s *Service
  4490. parent string
  4491. binddevicetogatewayrequest *BindDeviceToGatewayRequest
  4492. urlParams_ gensupport.URLParams
  4493. ctx_ context.Context
  4494. header_ http.Header
  4495. }
  4496. // BindDeviceToGateway: Associates the device with the gateway.
  4497. func (r *ProjectsLocationsRegistriesGroupsService) BindDeviceToGateway(parent string, binddevicetogatewayrequest *BindDeviceToGatewayRequest) *ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall {
  4498. c := &ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4499. c.parent = parent
  4500. c.binddevicetogatewayrequest = binddevicetogatewayrequest
  4501. return c
  4502. }
  4503. // Fields allows partial responses to be retrieved. See
  4504. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4505. // for more information.
  4506. func (c *ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall {
  4507. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4508. return c
  4509. }
  4510. // Context sets the context to be used in this call's Do method. Any
  4511. // pending HTTP request will be aborted if the provided context is
  4512. // canceled.
  4513. func (c *ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall {
  4514. c.ctx_ = ctx
  4515. return c
  4516. }
  4517. // Header returns an http.Header that can be modified by the caller to
  4518. // add HTTP headers to the request.
  4519. func (c *ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall) Header() http.Header {
  4520. if c.header_ == nil {
  4521. c.header_ = make(http.Header)
  4522. }
  4523. return c.header_
  4524. }
  4525. func (c *ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall) doRequest(alt string) (*http.Response, error) {
  4526. reqHeaders := make(http.Header)
  4527. for k, v := range c.header_ {
  4528. reqHeaders[k] = v
  4529. }
  4530. reqHeaders.Set("User-Agent", c.s.userAgent())
  4531. var body io.Reader = nil
  4532. body, err := googleapi.WithoutDataWrapper.JSONReader(c.binddevicetogatewayrequest)
  4533. if err != nil {
  4534. return nil, err
  4535. }
  4536. reqHeaders.Set("Content-Type", "application/json")
  4537. c.urlParams_.Set("alt", alt)
  4538. c.urlParams_.Set("prettyPrint", "false")
  4539. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:bindDeviceToGateway")
  4540. urls += "?" + c.urlParams_.Encode()
  4541. req, err := http.NewRequest("POST", urls, body)
  4542. if err != nil {
  4543. return nil, err
  4544. }
  4545. req.Header = reqHeaders
  4546. googleapi.Expand(req.URL, map[string]string{
  4547. "parent": c.parent,
  4548. })
  4549. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4550. }
  4551. // Do executes the "cloudiot.projects.locations.registries.groups.bindDeviceToGateway" call.
  4552. // Exactly one of *BindDeviceToGatewayResponse or error will be non-nil.
  4553. // Any non-2xx status code is an error. Response headers are in either
  4554. // *BindDeviceToGatewayResponse.ServerResponse.Header or (if a response
  4555. // was returned at all) in error.(*googleapi.Error).Header. Use
  4556. // googleapi.IsNotModified to check whether the returned error was
  4557. // because http.StatusNotModified was returned.
  4558. func (c *ProjectsLocationsRegistriesGroupsBindDeviceToGatewayCall) Do(opts ...googleapi.CallOption) (*BindDeviceToGatewayResponse, error) {
  4559. gensupport.SetOptions(c.urlParams_, opts...)
  4560. res, err := c.doRequest("json")
  4561. if res != nil && res.StatusCode == http.StatusNotModified {
  4562. if res.Body != nil {
  4563. res.Body.Close()
  4564. }
  4565. return nil, &googleapi.Error{
  4566. Code: res.StatusCode,
  4567. Header: res.Header,
  4568. }
  4569. }
  4570. if err != nil {
  4571. return nil, err
  4572. }
  4573. defer googleapi.CloseBody(res)
  4574. if err := googleapi.CheckResponse(res); err != nil {
  4575. return nil, err
  4576. }
  4577. ret := &BindDeviceToGatewayResponse{
  4578. ServerResponse: googleapi.ServerResponse{
  4579. Header: res.Header,
  4580. HTTPStatusCode: res.StatusCode,
  4581. },
  4582. }
  4583. target := &ret
  4584. if err := gensupport.DecodeResponse(target, res); err != nil {
  4585. return nil, err
  4586. }
  4587. return ret, nil
  4588. // {
  4589. // "description": "Associates the device with the gateway.",
  4590. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}:bindDeviceToGateway",
  4591. // "httpMethod": "POST",
  4592. // "id": "cloudiot.projects.locations.registries.groups.bindDeviceToGateway",
  4593. // "parameterOrder": [
  4594. // "parent"
  4595. // ],
  4596. // "parameters": {
  4597. // "parent": {
  4598. // "description": "The name of the registry. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  4599. // "location": "path",
  4600. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$",
  4601. // "required": true,
  4602. // "type": "string"
  4603. // }
  4604. // },
  4605. // "path": "v1/{+parent}:bindDeviceToGateway",
  4606. // "request": {
  4607. // "$ref": "BindDeviceToGatewayRequest"
  4608. // },
  4609. // "response": {
  4610. // "$ref": "BindDeviceToGatewayResponse"
  4611. // },
  4612. // "scopes": [
  4613. // "https://www.googleapis.com/auth/cloud-platform",
  4614. // "https://www.googleapis.com/auth/cloudiot"
  4615. // ]
  4616. // }
  4617. }
  4618. // method id "cloudiot.projects.locations.registries.groups.getIamPolicy":
  4619. type ProjectsLocationsRegistriesGroupsGetIamPolicyCall struct {
  4620. s *Service
  4621. resource string
  4622. getiampolicyrequest *GetIamPolicyRequest
  4623. urlParams_ gensupport.URLParams
  4624. ctx_ context.Context
  4625. header_ http.Header
  4626. }
  4627. // GetIamPolicy: Gets the access control policy for a resource.
  4628. // Returns an empty policy if the resource exists and does not have a
  4629. // policy
  4630. // set.
  4631. func (r *ProjectsLocationsRegistriesGroupsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsLocationsRegistriesGroupsGetIamPolicyCall {
  4632. c := &ProjectsLocationsRegistriesGroupsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4633. c.resource = resource
  4634. c.getiampolicyrequest = getiampolicyrequest
  4635. return c
  4636. }
  4637. // Fields allows partial responses to be retrieved. See
  4638. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4639. // for more information.
  4640. func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsGetIamPolicyCall {
  4641. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4642. return c
  4643. }
  4644. // Context sets the context to be used in this call's Do method. Any
  4645. // pending HTTP request will be aborted if the provided context is
  4646. // canceled.
  4647. func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsGetIamPolicyCall {
  4648. c.ctx_ = ctx
  4649. return c
  4650. }
  4651. // Header returns an http.Header that can be modified by the caller to
  4652. // add HTTP headers to the request.
  4653. func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) Header() http.Header {
  4654. if c.header_ == nil {
  4655. c.header_ = make(http.Header)
  4656. }
  4657. return c.header_
  4658. }
  4659. func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4660. reqHeaders := make(http.Header)
  4661. for k, v := range c.header_ {
  4662. reqHeaders[k] = v
  4663. }
  4664. reqHeaders.Set("User-Agent", c.s.userAgent())
  4665. var body io.Reader = nil
  4666. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  4667. if err != nil {
  4668. return nil, err
  4669. }
  4670. reqHeaders.Set("Content-Type", "application/json")
  4671. c.urlParams_.Set("alt", alt)
  4672. c.urlParams_.Set("prettyPrint", "false")
  4673. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  4674. urls += "?" + c.urlParams_.Encode()
  4675. req, err := http.NewRequest("POST", urls, body)
  4676. if err != nil {
  4677. return nil, err
  4678. }
  4679. req.Header = reqHeaders
  4680. googleapi.Expand(req.URL, map[string]string{
  4681. "resource": c.resource,
  4682. })
  4683. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4684. }
  4685. // Do executes the "cloudiot.projects.locations.registries.groups.getIamPolicy" call.
  4686. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4687. // code is an error. Response headers are in either
  4688. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4689. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4690. // check whether the returned error was because http.StatusNotModified
  4691. // was returned.
  4692. func (c *ProjectsLocationsRegistriesGroupsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4693. gensupport.SetOptions(c.urlParams_, opts...)
  4694. res, err := c.doRequest("json")
  4695. if res != nil && res.StatusCode == http.StatusNotModified {
  4696. if res.Body != nil {
  4697. res.Body.Close()
  4698. }
  4699. return nil, &googleapi.Error{
  4700. Code: res.StatusCode,
  4701. Header: res.Header,
  4702. }
  4703. }
  4704. if err != nil {
  4705. return nil, err
  4706. }
  4707. defer googleapi.CloseBody(res)
  4708. if err := googleapi.CheckResponse(res); err != nil {
  4709. return nil, err
  4710. }
  4711. ret := &Policy{
  4712. ServerResponse: googleapi.ServerResponse{
  4713. Header: res.Header,
  4714. HTTPStatusCode: res.StatusCode,
  4715. },
  4716. }
  4717. target := &ret
  4718. if err := gensupport.DecodeResponse(target, res); err != nil {
  4719. return nil, err
  4720. }
  4721. return ret, nil
  4722. // {
  4723. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  4724. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}:getIamPolicy",
  4725. // "httpMethod": "POST",
  4726. // "id": "cloudiot.projects.locations.registries.groups.getIamPolicy",
  4727. // "parameterOrder": [
  4728. // "resource"
  4729. // ],
  4730. // "parameters": {
  4731. // "resource": {
  4732. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  4733. // "location": "path",
  4734. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$",
  4735. // "required": true,
  4736. // "type": "string"
  4737. // }
  4738. // },
  4739. // "path": "v1/{+resource}:getIamPolicy",
  4740. // "request": {
  4741. // "$ref": "GetIamPolicyRequest"
  4742. // },
  4743. // "response": {
  4744. // "$ref": "Policy"
  4745. // },
  4746. // "scopes": [
  4747. // "https://www.googleapis.com/auth/cloud-platform",
  4748. // "https://www.googleapis.com/auth/cloudiot"
  4749. // ]
  4750. // }
  4751. }
  4752. // method id "cloudiot.projects.locations.registries.groups.setIamPolicy":
  4753. type ProjectsLocationsRegistriesGroupsSetIamPolicyCall struct {
  4754. s *Service
  4755. resource string
  4756. setiampolicyrequest *SetIamPolicyRequest
  4757. urlParams_ gensupport.URLParams
  4758. ctx_ context.Context
  4759. header_ http.Header
  4760. }
  4761. // SetIamPolicy: Sets the access control policy on the specified
  4762. // resource. Replaces any
  4763. // existing policy.
  4764. func (r *ProjectsLocationsRegistriesGroupsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsRegistriesGroupsSetIamPolicyCall {
  4765. c := &ProjectsLocationsRegistriesGroupsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4766. c.resource = resource
  4767. c.setiampolicyrequest = setiampolicyrequest
  4768. return c
  4769. }
  4770. // Fields allows partial responses to be retrieved. See
  4771. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4772. // for more information.
  4773. func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsSetIamPolicyCall {
  4774. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4775. return c
  4776. }
  4777. // Context sets the context to be used in this call's Do method. Any
  4778. // pending HTTP request will be aborted if the provided context is
  4779. // canceled.
  4780. func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsSetIamPolicyCall {
  4781. c.ctx_ = ctx
  4782. return c
  4783. }
  4784. // Header returns an http.Header that can be modified by the caller to
  4785. // add HTTP headers to the request.
  4786. func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) Header() http.Header {
  4787. if c.header_ == nil {
  4788. c.header_ = make(http.Header)
  4789. }
  4790. return c.header_
  4791. }
  4792. func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4793. reqHeaders := make(http.Header)
  4794. for k, v := range c.header_ {
  4795. reqHeaders[k] = v
  4796. }
  4797. reqHeaders.Set("User-Agent", c.s.userAgent())
  4798. var body io.Reader = nil
  4799. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  4800. if err != nil {
  4801. return nil, err
  4802. }
  4803. reqHeaders.Set("Content-Type", "application/json")
  4804. c.urlParams_.Set("alt", alt)
  4805. c.urlParams_.Set("prettyPrint", "false")
  4806. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  4807. urls += "?" + c.urlParams_.Encode()
  4808. req, err := http.NewRequest("POST", urls, body)
  4809. if err != nil {
  4810. return nil, err
  4811. }
  4812. req.Header = reqHeaders
  4813. googleapi.Expand(req.URL, map[string]string{
  4814. "resource": c.resource,
  4815. })
  4816. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4817. }
  4818. // Do executes the "cloudiot.projects.locations.registries.groups.setIamPolicy" call.
  4819. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4820. // code is an error. Response headers are in either
  4821. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4822. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4823. // check whether the returned error was because http.StatusNotModified
  4824. // was returned.
  4825. func (c *ProjectsLocationsRegistriesGroupsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4826. gensupport.SetOptions(c.urlParams_, opts...)
  4827. res, err := c.doRequest("json")
  4828. if res != nil && res.StatusCode == http.StatusNotModified {
  4829. if res.Body != nil {
  4830. res.Body.Close()
  4831. }
  4832. return nil, &googleapi.Error{
  4833. Code: res.StatusCode,
  4834. Header: res.Header,
  4835. }
  4836. }
  4837. if err != nil {
  4838. return nil, err
  4839. }
  4840. defer googleapi.CloseBody(res)
  4841. if err := googleapi.CheckResponse(res); err != nil {
  4842. return nil, err
  4843. }
  4844. ret := &Policy{
  4845. ServerResponse: googleapi.ServerResponse{
  4846. Header: res.Header,
  4847. HTTPStatusCode: res.StatusCode,
  4848. },
  4849. }
  4850. target := &ret
  4851. if err := gensupport.DecodeResponse(target, res); err != nil {
  4852. return nil, err
  4853. }
  4854. return ret, nil
  4855. // {
  4856. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  4857. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}:setIamPolicy",
  4858. // "httpMethod": "POST",
  4859. // "id": "cloudiot.projects.locations.registries.groups.setIamPolicy",
  4860. // "parameterOrder": [
  4861. // "resource"
  4862. // ],
  4863. // "parameters": {
  4864. // "resource": {
  4865. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  4866. // "location": "path",
  4867. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$",
  4868. // "required": true,
  4869. // "type": "string"
  4870. // }
  4871. // },
  4872. // "path": "v1/{+resource}:setIamPolicy",
  4873. // "request": {
  4874. // "$ref": "SetIamPolicyRequest"
  4875. // },
  4876. // "response": {
  4877. // "$ref": "Policy"
  4878. // },
  4879. // "scopes": [
  4880. // "https://www.googleapis.com/auth/cloud-platform",
  4881. // "https://www.googleapis.com/auth/cloudiot"
  4882. // ]
  4883. // }
  4884. }
  4885. // method id "cloudiot.projects.locations.registries.groups.testIamPermissions":
  4886. type ProjectsLocationsRegistriesGroupsTestIamPermissionsCall struct {
  4887. s *Service
  4888. resource string
  4889. testiampermissionsrequest *TestIamPermissionsRequest
  4890. urlParams_ gensupport.URLParams
  4891. ctx_ context.Context
  4892. header_ http.Header
  4893. }
  4894. // TestIamPermissions: Returns permissions that a caller has on the
  4895. // specified resource.
  4896. // If the resource does not exist, this will return an empty set
  4897. // of
  4898. // permissions, not a NOT_FOUND error.
  4899. func (r *ProjectsLocationsRegistriesGroupsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall {
  4900. c := &ProjectsLocationsRegistriesGroupsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4901. c.resource = resource
  4902. c.testiampermissionsrequest = testiampermissionsrequest
  4903. return c
  4904. }
  4905. // Fields allows partial responses to be retrieved. See
  4906. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4907. // for more information.
  4908. func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall {
  4909. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4910. return c
  4911. }
  4912. // Context sets the context to be used in this call's Do method. Any
  4913. // pending HTTP request will be aborted if the provided context is
  4914. // canceled.
  4915. func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall {
  4916. c.ctx_ = ctx
  4917. return c
  4918. }
  4919. // Header returns an http.Header that can be modified by the caller to
  4920. // add HTTP headers to the request.
  4921. func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) Header() http.Header {
  4922. if c.header_ == nil {
  4923. c.header_ = make(http.Header)
  4924. }
  4925. return c.header_
  4926. }
  4927. func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  4928. reqHeaders := make(http.Header)
  4929. for k, v := range c.header_ {
  4930. reqHeaders[k] = v
  4931. }
  4932. reqHeaders.Set("User-Agent", c.s.userAgent())
  4933. var body io.Reader = nil
  4934. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  4935. if err != nil {
  4936. return nil, err
  4937. }
  4938. reqHeaders.Set("Content-Type", "application/json")
  4939. c.urlParams_.Set("alt", alt)
  4940. c.urlParams_.Set("prettyPrint", "false")
  4941. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  4942. urls += "?" + c.urlParams_.Encode()
  4943. req, err := http.NewRequest("POST", urls, body)
  4944. if err != nil {
  4945. return nil, err
  4946. }
  4947. req.Header = reqHeaders
  4948. googleapi.Expand(req.URL, map[string]string{
  4949. "resource": c.resource,
  4950. })
  4951. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4952. }
  4953. // Do executes the "cloudiot.projects.locations.registries.groups.testIamPermissions" call.
  4954. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  4955. // Any non-2xx status code is an error. Response headers are in either
  4956. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  4957. // was returned at all) in error.(*googleapi.Error).Header. Use
  4958. // googleapi.IsNotModified to check whether the returned error was
  4959. // because http.StatusNotModified was returned.
  4960. func (c *ProjectsLocationsRegistriesGroupsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  4961. gensupport.SetOptions(c.urlParams_, opts...)
  4962. res, err := c.doRequest("json")
  4963. if res != nil && res.StatusCode == http.StatusNotModified {
  4964. if res.Body != nil {
  4965. res.Body.Close()
  4966. }
  4967. return nil, &googleapi.Error{
  4968. Code: res.StatusCode,
  4969. Header: res.Header,
  4970. }
  4971. }
  4972. if err != nil {
  4973. return nil, err
  4974. }
  4975. defer googleapi.CloseBody(res)
  4976. if err := googleapi.CheckResponse(res); err != nil {
  4977. return nil, err
  4978. }
  4979. ret := &TestIamPermissionsResponse{
  4980. ServerResponse: googleapi.ServerResponse{
  4981. Header: res.Header,
  4982. HTTPStatusCode: res.StatusCode,
  4983. },
  4984. }
  4985. target := &ret
  4986. if err := gensupport.DecodeResponse(target, res); err != nil {
  4987. return nil, err
  4988. }
  4989. return ret, nil
  4990. // {
  4991. // "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.",
  4992. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}:testIamPermissions",
  4993. // "httpMethod": "POST",
  4994. // "id": "cloudiot.projects.locations.registries.groups.testIamPermissions",
  4995. // "parameterOrder": [
  4996. // "resource"
  4997. // ],
  4998. // "parameters": {
  4999. // "resource": {
  5000. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  5001. // "location": "path",
  5002. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$",
  5003. // "required": true,
  5004. // "type": "string"
  5005. // }
  5006. // },
  5007. // "path": "v1/{+resource}:testIamPermissions",
  5008. // "request": {
  5009. // "$ref": "TestIamPermissionsRequest"
  5010. // },
  5011. // "response": {
  5012. // "$ref": "TestIamPermissionsResponse"
  5013. // },
  5014. // "scopes": [
  5015. // "https://www.googleapis.com/auth/cloud-platform",
  5016. // "https://www.googleapis.com/auth/cloudiot"
  5017. // ]
  5018. // }
  5019. }
  5020. // method id "cloudiot.projects.locations.registries.groups.unbindDeviceFromGateway":
  5021. type ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall struct {
  5022. s *Service
  5023. parent string
  5024. unbinddevicefromgatewayrequest *UnbindDeviceFromGatewayRequest
  5025. urlParams_ gensupport.URLParams
  5026. ctx_ context.Context
  5027. header_ http.Header
  5028. }
  5029. // UnbindDeviceFromGateway: Deletes the association between the device
  5030. // and the gateway.
  5031. func (r *ProjectsLocationsRegistriesGroupsService) UnbindDeviceFromGateway(parent string, unbinddevicefromgatewayrequest *UnbindDeviceFromGatewayRequest) *ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall {
  5032. c := &ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5033. c.parent = parent
  5034. c.unbinddevicefromgatewayrequest = unbinddevicefromgatewayrequest
  5035. return c
  5036. }
  5037. // Fields allows partial responses to be retrieved. See
  5038. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5039. // for more information.
  5040. func (c *ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall {
  5041. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5042. return c
  5043. }
  5044. // Context sets the context to be used in this call's Do method. Any
  5045. // pending HTTP request will be aborted if the provided context is
  5046. // canceled.
  5047. func (c *ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall {
  5048. c.ctx_ = ctx
  5049. return c
  5050. }
  5051. // Header returns an http.Header that can be modified by the caller to
  5052. // add HTTP headers to the request.
  5053. func (c *ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall) Header() http.Header {
  5054. if c.header_ == nil {
  5055. c.header_ = make(http.Header)
  5056. }
  5057. return c.header_
  5058. }
  5059. func (c *ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall) doRequest(alt string) (*http.Response, error) {
  5060. reqHeaders := make(http.Header)
  5061. for k, v := range c.header_ {
  5062. reqHeaders[k] = v
  5063. }
  5064. reqHeaders.Set("User-Agent", c.s.userAgent())
  5065. var body io.Reader = nil
  5066. body, err := googleapi.WithoutDataWrapper.JSONReader(c.unbinddevicefromgatewayrequest)
  5067. if err != nil {
  5068. return nil, err
  5069. }
  5070. reqHeaders.Set("Content-Type", "application/json")
  5071. c.urlParams_.Set("alt", alt)
  5072. c.urlParams_.Set("prettyPrint", "false")
  5073. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:unbindDeviceFromGateway")
  5074. urls += "?" + c.urlParams_.Encode()
  5075. req, err := http.NewRequest("POST", urls, body)
  5076. if err != nil {
  5077. return nil, err
  5078. }
  5079. req.Header = reqHeaders
  5080. googleapi.Expand(req.URL, map[string]string{
  5081. "parent": c.parent,
  5082. })
  5083. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5084. }
  5085. // Do executes the "cloudiot.projects.locations.registries.groups.unbindDeviceFromGateway" call.
  5086. // Exactly one of *UnbindDeviceFromGatewayResponse or error will be
  5087. // non-nil. Any non-2xx status code is an error. Response headers are in
  5088. // either *UnbindDeviceFromGatewayResponse.ServerResponse.Header or (if
  5089. // a response was returned at all) in error.(*googleapi.Error).Header.
  5090. // Use googleapi.IsNotModified to check whether the returned error was
  5091. // because http.StatusNotModified was returned.
  5092. func (c *ProjectsLocationsRegistriesGroupsUnbindDeviceFromGatewayCall) Do(opts ...googleapi.CallOption) (*UnbindDeviceFromGatewayResponse, error) {
  5093. gensupport.SetOptions(c.urlParams_, opts...)
  5094. res, err := c.doRequest("json")
  5095. if res != nil && res.StatusCode == http.StatusNotModified {
  5096. if res.Body != nil {
  5097. res.Body.Close()
  5098. }
  5099. return nil, &googleapi.Error{
  5100. Code: res.StatusCode,
  5101. Header: res.Header,
  5102. }
  5103. }
  5104. if err != nil {
  5105. return nil, err
  5106. }
  5107. defer googleapi.CloseBody(res)
  5108. if err := googleapi.CheckResponse(res); err != nil {
  5109. return nil, err
  5110. }
  5111. ret := &UnbindDeviceFromGatewayResponse{
  5112. ServerResponse: googleapi.ServerResponse{
  5113. Header: res.Header,
  5114. HTTPStatusCode: res.StatusCode,
  5115. },
  5116. }
  5117. target := &ret
  5118. if err := gensupport.DecodeResponse(target, res); err != nil {
  5119. return nil, err
  5120. }
  5121. return ret, nil
  5122. // {
  5123. // "description": "Deletes the association between the device and the gateway.",
  5124. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}:unbindDeviceFromGateway",
  5125. // "httpMethod": "POST",
  5126. // "id": "cloudiot.projects.locations.registries.groups.unbindDeviceFromGateway",
  5127. // "parameterOrder": [
  5128. // "parent"
  5129. // ],
  5130. // "parameters": {
  5131. // "parent": {
  5132. // "description": "The name of the registry. For example,\n`projects/example-project/locations/us-central1/registries/my-registry`.",
  5133. // "location": "path",
  5134. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$",
  5135. // "required": true,
  5136. // "type": "string"
  5137. // }
  5138. // },
  5139. // "path": "v1/{+parent}:unbindDeviceFromGateway",
  5140. // "request": {
  5141. // "$ref": "UnbindDeviceFromGatewayRequest"
  5142. // },
  5143. // "response": {
  5144. // "$ref": "UnbindDeviceFromGatewayResponse"
  5145. // },
  5146. // "scopes": [
  5147. // "https://www.googleapis.com/auth/cloud-platform",
  5148. // "https://www.googleapis.com/auth/cloudiot"
  5149. // ]
  5150. // }
  5151. }
  5152. // method id "cloudiot.projects.locations.registries.groups.devices.get":
  5153. type ProjectsLocationsRegistriesGroupsDevicesGetCall struct {
  5154. s *Service
  5155. name string
  5156. urlParams_ gensupport.URLParams
  5157. ifNoneMatch_ string
  5158. ctx_ context.Context
  5159. header_ http.Header
  5160. }
  5161. // Get: Gets details about a device.
  5162. func (r *ProjectsLocationsRegistriesGroupsDevicesService) Get(name string) *ProjectsLocationsRegistriesGroupsDevicesGetCall {
  5163. c := &ProjectsLocationsRegistriesGroupsDevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5164. c.name = name
  5165. return c
  5166. }
  5167. // FieldMask sets the optional parameter "fieldMask": The fields of the
  5168. // `Device` resource to be returned in the response. If the
  5169. // field mask is unset or empty, all fields are returned.
  5170. func (c *ProjectsLocationsRegistriesGroupsDevicesGetCall) FieldMask(fieldMask string) *ProjectsLocationsRegistriesGroupsDevicesGetCall {
  5171. c.urlParams_.Set("fieldMask", fieldMask)
  5172. return c
  5173. }
  5174. // Fields allows partial responses to be retrieved. See
  5175. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5176. // for more information.
  5177. func (c *ProjectsLocationsRegistriesGroupsDevicesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsDevicesGetCall {
  5178. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5179. return c
  5180. }
  5181. // IfNoneMatch sets the optional parameter which makes the operation
  5182. // fail if the object's ETag matches the given value. This is useful for
  5183. // getting updates only after the object has changed since the last
  5184. // request. Use googleapi.IsNotModified to check whether the response
  5185. // error from Do is the result of In-None-Match.
  5186. func (c *ProjectsLocationsRegistriesGroupsDevicesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesGroupsDevicesGetCall {
  5187. c.ifNoneMatch_ = entityTag
  5188. return c
  5189. }
  5190. // Context sets the context to be used in this call's Do method. Any
  5191. // pending HTTP request will be aborted if the provided context is
  5192. // canceled.
  5193. func (c *ProjectsLocationsRegistriesGroupsDevicesGetCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsDevicesGetCall {
  5194. c.ctx_ = ctx
  5195. return c
  5196. }
  5197. // Header returns an http.Header that can be modified by the caller to
  5198. // add HTTP headers to the request.
  5199. func (c *ProjectsLocationsRegistriesGroupsDevicesGetCall) Header() http.Header {
  5200. if c.header_ == nil {
  5201. c.header_ = make(http.Header)
  5202. }
  5203. return c.header_
  5204. }
  5205. func (c *ProjectsLocationsRegistriesGroupsDevicesGetCall) doRequest(alt string) (*http.Response, error) {
  5206. reqHeaders := make(http.Header)
  5207. for k, v := range c.header_ {
  5208. reqHeaders[k] = v
  5209. }
  5210. reqHeaders.Set("User-Agent", c.s.userAgent())
  5211. if c.ifNoneMatch_ != "" {
  5212. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5213. }
  5214. var body io.Reader = nil
  5215. c.urlParams_.Set("alt", alt)
  5216. c.urlParams_.Set("prettyPrint", "false")
  5217. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5218. urls += "?" + c.urlParams_.Encode()
  5219. req, err := http.NewRequest("GET", urls, body)
  5220. if err != nil {
  5221. return nil, err
  5222. }
  5223. req.Header = reqHeaders
  5224. googleapi.Expand(req.URL, map[string]string{
  5225. "name": c.name,
  5226. })
  5227. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5228. }
  5229. // Do executes the "cloudiot.projects.locations.registries.groups.devices.get" call.
  5230. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  5231. // code is an error. Response headers are in either
  5232. // *Device.ServerResponse.Header or (if a response was returned at all)
  5233. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5234. // check whether the returned error was because http.StatusNotModified
  5235. // was returned.
  5236. func (c *ProjectsLocationsRegistriesGroupsDevicesGetCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  5237. gensupport.SetOptions(c.urlParams_, opts...)
  5238. res, err := c.doRequest("json")
  5239. if res != nil && res.StatusCode == http.StatusNotModified {
  5240. if res.Body != nil {
  5241. res.Body.Close()
  5242. }
  5243. return nil, &googleapi.Error{
  5244. Code: res.StatusCode,
  5245. Header: res.Header,
  5246. }
  5247. }
  5248. if err != nil {
  5249. return nil, err
  5250. }
  5251. defer googleapi.CloseBody(res)
  5252. if err := googleapi.CheckResponse(res); err != nil {
  5253. return nil, err
  5254. }
  5255. ret := &Device{
  5256. ServerResponse: googleapi.ServerResponse{
  5257. Header: res.Header,
  5258. HTTPStatusCode: res.StatusCode,
  5259. },
  5260. }
  5261. target := &ret
  5262. if err := gensupport.DecodeResponse(target, res); err != nil {
  5263. return nil, err
  5264. }
  5265. return ret, nil
  5266. // {
  5267. // "description": "Gets details about a device.",
  5268. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}/devices/{devicesId}",
  5269. // "httpMethod": "GET",
  5270. // "id": "cloudiot.projects.locations.registries.groups.devices.get",
  5271. // "parameterOrder": [
  5272. // "name"
  5273. // ],
  5274. // "parameters": {
  5275. // "fieldMask": {
  5276. // "description": "The fields of the `Device` resource to be returned in the response. If the\nfield mask is unset or empty, all fields are returned.",
  5277. // "format": "google-fieldmask",
  5278. // "location": "query",
  5279. // "type": "string"
  5280. // },
  5281. // "name": {
  5282. // "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}`.",
  5283. // "location": "path",
  5284. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+/devices/[^/]+$",
  5285. // "required": true,
  5286. // "type": "string"
  5287. // }
  5288. // },
  5289. // "path": "v1/{+name}",
  5290. // "response": {
  5291. // "$ref": "Device"
  5292. // },
  5293. // "scopes": [
  5294. // "https://www.googleapis.com/auth/cloud-platform",
  5295. // "https://www.googleapis.com/auth/cloudiot"
  5296. // ]
  5297. // }
  5298. }
  5299. // method id "cloudiot.projects.locations.registries.groups.devices.list":
  5300. type ProjectsLocationsRegistriesGroupsDevicesListCall struct {
  5301. s *Service
  5302. parent string
  5303. urlParams_ gensupport.URLParams
  5304. ifNoneMatch_ string
  5305. ctx_ context.Context
  5306. header_ http.Header
  5307. }
  5308. // List: List devices in a device registry.
  5309. func (r *ProjectsLocationsRegistriesGroupsDevicesService) List(parent string) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5310. c := &ProjectsLocationsRegistriesGroupsDevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5311. c.parent = parent
  5312. return c
  5313. }
  5314. // DeviceIds sets the optional parameter "deviceIds": A list of device
  5315. // string IDs. For example, `['device0', 'device12']`.
  5316. // If empty, this field is ignored. Maximum IDs: 10,000
  5317. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) DeviceIds(deviceIds ...string) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5318. c.urlParams_.SetMulti("deviceIds", append([]string{}, deviceIds...))
  5319. return c
  5320. }
  5321. // DeviceNumIds sets the optional parameter "deviceNumIds": A list of
  5322. // device numeric IDs. If empty, this field is ignored. Maximum
  5323. // IDs: 10,000.
  5324. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) DeviceNumIds(deviceNumIds ...uint64) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5325. var deviceNumIds_ []string
  5326. for _, v := range deviceNumIds {
  5327. deviceNumIds_ = append(deviceNumIds_, fmt.Sprint(v))
  5328. }
  5329. c.urlParams_.SetMulti("deviceNumIds", deviceNumIds_)
  5330. return c
  5331. }
  5332. // FieldMask sets the optional parameter "fieldMask": The fields of the
  5333. // `Device` resource to be returned in the response. The
  5334. // fields `id` and `num_id` are always returned, along with any
  5335. // other fields specified.
  5336. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) FieldMask(fieldMask string) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5337. c.urlParams_.Set("fieldMask", fieldMask)
  5338. return c
  5339. }
  5340. // GatewayListOptionsAssociationsDeviceId sets the optional parameter
  5341. // "gatewayListOptions.associationsDeviceId": If set, returns only the
  5342. // gateways with which the specified device is
  5343. // associated. The device ID can be numeric (`num_id`) or the
  5344. // user-defined
  5345. // string (`id`). For example, if `456` is specified, returns only
  5346. // the
  5347. // gateways to which the device with `num_id` 456 is bound.
  5348. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) GatewayListOptionsAssociationsDeviceId(gatewayListOptionsAssociationsDeviceId string) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5349. c.urlParams_.Set("gatewayListOptions.associationsDeviceId", gatewayListOptionsAssociationsDeviceId)
  5350. return c
  5351. }
  5352. // GatewayListOptionsAssociationsGatewayId sets the optional parameter
  5353. // "gatewayListOptions.associationsGatewayId": If set, only devices
  5354. // associated with the specified gateway are returned.
  5355. // The gateway ID can be numeric (`num_id`) or the user-defined
  5356. // string
  5357. // (`id`). For example, if `123` is specified, only devices bound to
  5358. // the
  5359. // gateway with `num_id` 123 are returned.
  5360. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) GatewayListOptionsAssociationsGatewayId(gatewayListOptionsAssociationsGatewayId string) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5361. c.urlParams_.Set("gatewayListOptions.associationsGatewayId", gatewayListOptionsAssociationsGatewayId)
  5362. return c
  5363. }
  5364. // GatewayListOptionsGatewayType sets the optional parameter
  5365. // "gatewayListOptions.gatewayType": If `GATEWAY` is specified, only
  5366. // gateways are returned. If `NON_GATEWAY`
  5367. // is specified, only non-gateway devices are returned.
  5368. // If
  5369. // `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
  5370. //
  5371. // Possible values:
  5372. // "GATEWAY_TYPE_UNSPECIFIED"
  5373. // "GATEWAY"
  5374. // "NON_GATEWAY"
  5375. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) GatewayListOptionsGatewayType(gatewayListOptionsGatewayType string) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5376. c.urlParams_.Set("gatewayListOptions.gatewayType", gatewayListOptionsGatewayType)
  5377. return c
  5378. }
  5379. // PageSize sets the optional parameter "pageSize": The maximum number
  5380. // of devices to return in the response. If this value
  5381. // is zero, the service will select a default size. A call may return
  5382. // fewer
  5383. // objects than requested. A non-empty `next_page_token` in the
  5384. // response
  5385. // indicates that more data is available.
  5386. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) PageSize(pageSize int64) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5387. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5388. return c
  5389. }
  5390. // PageToken sets the optional parameter "pageToken": The value returned
  5391. // by the last `ListDevicesResponse`; indicates
  5392. // that this is a continuation of a prior `ListDevices` call and
  5393. // the system should return the next page of data.
  5394. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) PageToken(pageToken string) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5395. c.urlParams_.Set("pageToken", pageToken)
  5396. return c
  5397. }
  5398. // Fields allows partial responses to be retrieved. See
  5399. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5400. // for more information.
  5401. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5402. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5403. return c
  5404. }
  5405. // IfNoneMatch sets the optional parameter which makes the operation
  5406. // fail if the object's ETag matches the given value. This is useful for
  5407. // getting updates only after the object has changed since the last
  5408. // request. Use googleapi.IsNotModified to check whether the response
  5409. // error from Do is the result of In-None-Match.
  5410. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5411. c.ifNoneMatch_ = entityTag
  5412. return c
  5413. }
  5414. // Context sets the context to be used in this call's Do method. Any
  5415. // pending HTTP request will be aborted if the provided context is
  5416. // canceled.
  5417. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsDevicesListCall {
  5418. c.ctx_ = ctx
  5419. return c
  5420. }
  5421. // Header returns an http.Header that can be modified by the caller to
  5422. // add HTTP headers to the request.
  5423. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Header() http.Header {
  5424. if c.header_ == nil {
  5425. c.header_ = make(http.Header)
  5426. }
  5427. return c.header_
  5428. }
  5429. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) doRequest(alt string) (*http.Response, error) {
  5430. reqHeaders := make(http.Header)
  5431. for k, v := range c.header_ {
  5432. reqHeaders[k] = v
  5433. }
  5434. reqHeaders.Set("User-Agent", c.s.userAgent())
  5435. if c.ifNoneMatch_ != "" {
  5436. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5437. }
  5438. var body io.Reader = nil
  5439. c.urlParams_.Set("alt", alt)
  5440. c.urlParams_.Set("prettyPrint", "false")
  5441. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices")
  5442. urls += "?" + c.urlParams_.Encode()
  5443. req, err := http.NewRequest("GET", urls, body)
  5444. if err != nil {
  5445. return nil, err
  5446. }
  5447. req.Header = reqHeaders
  5448. googleapi.Expand(req.URL, map[string]string{
  5449. "parent": c.parent,
  5450. })
  5451. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5452. }
  5453. // Do executes the "cloudiot.projects.locations.registries.groups.devices.list" call.
  5454. // Exactly one of *ListDevicesResponse or error will be non-nil. Any
  5455. // non-2xx status code is an error. Response headers are in either
  5456. // *ListDevicesResponse.ServerResponse.Header or (if a response was
  5457. // returned at all) in error.(*googleapi.Error).Header. Use
  5458. // googleapi.IsNotModified to check whether the returned error was
  5459. // because http.StatusNotModified was returned.
  5460. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Do(opts ...googleapi.CallOption) (*ListDevicesResponse, error) {
  5461. gensupport.SetOptions(c.urlParams_, opts...)
  5462. res, err := c.doRequest("json")
  5463. if res != nil && res.StatusCode == http.StatusNotModified {
  5464. if res.Body != nil {
  5465. res.Body.Close()
  5466. }
  5467. return nil, &googleapi.Error{
  5468. Code: res.StatusCode,
  5469. Header: res.Header,
  5470. }
  5471. }
  5472. if err != nil {
  5473. return nil, err
  5474. }
  5475. defer googleapi.CloseBody(res)
  5476. if err := googleapi.CheckResponse(res); err != nil {
  5477. return nil, err
  5478. }
  5479. ret := &ListDevicesResponse{
  5480. ServerResponse: googleapi.ServerResponse{
  5481. Header: res.Header,
  5482. HTTPStatusCode: res.StatusCode,
  5483. },
  5484. }
  5485. target := &ret
  5486. if err := gensupport.DecodeResponse(target, res); err != nil {
  5487. return nil, err
  5488. }
  5489. return ret, nil
  5490. // {
  5491. // "description": "List devices in a device registry.",
  5492. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}/devices",
  5493. // "httpMethod": "GET",
  5494. // "id": "cloudiot.projects.locations.registries.groups.devices.list",
  5495. // "parameterOrder": [
  5496. // "parent"
  5497. // ],
  5498. // "parameters": {
  5499. // "deviceIds": {
  5500. // "description": "A list of device string IDs. For example, `['device0', 'device12']`.\nIf empty, this field is ignored. Maximum IDs: 10,000",
  5501. // "location": "query",
  5502. // "repeated": true,
  5503. // "type": "string"
  5504. // },
  5505. // "deviceNumIds": {
  5506. // "description": "A list of device numeric IDs. If empty, this field is ignored. Maximum\nIDs: 10,000.",
  5507. // "format": "uint64",
  5508. // "location": "query",
  5509. // "repeated": true,
  5510. // "type": "string"
  5511. // },
  5512. // "fieldMask": {
  5513. // "description": "The fields of the `Device` resource to be returned in the response. The\nfields `id` and `num_id` are always returned, along with any\nother fields specified.",
  5514. // "format": "google-fieldmask",
  5515. // "location": "query",
  5516. // "type": "string"
  5517. // },
  5518. // "gatewayListOptions.associationsDeviceId": {
  5519. // "description": "If set, returns only the gateways with which the specified device is\nassociated. The device ID can be numeric (`num_id`) or the user-defined\nstring (`id`). For example, if `456` is specified, returns only the\ngateways to which the device with `num_id` 456 is bound.",
  5520. // "location": "query",
  5521. // "type": "string"
  5522. // },
  5523. // "gatewayListOptions.associationsGatewayId": {
  5524. // "description": "If set, only devices associated with the specified gateway are returned.\nThe gateway ID can be numeric (`num_id`) or the user-defined string\n(`id`). For example, if `123` is specified, only devices bound to the\ngateway with `num_id` 123 are returned.",
  5525. // "location": "query",
  5526. // "type": "string"
  5527. // },
  5528. // "gatewayListOptions.gatewayType": {
  5529. // "description": "If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`\nis specified, only non-gateway devices are returned. If\n`GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.",
  5530. // "enum": [
  5531. // "GATEWAY_TYPE_UNSPECIFIED",
  5532. // "GATEWAY",
  5533. // "NON_GATEWAY"
  5534. // ],
  5535. // "location": "query",
  5536. // "type": "string"
  5537. // },
  5538. // "pageSize": {
  5539. // "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. A non-empty `next_page_token` in the response\nindicates that more data is available.",
  5540. // "format": "int32",
  5541. // "location": "query",
  5542. // "type": "integer"
  5543. // },
  5544. // "pageToken": {
  5545. // "description": "The value returned by the last `ListDevicesResponse`; indicates\nthat this is a continuation of a prior `ListDevices` call and\nthe system should return the next page of data.",
  5546. // "location": "query",
  5547. // "type": "string"
  5548. // },
  5549. // "parent": {
  5550. // "description": "The device registry path. Required. For example,\n`projects/my-project/locations/us-central1/registries/my-registry`.",
  5551. // "location": "path",
  5552. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+$",
  5553. // "required": true,
  5554. // "type": "string"
  5555. // }
  5556. // },
  5557. // "path": "v1/{+parent}/devices",
  5558. // "response": {
  5559. // "$ref": "ListDevicesResponse"
  5560. // },
  5561. // "scopes": [
  5562. // "https://www.googleapis.com/auth/cloud-platform",
  5563. // "https://www.googleapis.com/auth/cloudiot"
  5564. // ]
  5565. // }
  5566. }
  5567. // Pages invokes f for each page of results.
  5568. // A non-nil error returned from f will halt the iteration.
  5569. // The provided context supersedes any context provided to the Context method.
  5570. func (c *ProjectsLocationsRegistriesGroupsDevicesListCall) Pages(ctx context.Context, f func(*ListDevicesResponse) error) error {
  5571. c.ctx_ = ctx
  5572. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5573. for {
  5574. x, err := c.Do()
  5575. if err != nil {
  5576. return err
  5577. }
  5578. if err := f(x); err != nil {
  5579. return err
  5580. }
  5581. if x.NextPageToken == "" {
  5582. return nil
  5583. }
  5584. c.PageToken(x.NextPageToken)
  5585. }
  5586. }
  5587. // method id "cloudiot.projects.locations.registries.groups.devices.modifyCloudToDeviceConfig":
  5588. type ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall struct {
  5589. s *Service
  5590. name string
  5591. modifycloudtodeviceconfigrequest *ModifyCloudToDeviceConfigRequest
  5592. urlParams_ gensupport.URLParams
  5593. ctx_ context.Context
  5594. header_ http.Header
  5595. }
  5596. // ModifyCloudToDeviceConfig: Modifies the configuration for the device,
  5597. // which is eventually sent from
  5598. // the Cloud IoT Core servers. Returns the modified configuration
  5599. // version and
  5600. // its metadata.
  5601. func (r *ProjectsLocationsRegistriesGroupsDevicesService) ModifyCloudToDeviceConfig(name string, modifycloudtodeviceconfigrequest *ModifyCloudToDeviceConfigRequest) *ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall {
  5602. c := &ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5603. c.name = name
  5604. c.modifycloudtodeviceconfigrequest = modifycloudtodeviceconfigrequest
  5605. return c
  5606. }
  5607. // Fields allows partial responses to be retrieved. See
  5608. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5609. // for more information.
  5610. func (c *ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall {
  5611. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5612. return c
  5613. }
  5614. // Context sets the context to be used in this call's Do method. Any
  5615. // pending HTTP request will be aborted if the provided context is
  5616. // canceled.
  5617. func (c *ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall {
  5618. c.ctx_ = ctx
  5619. return c
  5620. }
  5621. // Header returns an http.Header that can be modified by the caller to
  5622. // add HTTP headers to the request.
  5623. func (c *ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall) Header() http.Header {
  5624. if c.header_ == nil {
  5625. c.header_ = make(http.Header)
  5626. }
  5627. return c.header_
  5628. }
  5629. func (c *ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall) doRequest(alt string) (*http.Response, error) {
  5630. reqHeaders := make(http.Header)
  5631. for k, v := range c.header_ {
  5632. reqHeaders[k] = v
  5633. }
  5634. reqHeaders.Set("User-Agent", c.s.userAgent())
  5635. var body io.Reader = nil
  5636. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifycloudtodeviceconfigrequest)
  5637. if err != nil {
  5638. return nil, err
  5639. }
  5640. reqHeaders.Set("Content-Type", "application/json")
  5641. c.urlParams_.Set("alt", alt)
  5642. c.urlParams_.Set("prettyPrint", "false")
  5643. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:modifyCloudToDeviceConfig")
  5644. urls += "?" + c.urlParams_.Encode()
  5645. req, err := http.NewRequest("POST", urls, body)
  5646. if err != nil {
  5647. return nil, err
  5648. }
  5649. req.Header = reqHeaders
  5650. googleapi.Expand(req.URL, map[string]string{
  5651. "name": c.name,
  5652. })
  5653. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5654. }
  5655. // Do executes the "cloudiot.projects.locations.registries.groups.devices.modifyCloudToDeviceConfig" call.
  5656. // Exactly one of *DeviceConfig or error will be non-nil. Any non-2xx
  5657. // status code is an error. Response headers are in either
  5658. // *DeviceConfig.ServerResponse.Header or (if a response was returned at
  5659. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5660. // to check whether the returned error was because
  5661. // http.StatusNotModified was returned.
  5662. func (c *ProjectsLocationsRegistriesGroupsDevicesModifyCloudToDeviceConfigCall) Do(opts ...googleapi.CallOption) (*DeviceConfig, error) {
  5663. gensupport.SetOptions(c.urlParams_, opts...)
  5664. res, err := c.doRequest("json")
  5665. if res != nil && res.StatusCode == http.StatusNotModified {
  5666. if res.Body != nil {
  5667. res.Body.Close()
  5668. }
  5669. return nil, &googleapi.Error{
  5670. Code: res.StatusCode,
  5671. Header: res.Header,
  5672. }
  5673. }
  5674. if err != nil {
  5675. return nil, err
  5676. }
  5677. defer googleapi.CloseBody(res)
  5678. if err := googleapi.CheckResponse(res); err != nil {
  5679. return nil, err
  5680. }
  5681. ret := &DeviceConfig{
  5682. ServerResponse: googleapi.ServerResponse{
  5683. Header: res.Header,
  5684. HTTPStatusCode: res.StatusCode,
  5685. },
  5686. }
  5687. target := &ret
  5688. if err := gensupport.DecodeResponse(target, res); err != nil {
  5689. return nil, err
  5690. }
  5691. return ret, nil
  5692. // {
  5693. // "description": "Modifies the configuration for the device, which is eventually sent from\nthe Cloud IoT Core servers. Returns the modified configuration version and\nits metadata.",
  5694. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}/devices/{devicesId}:modifyCloudToDeviceConfig",
  5695. // "httpMethod": "POST",
  5696. // "id": "cloudiot.projects.locations.registries.groups.devices.modifyCloudToDeviceConfig",
  5697. // "parameterOrder": [
  5698. // "name"
  5699. // ],
  5700. // "parameters": {
  5701. // "name": {
  5702. // "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}`.",
  5703. // "location": "path",
  5704. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+/devices/[^/]+$",
  5705. // "required": true,
  5706. // "type": "string"
  5707. // }
  5708. // },
  5709. // "path": "v1/{+name}:modifyCloudToDeviceConfig",
  5710. // "request": {
  5711. // "$ref": "ModifyCloudToDeviceConfigRequest"
  5712. // },
  5713. // "response": {
  5714. // "$ref": "DeviceConfig"
  5715. // },
  5716. // "scopes": [
  5717. // "https://www.googleapis.com/auth/cloud-platform",
  5718. // "https://www.googleapis.com/auth/cloudiot"
  5719. // ]
  5720. // }
  5721. }
  5722. // method id "cloudiot.projects.locations.registries.groups.devices.patch":
  5723. type ProjectsLocationsRegistriesGroupsDevicesPatchCall struct {
  5724. s *Service
  5725. name string
  5726. device *Device
  5727. urlParams_ gensupport.URLParams
  5728. ctx_ context.Context
  5729. header_ http.Header
  5730. }
  5731. // Patch: Updates a device.
  5732. func (r *ProjectsLocationsRegistriesGroupsDevicesService) Patch(name string, device *Device) *ProjectsLocationsRegistriesGroupsDevicesPatchCall {
  5733. c := &ProjectsLocationsRegistriesGroupsDevicesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5734. c.name = name
  5735. c.device = device
  5736. return c
  5737. }
  5738. // UpdateMask sets the optional parameter "updateMask": Only updates the
  5739. // `device` fields indicated by this mask.
  5740. // The field mask must not be empty, and it must not contain fields
  5741. // that
  5742. // are immutable or only set by the server.
  5743. // Mutable top-level fields: `credentials`, `blocked`, and `metadata`
  5744. func (c *ProjectsLocationsRegistriesGroupsDevicesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsRegistriesGroupsDevicesPatchCall {
  5745. c.urlParams_.Set("updateMask", updateMask)
  5746. return c
  5747. }
  5748. // Fields allows partial responses to be retrieved. See
  5749. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5750. // for more information.
  5751. func (c *ProjectsLocationsRegistriesGroupsDevicesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsDevicesPatchCall {
  5752. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5753. return c
  5754. }
  5755. // Context sets the context to be used in this call's Do method. Any
  5756. // pending HTTP request will be aborted if the provided context is
  5757. // canceled.
  5758. func (c *ProjectsLocationsRegistriesGroupsDevicesPatchCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsDevicesPatchCall {
  5759. c.ctx_ = ctx
  5760. return c
  5761. }
  5762. // Header returns an http.Header that can be modified by the caller to
  5763. // add HTTP headers to the request.
  5764. func (c *ProjectsLocationsRegistriesGroupsDevicesPatchCall) Header() http.Header {
  5765. if c.header_ == nil {
  5766. c.header_ = make(http.Header)
  5767. }
  5768. return c.header_
  5769. }
  5770. func (c *ProjectsLocationsRegistriesGroupsDevicesPatchCall) doRequest(alt string) (*http.Response, error) {
  5771. reqHeaders := make(http.Header)
  5772. for k, v := range c.header_ {
  5773. reqHeaders[k] = v
  5774. }
  5775. reqHeaders.Set("User-Agent", c.s.userAgent())
  5776. var body io.Reader = nil
  5777. body, err := googleapi.WithoutDataWrapper.JSONReader(c.device)
  5778. if err != nil {
  5779. return nil, err
  5780. }
  5781. reqHeaders.Set("Content-Type", "application/json")
  5782. c.urlParams_.Set("alt", alt)
  5783. c.urlParams_.Set("prettyPrint", "false")
  5784. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5785. urls += "?" + c.urlParams_.Encode()
  5786. req, err := http.NewRequest("PATCH", urls, body)
  5787. if err != nil {
  5788. return nil, err
  5789. }
  5790. req.Header = reqHeaders
  5791. googleapi.Expand(req.URL, map[string]string{
  5792. "name": c.name,
  5793. })
  5794. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5795. }
  5796. // Do executes the "cloudiot.projects.locations.registries.groups.devices.patch" call.
  5797. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  5798. // code is an error. Response headers are in either
  5799. // *Device.ServerResponse.Header or (if a response was returned at all)
  5800. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5801. // check whether the returned error was because http.StatusNotModified
  5802. // was returned.
  5803. func (c *ProjectsLocationsRegistriesGroupsDevicesPatchCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  5804. gensupport.SetOptions(c.urlParams_, opts...)
  5805. res, err := c.doRequest("json")
  5806. if res != nil && res.StatusCode == http.StatusNotModified {
  5807. if res.Body != nil {
  5808. res.Body.Close()
  5809. }
  5810. return nil, &googleapi.Error{
  5811. Code: res.StatusCode,
  5812. Header: res.Header,
  5813. }
  5814. }
  5815. if err != nil {
  5816. return nil, err
  5817. }
  5818. defer googleapi.CloseBody(res)
  5819. if err := googleapi.CheckResponse(res); err != nil {
  5820. return nil, err
  5821. }
  5822. ret := &Device{
  5823. ServerResponse: googleapi.ServerResponse{
  5824. Header: res.Header,
  5825. HTTPStatusCode: res.StatusCode,
  5826. },
  5827. }
  5828. target := &ret
  5829. if err := gensupport.DecodeResponse(target, res); err != nil {
  5830. return nil, err
  5831. }
  5832. return ret, nil
  5833. // {
  5834. // "description": "Updates a device.",
  5835. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}/devices/{devicesId}",
  5836. // "httpMethod": "PATCH",
  5837. // "id": "cloudiot.projects.locations.registries.groups.devices.patch",
  5838. // "parameterOrder": [
  5839. // "name"
  5840. // ],
  5841. // "parameters": {
  5842. // "name": {
  5843. // "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.",
  5844. // "location": "path",
  5845. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+/devices/[^/]+$",
  5846. // "required": true,
  5847. // "type": "string"
  5848. // },
  5849. // "updateMask": {
  5850. // "description": "Only updates the `device` fields indicated by this mask.\nThe field mask must not be empty, and it must not contain fields that\nare immutable or only set by the server.\nMutable top-level fields: `credentials`, `blocked`, and `metadata`",
  5851. // "format": "google-fieldmask",
  5852. // "location": "query",
  5853. // "type": "string"
  5854. // }
  5855. // },
  5856. // "path": "v1/{+name}",
  5857. // "request": {
  5858. // "$ref": "Device"
  5859. // },
  5860. // "response": {
  5861. // "$ref": "Device"
  5862. // },
  5863. // "scopes": [
  5864. // "https://www.googleapis.com/auth/cloud-platform",
  5865. // "https://www.googleapis.com/auth/cloudiot"
  5866. // ]
  5867. // }
  5868. }
  5869. // method id "cloudiot.projects.locations.registries.groups.devices.sendCommandToDevice":
  5870. type ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall struct {
  5871. s *Service
  5872. name string
  5873. sendcommandtodevicerequest *SendCommandToDeviceRequest
  5874. urlParams_ gensupport.URLParams
  5875. ctx_ context.Context
  5876. header_ http.Header
  5877. }
  5878. // SendCommandToDevice: Sends a command to the specified device. In
  5879. // order for a device to be able
  5880. // to receive commands, it must:
  5881. // 1) be connected to Cloud IoT Core using the MQTT protocol, and
  5882. // 2) be subscribed to the group of MQTT topics specified by
  5883. // /devices/{device-id}/commands/#. This subscription will receive
  5884. // commands
  5885. // at the top-level topic /devices/{device-id}/commands as well as
  5886. // commands
  5887. // for subfolders, like /devices/{device-id}/commands/subfolder.
  5888. // Note that subscribing to specific subfolders is not supported.
  5889. // If the command could not be delivered to the device, this method
  5890. // will
  5891. // return an error; in particular, if the device is not subscribed,
  5892. // this
  5893. // method will return FAILED_PRECONDITION. Otherwise, this method
  5894. // will
  5895. // return OK. If the subscription is QoS 1, at least once delivery will
  5896. // be
  5897. // guaranteed; for QoS 0, no acknowledgment will be expected from the
  5898. // device.
  5899. func (r *ProjectsLocationsRegistriesGroupsDevicesService) SendCommandToDevice(name string, sendcommandtodevicerequest *SendCommandToDeviceRequest) *ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall {
  5900. c := &ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5901. c.name = name
  5902. c.sendcommandtodevicerequest = sendcommandtodevicerequest
  5903. return c
  5904. }
  5905. // Fields allows partial responses to be retrieved. See
  5906. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5907. // for more information.
  5908. func (c *ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall {
  5909. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5910. return c
  5911. }
  5912. // Context sets the context to be used in this call's Do method. Any
  5913. // pending HTTP request will be aborted if the provided context is
  5914. // canceled.
  5915. func (c *ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall {
  5916. c.ctx_ = ctx
  5917. return c
  5918. }
  5919. // Header returns an http.Header that can be modified by the caller to
  5920. // add HTTP headers to the request.
  5921. func (c *ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall) Header() http.Header {
  5922. if c.header_ == nil {
  5923. c.header_ = make(http.Header)
  5924. }
  5925. return c.header_
  5926. }
  5927. func (c *ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall) doRequest(alt string) (*http.Response, error) {
  5928. reqHeaders := make(http.Header)
  5929. for k, v := range c.header_ {
  5930. reqHeaders[k] = v
  5931. }
  5932. reqHeaders.Set("User-Agent", c.s.userAgent())
  5933. var body io.Reader = nil
  5934. body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendcommandtodevicerequest)
  5935. if err != nil {
  5936. return nil, err
  5937. }
  5938. reqHeaders.Set("Content-Type", "application/json")
  5939. c.urlParams_.Set("alt", alt)
  5940. c.urlParams_.Set("prettyPrint", "false")
  5941. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:sendCommandToDevice")
  5942. urls += "?" + c.urlParams_.Encode()
  5943. req, err := http.NewRequest("POST", urls, body)
  5944. if err != nil {
  5945. return nil, err
  5946. }
  5947. req.Header = reqHeaders
  5948. googleapi.Expand(req.URL, map[string]string{
  5949. "name": c.name,
  5950. })
  5951. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5952. }
  5953. // Do executes the "cloudiot.projects.locations.registries.groups.devices.sendCommandToDevice" call.
  5954. // Exactly one of *SendCommandToDeviceResponse or error will be non-nil.
  5955. // Any non-2xx status code is an error. Response headers are in either
  5956. // *SendCommandToDeviceResponse.ServerResponse.Header or (if a response
  5957. // was returned at all) in error.(*googleapi.Error).Header. Use
  5958. // googleapi.IsNotModified to check whether the returned error was
  5959. // because http.StatusNotModified was returned.
  5960. func (c *ProjectsLocationsRegistriesGroupsDevicesSendCommandToDeviceCall) Do(opts ...googleapi.CallOption) (*SendCommandToDeviceResponse, error) {
  5961. gensupport.SetOptions(c.urlParams_, opts...)
  5962. res, err := c.doRequest("json")
  5963. if res != nil && res.StatusCode == http.StatusNotModified {
  5964. if res.Body != nil {
  5965. res.Body.Close()
  5966. }
  5967. return nil, &googleapi.Error{
  5968. Code: res.StatusCode,
  5969. Header: res.Header,
  5970. }
  5971. }
  5972. if err != nil {
  5973. return nil, err
  5974. }
  5975. defer googleapi.CloseBody(res)
  5976. if err := googleapi.CheckResponse(res); err != nil {
  5977. return nil, err
  5978. }
  5979. ret := &SendCommandToDeviceResponse{
  5980. ServerResponse: googleapi.ServerResponse{
  5981. Header: res.Header,
  5982. HTTPStatusCode: res.StatusCode,
  5983. },
  5984. }
  5985. target := &ret
  5986. if err := gensupport.DecodeResponse(target, res); err != nil {
  5987. return nil, err
  5988. }
  5989. return ret, nil
  5990. // {
  5991. // "description": "Sends a command to the specified device. In order for a device to be able\nto receive commands, it must:\n1) be connected to Cloud IoT Core using the MQTT protocol, and\n2) be subscribed to the group of MQTT topics specified by\n /devices/{device-id}/commands/#. This subscription will receive commands\n at the top-level topic /devices/{device-id}/commands as well as commands\n for subfolders, like /devices/{device-id}/commands/subfolder.\n Note that subscribing to specific subfolders is not supported.\nIf the command could not be delivered to the device, this method will\nreturn an error; in particular, if the device is not subscribed, this\nmethod will return FAILED_PRECONDITION. Otherwise, this method will\nreturn OK. If the subscription is QoS 1, at least once delivery will be\nguaranteed; for QoS 0, no acknowledgment will be expected from the device.",
  5992. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}/devices/{devicesId}:sendCommandToDevice",
  5993. // "httpMethod": "POST",
  5994. // "id": "cloudiot.projects.locations.registries.groups.devices.sendCommandToDevice",
  5995. // "parameterOrder": [
  5996. // "name"
  5997. // ],
  5998. // "parameters": {
  5999. // "name": {
  6000. // "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}`.",
  6001. // "location": "path",
  6002. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+/devices/[^/]+$",
  6003. // "required": true,
  6004. // "type": "string"
  6005. // }
  6006. // },
  6007. // "path": "v1/{+name}:sendCommandToDevice",
  6008. // "request": {
  6009. // "$ref": "SendCommandToDeviceRequest"
  6010. // },
  6011. // "response": {
  6012. // "$ref": "SendCommandToDeviceResponse"
  6013. // },
  6014. // "scopes": [
  6015. // "https://www.googleapis.com/auth/cloud-platform",
  6016. // "https://www.googleapis.com/auth/cloudiot"
  6017. // ]
  6018. // }
  6019. }
  6020. // method id "cloudiot.projects.locations.registries.groups.devices.configVersions.list":
  6021. type ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall struct {
  6022. s *Service
  6023. name string
  6024. urlParams_ gensupport.URLParams
  6025. ifNoneMatch_ string
  6026. ctx_ context.Context
  6027. header_ http.Header
  6028. }
  6029. // List: Lists the last few versions of the device configuration in
  6030. // descending
  6031. // order (i.e.: newest first).
  6032. func (r *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsService) List(name string) *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall {
  6033. c := &ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6034. c.name = name
  6035. return c
  6036. }
  6037. // NumVersions sets the optional parameter "numVersions": The number of
  6038. // versions to list. Versions are listed in decreasing order of
  6039. // the version number. The maximum number of versions retained is 10. If
  6040. // this
  6041. // value is zero, it will return all the versions available.
  6042. func (c *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall) NumVersions(numVersions int64) *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall {
  6043. c.urlParams_.Set("numVersions", fmt.Sprint(numVersions))
  6044. return c
  6045. }
  6046. // Fields allows partial responses to be retrieved. See
  6047. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6048. // for more information.
  6049. func (c *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall {
  6050. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6051. return c
  6052. }
  6053. // IfNoneMatch sets the optional parameter which makes the operation
  6054. // fail if the object's ETag matches the given value. This is useful for
  6055. // getting updates only after the object has changed since the last
  6056. // request. Use googleapi.IsNotModified to check whether the response
  6057. // error from Do is the result of In-None-Match.
  6058. func (c *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall {
  6059. c.ifNoneMatch_ = entityTag
  6060. return c
  6061. }
  6062. // Context sets the context to be used in this call's Do method. Any
  6063. // pending HTTP request will be aborted if the provided context is
  6064. // canceled.
  6065. func (c *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall {
  6066. c.ctx_ = ctx
  6067. return c
  6068. }
  6069. // Header returns an http.Header that can be modified by the caller to
  6070. // add HTTP headers to the request.
  6071. func (c *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall) Header() http.Header {
  6072. if c.header_ == nil {
  6073. c.header_ = make(http.Header)
  6074. }
  6075. return c.header_
  6076. }
  6077. func (c *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall) doRequest(alt string) (*http.Response, error) {
  6078. reqHeaders := make(http.Header)
  6079. for k, v := range c.header_ {
  6080. reqHeaders[k] = v
  6081. }
  6082. reqHeaders.Set("User-Agent", c.s.userAgent())
  6083. if c.ifNoneMatch_ != "" {
  6084. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6085. }
  6086. var body io.Reader = nil
  6087. c.urlParams_.Set("alt", alt)
  6088. c.urlParams_.Set("prettyPrint", "false")
  6089. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/configVersions")
  6090. urls += "?" + c.urlParams_.Encode()
  6091. req, err := http.NewRequest("GET", urls, body)
  6092. if err != nil {
  6093. return nil, err
  6094. }
  6095. req.Header = reqHeaders
  6096. googleapi.Expand(req.URL, map[string]string{
  6097. "name": c.name,
  6098. })
  6099. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6100. }
  6101. // Do executes the "cloudiot.projects.locations.registries.groups.devices.configVersions.list" call.
  6102. // Exactly one of *ListDeviceConfigVersionsResponse or error will be
  6103. // non-nil. Any non-2xx status code is an error. Response headers are in
  6104. // either *ListDeviceConfigVersionsResponse.ServerResponse.Header or (if
  6105. // a response was returned at all) in error.(*googleapi.Error).Header.
  6106. // Use googleapi.IsNotModified to check whether the returned error was
  6107. // because http.StatusNotModified was returned.
  6108. func (c *ProjectsLocationsRegistriesGroupsDevicesConfigVersionsListCall) Do(opts ...googleapi.CallOption) (*ListDeviceConfigVersionsResponse, error) {
  6109. gensupport.SetOptions(c.urlParams_, opts...)
  6110. res, err := c.doRequest("json")
  6111. if res != nil && res.StatusCode == http.StatusNotModified {
  6112. if res.Body != nil {
  6113. res.Body.Close()
  6114. }
  6115. return nil, &googleapi.Error{
  6116. Code: res.StatusCode,
  6117. Header: res.Header,
  6118. }
  6119. }
  6120. if err != nil {
  6121. return nil, err
  6122. }
  6123. defer googleapi.CloseBody(res)
  6124. if err := googleapi.CheckResponse(res); err != nil {
  6125. return nil, err
  6126. }
  6127. ret := &ListDeviceConfigVersionsResponse{
  6128. ServerResponse: googleapi.ServerResponse{
  6129. Header: res.Header,
  6130. HTTPStatusCode: res.StatusCode,
  6131. },
  6132. }
  6133. target := &ret
  6134. if err := gensupport.DecodeResponse(target, res); err != nil {
  6135. return nil, err
  6136. }
  6137. return ret, nil
  6138. // {
  6139. // "description": "Lists the last few versions of the device configuration in descending\norder (i.e.: newest first).",
  6140. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}/devices/{devicesId}/configVersions",
  6141. // "httpMethod": "GET",
  6142. // "id": "cloudiot.projects.locations.registries.groups.devices.configVersions.list",
  6143. // "parameterOrder": [
  6144. // "name"
  6145. // ],
  6146. // "parameters": {
  6147. // "name": {
  6148. // "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}`.",
  6149. // "location": "path",
  6150. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+/devices/[^/]+$",
  6151. // "required": true,
  6152. // "type": "string"
  6153. // },
  6154. // "numVersions": {
  6155. // "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.",
  6156. // "format": "int32",
  6157. // "location": "query",
  6158. // "type": "integer"
  6159. // }
  6160. // },
  6161. // "path": "v1/{+name}/configVersions",
  6162. // "response": {
  6163. // "$ref": "ListDeviceConfigVersionsResponse"
  6164. // },
  6165. // "scopes": [
  6166. // "https://www.googleapis.com/auth/cloud-platform",
  6167. // "https://www.googleapis.com/auth/cloudiot"
  6168. // ]
  6169. // }
  6170. }
  6171. // method id "cloudiot.projects.locations.registries.groups.devices.states.list":
  6172. type ProjectsLocationsRegistriesGroupsDevicesStatesListCall struct {
  6173. s *Service
  6174. name string
  6175. urlParams_ gensupport.URLParams
  6176. ifNoneMatch_ string
  6177. ctx_ context.Context
  6178. header_ http.Header
  6179. }
  6180. // List: Lists the last few versions of the device state in descending
  6181. // order (i.e.:
  6182. // newest first).
  6183. func (r *ProjectsLocationsRegistriesGroupsDevicesStatesService) List(name string) *ProjectsLocationsRegistriesGroupsDevicesStatesListCall {
  6184. c := &ProjectsLocationsRegistriesGroupsDevicesStatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6185. c.name = name
  6186. return c
  6187. }
  6188. // NumStates sets the optional parameter "numStates": The number of
  6189. // states to list. States are listed in descending order of
  6190. // update time. The maximum number of states retained is 10. If
  6191. // this
  6192. // value is zero, it will return all the states available.
  6193. func (c *ProjectsLocationsRegistriesGroupsDevicesStatesListCall) NumStates(numStates int64) *ProjectsLocationsRegistriesGroupsDevicesStatesListCall {
  6194. c.urlParams_.Set("numStates", fmt.Sprint(numStates))
  6195. return c
  6196. }
  6197. // Fields allows partial responses to be retrieved. See
  6198. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6199. // for more information.
  6200. func (c *ProjectsLocationsRegistriesGroupsDevicesStatesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsRegistriesGroupsDevicesStatesListCall {
  6201. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6202. return c
  6203. }
  6204. // IfNoneMatch sets the optional parameter which makes the operation
  6205. // fail if the object's ETag matches the given value. This is useful for
  6206. // getting updates only after the object has changed since the last
  6207. // request. Use googleapi.IsNotModified to check whether the response
  6208. // error from Do is the result of In-None-Match.
  6209. func (c *ProjectsLocationsRegistriesGroupsDevicesStatesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsRegistriesGroupsDevicesStatesListCall {
  6210. c.ifNoneMatch_ = entityTag
  6211. return c
  6212. }
  6213. // Context sets the context to be used in this call's Do method. Any
  6214. // pending HTTP request will be aborted if the provided context is
  6215. // canceled.
  6216. func (c *ProjectsLocationsRegistriesGroupsDevicesStatesListCall) Context(ctx context.Context) *ProjectsLocationsRegistriesGroupsDevicesStatesListCall {
  6217. c.ctx_ = ctx
  6218. return c
  6219. }
  6220. // Header returns an http.Header that can be modified by the caller to
  6221. // add HTTP headers to the request.
  6222. func (c *ProjectsLocationsRegistriesGroupsDevicesStatesListCall) Header() http.Header {
  6223. if c.header_ == nil {
  6224. c.header_ = make(http.Header)
  6225. }
  6226. return c.header_
  6227. }
  6228. func (c *ProjectsLocationsRegistriesGroupsDevicesStatesListCall) doRequest(alt string) (*http.Response, error) {
  6229. reqHeaders := make(http.Header)
  6230. for k, v := range c.header_ {
  6231. reqHeaders[k] = v
  6232. }
  6233. reqHeaders.Set("User-Agent", c.s.userAgent())
  6234. if c.ifNoneMatch_ != "" {
  6235. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6236. }
  6237. var body io.Reader = nil
  6238. c.urlParams_.Set("alt", alt)
  6239. c.urlParams_.Set("prettyPrint", "false")
  6240. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/states")
  6241. urls += "?" + c.urlParams_.Encode()
  6242. req, err := http.NewRequest("GET", urls, body)
  6243. if err != nil {
  6244. return nil, err
  6245. }
  6246. req.Header = reqHeaders
  6247. googleapi.Expand(req.URL, map[string]string{
  6248. "name": c.name,
  6249. })
  6250. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6251. }
  6252. // Do executes the "cloudiot.projects.locations.registries.groups.devices.states.list" call.
  6253. // Exactly one of *ListDeviceStatesResponse or error will be non-nil.
  6254. // Any non-2xx status code is an error. Response headers are in either
  6255. // *ListDeviceStatesResponse.ServerResponse.Header or (if a response was
  6256. // returned at all) in error.(*googleapi.Error).Header. Use
  6257. // googleapi.IsNotModified to check whether the returned error was
  6258. // because http.StatusNotModified was returned.
  6259. func (c *ProjectsLocationsRegistriesGroupsDevicesStatesListCall) Do(opts ...googleapi.CallOption) (*ListDeviceStatesResponse, error) {
  6260. gensupport.SetOptions(c.urlParams_, opts...)
  6261. res, err := c.doRequest("json")
  6262. if res != nil && res.StatusCode == http.StatusNotModified {
  6263. if res.Body != nil {
  6264. res.Body.Close()
  6265. }
  6266. return nil, &googleapi.Error{
  6267. Code: res.StatusCode,
  6268. Header: res.Header,
  6269. }
  6270. }
  6271. if err != nil {
  6272. return nil, err
  6273. }
  6274. defer googleapi.CloseBody(res)
  6275. if err := googleapi.CheckResponse(res); err != nil {
  6276. return nil, err
  6277. }
  6278. ret := &ListDeviceStatesResponse{
  6279. ServerResponse: googleapi.ServerResponse{
  6280. Header: res.Header,
  6281. HTTPStatusCode: res.StatusCode,
  6282. },
  6283. }
  6284. target := &ret
  6285. if err := gensupport.DecodeResponse(target, res); err != nil {
  6286. return nil, err
  6287. }
  6288. return ret, nil
  6289. // {
  6290. // "description": "Lists the last few versions of the device state in descending order (i.e.:\nnewest first).",
  6291. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/registries/{registriesId}/groups/{groupsId}/devices/{devicesId}/states",
  6292. // "httpMethod": "GET",
  6293. // "id": "cloudiot.projects.locations.registries.groups.devices.states.list",
  6294. // "parameterOrder": [
  6295. // "name"
  6296. // ],
  6297. // "parameters": {
  6298. // "name": {
  6299. // "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}`.",
  6300. // "location": "path",
  6301. // "pattern": "^projects/[^/]+/locations/[^/]+/registries/[^/]+/groups/[^/]+/devices/[^/]+$",
  6302. // "required": true,
  6303. // "type": "string"
  6304. // },
  6305. // "numStates": {
  6306. // "description": "The number of states to list. States are listed in descending order of\nupdate time. The maximum number of states retained is 10. If this\nvalue is zero, it will return all the states available.",
  6307. // "format": "int32",
  6308. // "location": "query",
  6309. // "type": "integer"
  6310. // }
  6311. // },
  6312. // "path": "v1/{+name}/states",
  6313. // "response": {
  6314. // "$ref": "ListDeviceStatesResponse"
  6315. // },
  6316. // "scopes": [
  6317. // "https://www.googleapis.com/auth/cloud-platform",
  6318. // "https://www.googleapis.com/auth/cloudiot"
  6319. // ]
  6320. // }
  6321. }