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.
 
 
 

5981 line
208 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 androiddeviceprovisioning provides access to the Android Device Provisioning Partner API.
  6. //
  7. // For product documentation, see: https://developers.google.com/zero-touch/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/androiddeviceprovisioning/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // androiddeviceprovisioningService, err := androiddeviceprovisioning.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. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // androiddeviceprovisioningService, err := androiddeviceprovisioning.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // androiddeviceprovisioningService, err := androiddeviceprovisioning.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package androiddeviceprovisioning // import "google.golang.org/api/androiddeviceprovisioning/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "androiddeviceprovisioning:v1"
  67. const apiName = "androiddeviceprovisioning"
  68. const apiVersion = "v1"
  69. const basePath = "https://androiddeviceprovisioning.googleapis.com/"
  70. // NewService creates a new Service.
  71. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  72. client, endpoint, err := htransport.NewClient(ctx, opts...)
  73. if err != nil {
  74. return nil, err
  75. }
  76. s, err := New(client)
  77. if err != nil {
  78. return nil, err
  79. }
  80. if endpoint != "" {
  81. s.BasePath = endpoint
  82. }
  83. return s, nil
  84. }
  85. // New creates a new Service. It uses the provided http.Client for requests.
  86. //
  87. // Deprecated: please use NewService instead.
  88. // To provide a custom HTTP client, use option.WithHTTPClient.
  89. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  90. func New(client *http.Client) (*Service, error) {
  91. if client == nil {
  92. return nil, errors.New("client is nil")
  93. }
  94. s := &Service{client: client, BasePath: basePath}
  95. s.Customers = NewCustomersService(s)
  96. s.Operations = NewOperationsService(s)
  97. s.Partners = NewPartnersService(s)
  98. return s, nil
  99. }
  100. type Service struct {
  101. client *http.Client
  102. BasePath string // API endpoint base URL
  103. UserAgent string // optional additional User-Agent fragment
  104. Customers *CustomersService
  105. Operations *OperationsService
  106. Partners *PartnersService
  107. }
  108. func (s *Service) userAgent() string {
  109. if s.UserAgent == "" {
  110. return googleapi.UserAgent
  111. }
  112. return googleapi.UserAgent + " " + s.UserAgent
  113. }
  114. func NewCustomersService(s *Service) *CustomersService {
  115. rs := &CustomersService{s: s}
  116. rs.Configurations = NewCustomersConfigurationsService(s)
  117. rs.Devices = NewCustomersDevicesService(s)
  118. rs.Dpcs = NewCustomersDpcsService(s)
  119. return rs
  120. }
  121. type CustomersService struct {
  122. s *Service
  123. Configurations *CustomersConfigurationsService
  124. Devices *CustomersDevicesService
  125. Dpcs *CustomersDpcsService
  126. }
  127. func NewCustomersConfigurationsService(s *Service) *CustomersConfigurationsService {
  128. rs := &CustomersConfigurationsService{s: s}
  129. return rs
  130. }
  131. type CustomersConfigurationsService struct {
  132. s *Service
  133. }
  134. func NewCustomersDevicesService(s *Service) *CustomersDevicesService {
  135. rs := &CustomersDevicesService{s: s}
  136. return rs
  137. }
  138. type CustomersDevicesService struct {
  139. s *Service
  140. }
  141. func NewCustomersDpcsService(s *Service) *CustomersDpcsService {
  142. rs := &CustomersDpcsService{s: s}
  143. return rs
  144. }
  145. type CustomersDpcsService struct {
  146. s *Service
  147. }
  148. func NewOperationsService(s *Service) *OperationsService {
  149. rs := &OperationsService{s: s}
  150. return rs
  151. }
  152. type OperationsService struct {
  153. s *Service
  154. }
  155. func NewPartnersService(s *Service) *PartnersService {
  156. rs := &PartnersService{s: s}
  157. rs.Customers = NewPartnersCustomersService(s)
  158. rs.Devices = NewPartnersDevicesService(s)
  159. rs.Vendors = NewPartnersVendorsService(s)
  160. return rs
  161. }
  162. type PartnersService struct {
  163. s *Service
  164. Customers *PartnersCustomersService
  165. Devices *PartnersDevicesService
  166. Vendors *PartnersVendorsService
  167. }
  168. func NewPartnersCustomersService(s *Service) *PartnersCustomersService {
  169. rs := &PartnersCustomersService{s: s}
  170. return rs
  171. }
  172. type PartnersCustomersService struct {
  173. s *Service
  174. }
  175. func NewPartnersDevicesService(s *Service) *PartnersDevicesService {
  176. rs := &PartnersDevicesService{s: s}
  177. return rs
  178. }
  179. type PartnersDevicesService struct {
  180. s *Service
  181. }
  182. func NewPartnersVendorsService(s *Service) *PartnersVendorsService {
  183. rs := &PartnersVendorsService{s: s}
  184. rs.Customers = NewPartnersVendorsCustomersService(s)
  185. return rs
  186. }
  187. type PartnersVendorsService struct {
  188. s *Service
  189. Customers *PartnersVendorsCustomersService
  190. }
  191. func NewPartnersVendorsCustomersService(s *Service) *PartnersVendorsCustomersService {
  192. rs := &PartnersVendorsCustomersService{s: s}
  193. return rs
  194. }
  195. type PartnersVendorsCustomersService struct {
  196. s *Service
  197. }
  198. // ClaimDeviceRequest: Request message to claim a device on behalf of a
  199. // customer.
  200. type ClaimDeviceRequest struct {
  201. // CustomerId: Required. The ID of the customer for whom the device is
  202. // being claimed.
  203. CustomerId int64 `json:"customerId,omitempty,string"`
  204. // DeviceIdentifier: Required. The device identifier of the device to
  205. // claim.
  206. DeviceIdentifier *DeviceIdentifier `json:"deviceIdentifier,omitempty"`
  207. // DeviceMetadata: Optional. The metadata to attach to the device.
  208. DeviceMetadata *DeviceMetadata `json:"deviceMetadata,omitempty"`
  209. // SectionType: Required. The section type of the device's provisioning
  210. // record.
  211. //
  212. // Possible values:
  213. // "SECTION_TYPE_UNSPECIFIED" - Unspecified section type.
  214. // "SECTION_TYPE_SIM_LOCK" - SIM-lock section type.
  215. // "SECTION_TYPE_ZERO_TOUCH" - Zero-touch enrollment section type.
  216. SectionType string `json:"sectionType,omitempty"`
  217. // ForceSendFields is a list of field names (e.g. "CustomerId") to
  218. // unconditionally include in API requests. By default, fields with
  219. // empty values are omitted from API requests. However, any non-pointer,
  220. // non-interface field appearing in ForceSendFields will be sent to the
  221. // server regardless of whether the field is empty or not. This may be
  222. // used to include empty fields in Patch requests.
  223. ForceSendFields []string `json:"-"`
  224. // NullFields is a list of field names (e.g. "CustomerId") to include in
  225. // API requests with the JSON null value. By default, fields with empty
  226. // values are omitted from API requests. However, any field with an
  227. // empty value appearing in NullFields will be sent to the server as
  228. // null. It is an error if a field in this list has a non-empty value.
  229. // This may be used to include null fields in Patch requests.
  230. NullFields []string `json:"-"`
  231. }
  232. func (s *ClaimDeviceRequest) MarshalJSON() ([]byte, error) {
  233. type NoMethod ClaimDeviceRequest
  234. raw := NoMethod(*s)
  235. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  236. }
  237. // ClaimDeviceResponse: Response message containing device id of the
  238. // claim.
  239. type ClaimDeviceResponse struct {
  240. // DeviceId: The device ID of the claimed device.
  241. DeviceId int64 `json:"deviceId,omitempty,string"`
  242. // DeviceName: The resource name of the device in the
  243. // format
  244. // `partners/[PARTNER_ID]/devices/[DEVICE_ID]`.
  245. DeviceName string `json:"deviceName,omitempty"`
  246. // ServerResponse contains the HTTP response code and headers from the
  247. // server.
  248. googleapi.ServerResponse `json:"-"`
  249. // ForceSendFields is a list of field names (e.g. "DeviceId") to
  250. // unconditionally include in API requests. By default, fields with
  251. // empty values are omitted from API requests. However, any non-pointer,
  252. // non-interface field appearing in ForceSendFields will be sent to the
  253. // server regardless of whether the field is empty or not. This may be
  254. // used to include empty fields in Patch requests.
  255. ForceSendFields []string `json:"-"`
  256. // NullFields is a list of field names (e.g. "DeviceId") to include in
  257. // API requests with the JSON null value. By default, fields with empty
  258. // values are omitted from API requests. However, any field with an
  259. // empty value appearing in NullFields will be sent to the server as
  260. // null. It is an error if a field in this list has a non-empty value.
  261. // This may be used to include null fields in Patch requests.
  262. NullFields []string `json:"-"`
  263. }
  264. func (s *ClaimDeviceResponse) MarshalJSON() ([]byte, error) {
  265. type NoMethod ClaimDeviceResponse
  266. raw := NoMethod(*s)
  267. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  268. }
  269. // ClaimDevicesRequest: Request to claim devices asynchronously in
  270. // batch. Claiming a device adds the
  271. // device to zero-touch enrollment and shows the device in the
  272. // customer's view
  273. // of the portal.
  274. type ClaimDevicesRequest struct {
  275. // Claims: Required. A list of device claims.
  276. Claims []*PartnerClaim `json:"claims,omitempty"`
  277. // ForceSendFields is a list of field names (e.g. "Claims") to
  278. // unconditionally include in API requests. By default, fields with
  279. // empty values are omitted from API requests. However, any non-pointer,
  280. // non-interface field appearing in ForceSendFields will be sent to the
  281. // server regardless of whether the field is empty or not. This may be
  282. // used to include empty fields in Patch requests.
  283. ForceSendFields []string `json:"-"`
  284. // NullFields is a list of field names (e.g. "Claims") to include in API
  285. // requests with the JSON null value. By default, fields with empty
  286. // values are omitted from API requests. However, any field with an
  287. // empty value appearing in NullFields will be sent to the server as
  288. // null. It is an error if a field in this list has a non-empty value.
  289. // This may be used to include null fields in Patch requests.
  290. NullFields []string `json:"-"`
  291. }
  292. func (s *ClaimDevicesRequest) MarshalJSON() ([]byte, error) {
  293. type NoMethod ClaimDevicesRequest
  294. raw := NoMethod(*s)
  295. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  296. }
  297. // Company: A reseller, vendor, or customer in the zero-touch reseller
  298. // and customer APIs.
  299. type Company struct {
  300. // AdminEmails: Input only. Optional. Email address of customer's users
  301. // in the admin role.
  302. // Each email address must be associated with a Google Account.
  303. AdminEmails []string `json:"adminEmails,omitempty"`
  304. // CompanyId: Output only. The ID of the company. Assigned by the
  305. // server.
  306. CompanyId int64 `json:"companyId,omitempty,string"`
  307. // CompanyName: Required. The name of the company. For example _XYZ
  308. // Corp_. Displayed to the
  309. // company's employees in the zero-touch enrollment portal.
  310. CompanyName string `json:"companyName,omitempty"`
  311. // Name: Output only. The API resource name of the company. The resource
  312. // name is one
  313. // of the following formats:
  314. //
  315. // * `partners/[PARTNER_ID]/customers/[CUSTOMER_ID]`
  316. // * `partners/[PARTNER_ID]/vendors/[VENDOR_ID]`
  317. // *
  318. // `partners/[PARTNER_ID]/vendors/[VENDOR_ID]/customers/[CUSTOMER_ID]`
  319. //
  320. // A
  321. // ssigned by the server.
  322. Name string `json:"name,omitempty"`
  323. // OwnerEmails: Input only. Email address of customer's users in the
  324. // owner role. At least
  325. // one `owner_email` is required. Each email address must be associated
  326. // with a
  327. // Google Account. Owners share the same access as admins but can also
  328. // add,
  329. // delete, and edit your organization's portal users.
  330. OwnerEmails []string `json:"ownerEmails,omitempty"`
  331. // TermsStatus: Output only. Whether any user from the company has
  332. // accepted the latest
  333. // Terms of Service (ToS). See
  334. // TermsStatus.
  335. //
  336. // Possible values:
  337. // "TERMS_STATUS_UNSPECIFIED" - Default value. This value should never
  338. // be set if the enum is present.
  339. // "TERMS_STATUS_NOT_ACCEPTED" - None of the company's users have
  340. // accepted the ToS.
  341. // "TERMS_STATUS_ACCEPTED" - One (or more) of the company's users has
  342. // accepted the ToS.
  343. // "TERMS_STATUS_STALE" - None of the company's users has accepted the
  344. // current ToS but at least one
  345. // user accepted a previous ToS.
  346. TermsStatus string `json:"termsStatus,omitempty"`
  347. // ServerResponse contains the HTTP response code and headers from the
  348. // server.
  349. googleapi.ServerResponse `json:"-"`
  350. // ForceSendFields is a list of field names (e.g. "AdminEmails") to
  351. // unconditionally include in API requests. By default, fields with
  352. // empty values are omitted from API requests. However, any non-pointer,
  353. // non-interface field appearing in ForceSendFields will be sent to the
  354. // server regardless of whether the field is empty or not. This may be
  355. // used to include empty fields in Patch requests.
  356. ForceSendFields []string `json:"-"`
  357. // NullFields is a list of field names (e.g. "AdminEmails") to include
  358. // in API requests with the JSON null value. By default, fields with
  359. // empty values are omitted from API requests. However, any field with
  360. // an empty value appearing in NullFields will be sent to the server as
  361. // null. It is an error if a field in this list has a non-empty value.
  362. // This may be used to include null fields in Patch requests.
  363. NullFields []string `json:"-"`
  364. }
  365. func (s *Company) MarshalJSON() ([]byte, error) {
  366. type NoMethod Company
  367. raw := NoMethod(*s)
  368. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  369. }
  370. // Configuration: A configuration collects the provisioning options for
  371. // Android devices. Each
  372. // configuration combines the following:
  373. //
  374. // * The EMM device policy controller (DPC) installed on the devices.
  375. // * EMM policies enforced on the devices.
  376. // * Metadata displayed on the device to help users during
  377. // setup.
  378. //
  379. // Customers can add as many configurations as they need. However,
  380. // zero-touch
  381. // enrollment works best when a customer sets a default configuration
  382. // that's
  383. // applied to any new devices the organization purchases.
  384. type Configuration struct {
  385. // CompanyName: Required. The name of the organization. Zero-touch
  386. // enrollment shows this
  387. // organization name to device users during device provisioning.
  388. CompanyName string `json:"companyName,omitempty"`
  389. // ConfigurationId: Output only. The ID of the configuration. Assigned
  390. // by the server.
  391. ConfigurationId int64 `json:"configurationId,omitempty,string"`
  392. // ConfigurationName: Required. A short name that describes the
  393. // configuration's purpose. For
  394. // example, _Sales team_ or _Temporary employees_. The zero-touch
  395. // enrollment
  396. // portal displays this name to IT admins.
  397. ConfigurationName string `json:"configurationName,omitempty"`
  398. // ContactEmail: Required. The email address that device users can
  399. // contact to get help.
  400. // Zero-touch enrollment shows this email address to device users
  401. // before
  402. // device provisioning. The value is validated on input.
  403. ContactEmail string `json:"contactEmail,omitempty"`
  404. // ContactPhone: Required. The telephone number that device users can
  405. // call, using another
  406. // device, to get help. Zero-touch enrollment shows this number to
  407. // device
  408. // users before device provisioning. Accepts numerals, spaces, the plus
  409. // sign,
  410. // hyphens, and parentheses.
  411. ContactPhone string `json:"contactPhone,omitempty"`
  412. // CustomMessage: A message, containing one or two sentences, to help
  413. // device users get help
  414. // or give them more details about what’s happening to their
  415. // device.
  416. // Zero-touch enrollment shows this message before the device is
  417. // provisioned.
  418. CustomMessage string `json:"customMessage,omitempty"`
  419. // DpcExtras: The JSON-formatted EMM provisioning extras that are passed
  420. // to the DPC.
  421. DpcExtras string `json:"dpcExtras,omitempty"`
  422. // DpcResourcePath: Required. The resource name of the selected DPC
  423. // (device policy controller)
  424. // in the format `customers/[CUSTOMER_ID]/dpcs/*`. To list the supported
  425. // DPCs,
  426. // call
  427. // `customers.dpcs.list`.
  428. DpcResourcePath string `json:"dpcResourcePath,omitempty"`
  429. // IsDefault: Required. Whether this is the default configuration that
  430. // zero-touch
  431. // enrollment applies to any new devices the organization purchases in
  432. // the
  433. // future. Only one customer configuration can be the default. Setting
  434. // this
  435. // value to `true`, changes the previous default configuration's
  436. // `isDefault`
  437. // value to `false`.
  438. IsDefault bool `json:"isDefault,omitempty"`
  439. // Name: Output only. The API resource name in the
  440. // format
  441. // `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`. Assigned
  442. // by
  443. // the server.
  444. Name string `json:"name,omitempty"`
  445. // ServerResponse contains the HTTP response code and headers from the
  446. // server.
  447. googleapi.ServerResponse `json:"-"`
  448. // ForceSendFields is a list of field names (e.g. "CompanyName") to
  449. // unconditionally include in API requests. By default, fields with
  450. // empty values are omitted from API requests. However, any non-pointer,
  451. // non-interface field appearing in ForceSendFields will be sent to the
  452. // server regardless of whether the field is empty or not. This may be
  453. // used to include empty fields in Patch requests.
  454. ForceSendFields []string `json:"-"`
  455. // NullFields is a list of field names (e.g. "CompanyName") to include
  456. // in API requests with the JSON null value. By default, fields with
  457. // empty values are omitted from API requests. However, any field with
  458. // an empty value appearing in NullFields will be sent to the server as
  459. // null. It is an error if a field in this list has a non-empty value.
  460. // This may be used to include null fields in Patch requests.
  461. NullFields []string `json:"-"`
  462. }
  463. func (s *Configuration) MarshalJSON() ([]byte, error) {
  464. type NoMethod Configuration
  465. raw := NoMethod(*s)
  466. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  467. }
  468. // CreateCustomerRequest: Request message to create a customer.
  469. type CreateCustomerRequest struct {
  470. // Customer: Required. The company data to populate the new customer.
  471. // Must contain a
  472. // value for `companyName` and at least one `owner_email` that's
  473. // associated
  474. // with a Google Account. The values for `companyId` and `name` must be
  475. // empty.
  476. Customer *Company `json:"customer,omitempty"`
  477. // ForceSendFields is a list of field names (e.g. "Customer") to
  478. // unconditionally include in API requests. By default, fields with
  479. // empty values are omitted from API requests. However, any non-pointer,
  480. // non-interface field appearing in ForceSendFields will be sent to the
  481. // server regardless of whether the field is empty or not. This may be
  482. // used to include empty fields in Patch requests.
  483. ForceSendFields []string `json:"-"`
  484. // NullFields is a list of field names (e.g. "Customer") to include in
  485. // API requests with the JSON null value. By default, fields with empty
  486. // values are omitted from API requests. However, any field with an
  487. // empty value appearing in NullFields will be sent to the server as
  488. // null. It is an error if a field in this list has a non-empty value.
  489. // This may be used to include null fields in Patch requests.
  490. NullFields []string `json:"-"`
  491. }
  492. func (s *CreateCustomerRequest) MarshalJSON() ([]byte, error) {
  493. type NoMethod CreateCustomerRequest
  494. raw := NoMethod(*s)
  495. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  496. }
  497. // CustomerApplyConfigurationRequest: Request message for customer to
  498. // assign a configuration to device.
  499. type CustomerApplyConfigurationRequest struct {
  500. // Configuration: Required. The configuration applied to the device in
  501. // the
  502. // format
  503. // `customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`.
  504. Configuration string `json:"configuration,omitempty"`
  505. // Device: Required. The device the configuration is applied to.
  506. Device *DeviceReference `json:"device,omitempty"`
  507. // ForceSendFields is a list of field names (e.g. "Configuration") to
  508. // unconditionally include in API requests. By default, fields with
  509. // empty values are omitted from API requests. However, any non-pointer,
  510. // non-interface field appearing in ForceSendFields will be sent to the
  511. // server regardless of whether the field is empty or not. This may be
  512. // used to include empty fields in Patch requests.
  513. ForceSendFields []string `json:"-"`
  514. // NullFields is a list of field names (e.g. "Configuration") to include
  515. // in API requests with the JSON null value. By default, fields with
  516. // empty values are omitted from API requests. However, any field with
  517. // an empty value appearing in NullFields will be sent to the server as
  518. // null. It is an error if a field in this list has a non-empty value.
  519. // This may be used to include null fields in Patch requests.
  520. NullFields []string `json:"-"`
  521. }
  522. func (s *CustomerApplyConfigurationRequest) MarshalJSON() ([]byte, error) {
  523. type NoMethod CustomerApplyConfigurationRequest
  524. raw := NoMethod(*s)
  525. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  526. }
  527. // CustomerListConfigurationsResponse: Response message of customer's
  528. // listing configuration.
  529. type CustomerListConfigurationsResponse struct {
  530. // Configurations: The configurations.
  531. Configurations []*Configuration `json:"configurations,omitempty"`
  532. // ServerResponse contains the HTTP response code and headers from the
  533. // server.
  534. googleapi.ServerResponse `json:"-"`
  535. // ForceSendFields is a list of field names (e.g. "Configurations") to
  536. // unconditionally include in API requests. By default, fields with
  537. // empty values are omitted from API requests. However, any non-pointer,
  538. // non-interface field appearing in ForceSendFields will be sent to the
  539. // server regardless of whether the field is empty or not. This may be
  540. // used to include empty fields in Patch requests.
  541. ForceSendFields []string `json:"-"`
  542. // NullFields is a list of field names (e.g. "Configurations") to
  543. // include in API requests with the JSON null value. By default, fields
  544. // with empty values are omitted from API requests. However, any field
  545. // with an empty value appearing in NullFields will be sent to the
  546. // server as null. It is an error if a field in this list has a
  547. // non-empty value. This may be used to include null fields in Patch
  548. // requests.
  549. NullFields []string `json:"-"`
  550. }
  551. func (s *CustomerListConfigurationsResponse) MarshalJSON() ([]byte, error) {
  552. type NoMethod CustomerListConfigurationsResponse
  553. raw := NoMethod(*s)
  554. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  555. }
  556. // CustomerListCustomersResponse: Response message for listing my
  557. // customers.
  558. type CustomerListCustomersResponse struct {
  559. // Customers: The customer accounts the calling user is a member of.
  560. Customers []*Company `json:"customers,omitempty"`
  561. // NextPageToken: A token used to access the next page of results.
  562. // Omitted if no further
  563. // results are available.
  564. NextPageToken string `json:"nextPageToken,omitempty"`
  565. // ServerResponse contains the HTTP response code and headers from the
  566. // server.
  567. googleapi.ServerResponse `json:"-"`
  568. // ForceSendFields is a list of field names (e.g. "Customers") to
  569. // unconditionally include in API requests. By default, fields with
  570. // empty values are omitted from API requests. However, any non-pointer,
  571. // non-interface field appearing in ForceSendFields will be sent to the
  572. // server regardless of whether the field is empty or not. This may be
  573. // used to include empty fields in Patch requests.
  574. ForceSendFields []string `json:"-"`
  575. // NullFields is a list of field names (e.g. "Customers") to include in
  576. // API requests with the JSON null value. By default, fields with empty
  577. // values are omitted from API requests. However, any field with an
  578. // empty value appearing in NullFields will be sent to the server as
  579. // null. It is an error if a field in this list has a non-empty value.
  580. // This may be used to include null fields in Patch requests.
  581. NullFields []string `json:"-"`
  582. }
  583. func (s *CustomerListCustomersResponse) MarshalJSON() ([]byte, error) {
  584. type NoMethod CustomerListCustomersResponse
  585. raw := NoMethod(*s)
  586. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  587. }
  588. // CustomerListDevicesResponse: Response message of customer's liting
  589. // devices.
  590. type CustomerListDevicesResponse struct {
  591. // Devices: The customer's devices.
  592. Devices []*Device `json:"devices,omitempty"`
  593. // NextPageToken: A token used to access the next page of results.
  594. // Omitted if no further
  595. // results are available.
  596. NextPageToken string `json:"nextPageToken,omitempty"`
  597. // ServerResponse contains the HTTP response code and headers from the
  598. // server.
  599. googleapi.ServerResponse `json:"-"`
  600. // ForceSendFields is a list of field names (e.g. "Devices") to
  601. // unconditionally include in API requests. By default, fields with
  602. // empty values are omitted from API requests. However, any non-pointer,
  603. // non-interface field appearing in ForceSendFields will be sent to the
  604. // server regardless of whether the field is empty or not. This may be
  605. // used to include empty fields in Patch requests.
  606. ForceSendFields []string `json:"-"`
  607. // NullFields is a list of field names (e.g. "Devices") to include in
  608. // API requests with the JSON null value. By default, fields with empty
  609. // values are omitted from API requests. However, any field with an
  610. // empty value appearing in NullFields will be sent to the server as
  611. // null. It is an error if a field in this list has a non-empty value.
  612. // This may be used to include null fields in Patch requests.
  613. NullFields []string `json:"-"`
  614. }
  615. func (s *CustomerListDevicesResponse) MarshalJSON() ([]byte, error) {
  616. type NoMethod CustomerListDevicesResponse
  617. raw := NoMethod(*s)
  618. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  619. }
  620. // CustomerListDpcsResponse: Response message of customer's listing
  621. // DPCs.
  622. type CustomerListDpcsResponse struct {
  623. // Dpcs: The list of DPCs available to the customer that support
  624. // zero-touch
  625. // enrollment.
  626. Dpcs []*Dpc `json:"dpcs,omitempty"`
  627. // ServerResponse contains the HTTP response code and headers from the
  628. // server.
  629. googleapi.ServerResponse `json:"-"`
  630. // ForceSendFields is a list of field names (e.g. "Dpcs") to
  631. // unconditionally include in API requests. By default, fields with
  632. // empty values are omitted from API requests. However, any non-pointer,
  633. // non-interface field appearing in ForceSendFields will be sent to the
  634. // server regardless of whether the field is empty or not. This may be
  635. // used to include empty fields in Patch requests.
  636. ForceSendFields []string `json:"-"`
  637. // NullFields is a list of field names (e.g. "Dpcs") to include in API
  638. // requests with the JSON null value. By default, fields with empty
  639. // values are omitted from API requests. However, any field with an
  640. // empty value appearing in NullFields will be sent to the server as
  641. // null. It is an error if a field in this list has a non-empty value.
  642. // This may be used to include null fields in Patch requests.
  643. NullFields []string `json:"-"`
  644. }
  645. func (s *CustomerListDpcsResponse) MarshalJSON() ([]byte, error) {
  646. type NoMethod CustomerListDpcsResponse
  647. raw := NoMethod(*s)
  648. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  649. }
  650. // CustomerRemoveConfigurationRequest: Request message for customer to
  651. // remove the configuration from device.
  652. type CustomerRemoveConfigurationRequest struct {
  653. // Device: Required. The device to remove the configuration from.
  654. Device *DeviceReference `json:"device,omitempty"`
  655. // ForceSendFields is a list of field names (e.g. "Device") to
  656. // unconditionally include in API requests. By default, fields with
  657. // empty values are omitted from API requests. However, any non-pointer,
  658. // non-interface field appearing in ForceSendFields will be sent to the
  659. // server regardless of whether the field is empty or not. This may be
  660. // used to include empty fields in Patch requests.
  661. ForceSendFields []string `json:"-"`
  662. // NullFields is a list of field names (e.g. "Device") to include in API
  663. // requests with the JSON null value. By default, fields with empty
  664. // values are omitted from API requests. However, any field with an
  665. // empty value appearing in NullFields will be sent to the server as
  666. // null. It is an error if a field in this list has a non-empty value.
  667. // This may be used to include null fields in Patch requests.
  668. NullFields []string `json:"-"`
  669. }
  670. func (s *CustomerRemoveConfigurationRequest) MarshalJSON() ([]byte, error) {
  671. type NoMethod CustomerRemoveConfigurationRequest
  672. raw := NoMethod(*s)
  673. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  674. }
  675. // CustomerUnclaimDeviceRequest: Request message for customer to unclaim
  676. // a device.
  677. type CustomerUnclaimDeviceRequest struct {
  678. // Device: Required. The device to unclaim.
  679. Device *DeviceReference `json:"device,omitempty"`
  680. // ForceSendFields is a list of field names (e.g. "Device") to
  681. // unconditionally include in API requests. By default, fields with
  682. // empty values are omitted from API requests. However, any non-pointer,
  683. // non-interface field appearing in ForceSendFields will be sent to the
  684. // server regardless of whether the field is empty or not. This may be
  685. // used to include empty fields in Patch requests.
  686. ForceSendFields []string `json:"-"`
  687. // NullFields is a list of field names (e.g. "Device") to include in API
  688. // requests with the JSON null value. By default, fields with empty
  689. // values are omitted from API requests. However, any field with an
  690. // empty value appearing in NullFields will be sent to the server as
  691. // null. It is an error if a field in this list has a non-empty value.
  692. // This may be used to include null fields in Patch requests.
  693. NullFields []string `json:"-"`
  694. }
  695. func (s *CustomerUnclaimDeviceRequest) MarshalJSON() ([]byte, error) {
  696. type NoMethod CustomerUnclaimDeviceRequest
  697. raw := NoMethod(*s)
  698. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  699. }
  700. // Device: An Android device registered for zero-touch enrollment.
  701. type Device struct {
  702. // Claims: Output only. The provisioning claims for a device. Devices
  703. // claimed for
  704. // zero-touch enrollment have a claim with the type
  705. // `SECTION_TYPE_ZERO_TOUCH`.
  706. // Call
  707. // `partners.devices.unclaim`
  708. // or
  709. // `partner
  710. // s.devices.unclaimAsync`
  711. // to remove the device from zero-touch enrollment.
  712. Claims []*DeviceClaim `json:"claims,omitempty"`
  713. // Configuration: Not available to resellers.
  714. Configuration string `json:"configuration,omitempty"`
  715. // DeviceId: Output only. The ID of the device. Assigned by the server.
  716. DeviceId int64 `json:"deviceId,omitempty,string"`
  717. // DeviceIdentifier: The hardware IDs that identify a manufactured
  718. // device. To learn more,
  719. // read
  720. // [Identifiers](/zero-touch/guides/identifiers).
  721. DeviceIdentifier *DeviceIdentifier `json:"deviceIdentifier,omitempty"`
  722. // DeviceMetadata: The metadata attached to the device. Structured as
  723. // key-value pairs. To
  724. // learn more, read [Device metadata](/zero-touch/guides/metadata).
  725. DeviceMetadata *DeviceMetadata `json:"deviceMetadata,omitempty"`
  726. // Name: Output only. The API resource name in the
  727. // format
  728. // `partners/[PARTNER_ID]/devices/[DEVICE_ID]`. Assigned by the server.
  729. Name string `json:"name,omitempty"`
  730. // ServerResponse contains the HTTP response code and headers from the
  731. // server.
  732. googleapi.ServerResponse `json:"-"`
  733. // ForceSendFields is a list of field names (e.g. "Claims") to
  734. // unconditionally include in API requests. By default, fields with
  735. // empty values are omitted from API requests. However, any non-pointer,
  736. // non-interface field appearing in ForceSendFields will be sent to the
  737. // server regardless of whether the field is empty or not. This may be
  738. // used to include empty fields in Patch requests.
  739. ForceSendFields []string `json:"-"`
  740. // NullFields is a list of field names (e.g. "Claims") to include in API
  741. // requests with the JSON null value. By default, fields with empty
  742. // values are omitted from API requests. However, any field with an
  743. // empty value appearing in NullFields will be sent to the server as
  744. // null. It is an error if a field in this list has a non-empty value.
  745. // This may be used to include null fields in Patch requests.
  746. NullFields []string `json:"-"`
  747. }
  748. func (s *Device) MarshalJSON() ([]byte, error) {
  749. type NoMethod Device
  750. raw := NoMethod(*s)
  751. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  752. }
  753. // DeviceClaim: A record of a device claimed by a reseller for a
  754. // customer. Devices claimed
  755. // for zero-touch enrollment have a claim with the
  756. // type
  757. // `SECTION_TYPE_ZERO_TOUCH`. To learn more, read
  758. // [Claim devices for customers](/zero-touch/guides/how-it-works#claim).
  759. type DeviceClaim struct {
  760. // OwnerCompanyId: The ID of the Customer that purchased the device.
  761. OwnerCompanyId int64 `json:"ownerCompanyId,omitempty,string"`
  762. // ResellerId: The ID of the reseller that claimed the device.
  763. ResellerId int64 `json:"resellerId,omitempty,string"`
  764. // SectionType: Output only. The type of claim made on the device.
  765. //
  766. // Possible values:
  767. // "SECTION_TYPE_UNSPECIFIED" - Unspecified section type.
  768. // "SECTION_TYPE_SIM_LOCK" - SIM-lock section type.
  769. // "SECTION_TYPE_ZERO_TOUCH" - Zero-touch enrollment section type.
  770. SectionType string `json:"sectionType,omitempty"`
  771. // ForceSendFields is a list of field names (e.g. "OwnerCompanyId") to
  772. // unconditionally include in API requests. By default, fields with
  773. // empty values are omitted from API requests. However, any non-pointer,
  774. // non-interface field appearing in ForceSendFields will be sent to the
  775. // server regardless of whether the field is empty or not. This may be
  776. // used to include empty fields in Patch requests.
  777. ForceSendFields []string `json:"-"`
  778. // NullFields is a list of field names (e.g. "OwnerCompanyId") to
  779. // include in API requests with the JSON null value. By default, fields
  780. // with empty values are omitted from API requests. However, any field
  781. // with an empty value appearing in NullFields will be sent to the
  782. // server as null. It is an error if a field in this list has a
  783. // non-empty value. This may be used to include null fields in Patch
  784. // requests.
  785. NullFields []string `json:"-"`
  786. }
  787. func (s *DeviceClaim) MarshalJSON() ([]byte, error) {
  788. type NoMethod DeviceClaim
  789. raw := NoMethod(*s)
  790. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  791. }
  792. // DeviceIdentifier: Encapsulates hardware and product IDs to identify a
  793. // manufactured device.
  794. // To understand requirements on identifier sets,
  795. // read
  796. // [Identifiers](/zero-touch/guides/identifiers).
  797. type DeviceIdentifier struct {
  798. // Imei: The device’s IMEI number. Validated on input.
  799. Imei string `json:"imei,omitempty"`
  800. // Manufacturer: The device manufacturer’s name. Matches the device's
  801. // built-in
  802. // value returned from `android.os.Build.MANUFACTURER`. Allowed values
  803. // are
  804. // listed
  805. // in
  806. // [manufacturers](/zero-touch/resources/manufacturer-names#manufactur
  807. // ers-names).
  808. Manufacturer string `json:"manufacturer,omitempty"`
  809. // Meid: The device’s MEID number.
  810. Meid string `json:"meid,omitempty"`
  811. // Model: The device model's name. Matches the device's built-in value
  812. // returned from
  813. // `android.os.Build.MODEL`. Allowed values are listed
  814. // in
  815. // [models](/zero-touch/resources/manufacturer-names#model-names).
  816. Model string `json:"model,omitempty"`
  817. // SerialNumber: The manufacturer's serial number for the device. This
  818. // value might not be
  819. // unique across different device models.
  820. SerialNumber string `json:"serialNumber,omitempty"`
  821. // ForceSendFields is a list of field names (e.g. "Imei") to
  822. // unconditionally include in API requests. By default, fields with
  823. // empty values are omitted from API requests. However, any non-pointer,
  824. // non-interface field appearing in ForceSendFields will be sent to the
  825. // server regardless of whether the field is empty or not. This may be
  826. // used to include empty fields in Patch requests.
  827. ForceSendFields []string `json:"-"`
  828. // NullFields is a list of field names (e.g. "Imei") to include in API
  829. // requests with the JSON null value. By default, fields with empty
  830. // values are omitted from API requests. However, any field with an
  831. // empty value appearing in NullFields will be sent to the server as
  832. // null. It is an error if a field in this list has a non-empty value.
  833. // This may be used to include null fields in Patch requests.
  834. NullFields []string `json:"-"`
  835. }
  836. func (s *DeviceIdentifier) MarshalJSON() ([]byte, error) {
  837. type NoMethod DeviceIdentifier
  838. raw := NoMethod(*s)
  839. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  840. }
  841. // DeviceMetadata: Metadata entries that can be attached to a `Device`.
  842. // To learn more, read
  843. // [Device metadata](/zero-touch/guides/metadata).
  844. type DeviceMetadata struct {
  845. // Entries: Metadata entries recorded as key-value pairs.
  846. Entries map[string]string `json:"entries,omitempty"`
  847. // ServerResponse contains the HTTP response code and headers from the
  848. // server.
  849. googleapi.ServerResponse `json:"-"`
  850. // ForceSendFields is a list of field names (e.g. "Entries") to
  851. // unconditionally include in API requests. By default, fields with
  852. // empty values are omitted from API requests. However, any non-pointer,
  853. // non-interface field appearing in ForceSendFields will be sent to the
  854. // server regardless of whether the field is empty or not. This may be
  855. // used to include empty fields in Patch requests.
  856. ForceSendFields []string `json:"-"`
  857. // NullFields is a list of field names (e.g. "Entries") to include in
  858. // API requests with the JSON null value. By default, fields with empty
  859. // values are omitted from API requests. However, any field with an
  860. // empty value appearing in NullFields will be sent to the server as
  861. // null. It is an error if a field in this list has a non-empty value.
  862. // This may be used to include null fields in Patch requests.
  863. NullFields []string `json:"-"`
  864. }
  865. func (s *DeviceMetadata) MarshalJSON() ([]byte, error) {
  866. type NoMethod DeviceMetadata
  867. raw := NoMethod(*s)
  868. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  869. }
  870. // DeviceReference: A `DeviceReference` is an API abstraction that lets
  871. // you supply a _device_
  872. // argument to a method using one of the following identifier types:
  873. //
  874. // * A numeric API resource ID.
  875. // * Real-world hardware IDs, such as IMEI number, belonging to the
  876. // manufactured
  877. // device.
  878. //
  879. // Methods that operate on devices take a `DeviceReference` as a
  880. // parameter type
  881. // because it's more flexible for the caller. To learn more about
  882. // device
  883. // identifiers, read [Identifiers](/zero-touch/guides/identifiers).
  884. type DeviceReference struct {
  885. // DeviceId: The ID of the device.
  886. DeviceId int64 `json:"deviceId,omitempty,string"`
  887. // DeviceIdentifier: The hardware IDs of the device.
  888. DeviceIdentifier *DeviceIdentifier `json:"deviceIdentifier,omitempty"`
  889. // ForceSendFields is a list of field names (e.g. "DeviceId") to
  890. // unconditionally include in API requests. By default, fields with
  891. // empty values are omitted from API requests. However, any non-pointer,
  892. // non-interface field appearing in ForceSendFields will be sent to the
  893. // server regardless of whether the field is empty or not. This may be
  894. // used to include empty fields in Patch requests.
  895. ForceSendFields []string `json:"-"`
  896. // NullFields is a list of field names (e.g. "DeviceId") to include in
  897. // API requests with the JSON null value. By default, fields with empty
  898. // values are omitted from API requests. However, any field with an
  899. // empty value appearing in NullFields will be sent to the server as
  900. // null. It is an error if a field in this list has a non-empty value.
  901. // This may be used to include null fields in Patch requests.
  902. NullFields []string `json:"-"`
  903. }
  904. func (s *DeviceReference) MarshalJSON() ([]byte, error) {
  905. type NoMethod DeviceReference
  906. raw := NoMethod(*s)
  907. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  908. }
  909. // DevicesLongRunningOperationMetadata: Tracks the status of a
  910. // long-running operation to asynchronously update a
  911. // batch of reseller metadata attached to devices. To learn more,
  912. // read
  913. // [Long‑running batch
  914. // operations](/zero-touch/guides/how-it-works#operations).
  915. type DevicesLongRunningOperationMetadata struct {
  916. // DevicesCount: The number of metadata updates in the operation. This
  917. // might be different
  918. // from the number of updates in the request if the API can't parse some
  919. // of
  920. // the updates.
  921. DevicesCount int64 `json:"devicesCount,omitempty"`
  922. // ProcessingStatus: The processing status of the operation.
  923. //
  924. // Possible values:
  925. // "BATCH_PROCESS_STATUS_UNSPECIFIED" - Invalid code. Shouldn't be
  926. // used.
  927. // "BATCH_PROCESS_PENDING" - Pending.
  928. // "BATCH_PROCESS_IN_PROGRESS" - In progress.
  929. // "BATCH_PROCESS_PROCESSED" - Processed.
  930. // This doesn't mean all items were processed successfully, you
  931. // should
  932. // check the `response` field for the result of every item.
  933. ProcessingStatus string `json:"processingStatus,omitempty"`
  934. // Progress: The processing progress of the operation. Measured as a
  935. // number from 0 to
  936. // 100. A value of 10O doesnt always mean the operation
  937. // completed—check for
  938. // the inclusion of a `done` field.
  939. Progress int64 `json:"progress,omitempty"`
  940. // ForceSendFields is a list of field names (e.g. "DevicesCount") to
  941. // unconditionally include in API requests. By default, fields with
  942. // empty values are omitted from API requests. However, any non-pointer,
  943. // non-interface field appearing in ForceSendFields will be sent to the
  944. // server regardless of whether the field is empty or not. This may be
  945. // used to include empty fields in Patch requests.
  946. ForceSendFields []string `json:"-"`
  947. // NullFields is a list of field names (e.g. "DevicesCount") to include
  948. // in API requests with the JSON null value. By default, fields with
  949. // empty values are omitted from API requests. However, any field with
  950. // an empty value appearing in NullFields will be sent to the server as
  951. // null. It is an error if a field in this list has a non-empty value.
  952. // This may be used to include null fields in Patch requests.
  953. NullFields []string `json:"-"`
  954. }
  955. func (s *DevicesLongRunningOperationMetadata) MarshalJSON() ([]byte, error) {
  956. type NoMethod DevicesLongRunningOperationMetadata
  957. raw := NoMethod(*s)
  958. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  959. }
  960. // DevicesLongRunningOperationResponse: Tracks the status of a
  961. // long-running operation to claim, unclaim, or attach
  962. // metadata to devices. To learn more, read
  963. // [Long‑running batch
  964. // operations](/zero-touch/guides/how-it-works#operations).
  965. type DevicesLongRunningOperationResponse struct {
  966. // PerDeviceStatus: The processing status for each device in the
  967. // operation.
  968. // One `PerDeviceStatus` per device. The list order matches the items in
  969. // the
  970. // original request.
  971. PerDeviceStatus []*OperationPerDevice `json:"perDeviceStatus,omitempty"`
  972. // SuccessCount: A summary of how many items in the operation the server
  973. // processed
  974. // successfully. Updated as the operation progresses.
  975. SuccessCount int64 `json:"successCount,omitempty"`
  976. // ForceSendFields is a list of field names (e.g. "PerDeviceStatus") to
  977. // unconditionally include in API requests. By default, fields with
  978. // empty values are omitted from API requests. However, any non-pointer,
  979. // non-interface field appearing in ForceSendFields will be sent to the
  980. // server regardless of whether the field is empty or not. This may be
  981. // used to include empty fields in Patch requests.
  982. ForceSendFields []string `json:"-"`
  983. // NullFields is a list of field names (e.g. "PerDeviceStatus") to
  984. // include in API requests with the JSON null value. By default, fields
  985. // with empty values are omitted from API requests. However, any field
  986. // with an empty value appearing in NullFields will be sent to the
  987. // server as null. It is an error if a field in this list has a
  988. // non-empty value. This may be used to include null fields in Patch
  989. // requests.
  990. NullFields []string `json:"-"`
  991. }
  992. func (s *DevicesLongRunningOperationResponse) MarshalJSON() ([]byte, error) {
  993. type NoMethod DevicesLongRunningOperationResponse
  994. raw := NoMethod(*s)
  995. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  996. }
  997. // Dpc: An EMM's DPC ([device
  998. // policy
  999. // controller](http://developer.android.com/work/dpc/build-dpc.htm
  1000. // l)).
  1001. // Zero-touch enrollment installs a DPC (listed in the `Configuration`)
  1002. // on a
  1003. // device to maintain the customer's mobile policies. All the DPCs
  1004. // listed by the
  1005. // API support zero-touch enrollment and are available in Google Play.
  1006. type Dpc struct {
  1007. // DpcName: Output only. The title of the DPC app in Google Play. For
  1008. // example, _Google
  1009. // Apps Device Policy_. Useful in an application's user interface.
  1010. DpcName string `json:"dpcName,omitempty"`
  1011. // Name: Output only. The API resource name in the
  1012. // format
  1013. // `customers/[CUSTOMER_ID]/dpcs/[DPC_ID]`. Assigned by
  1014. // the server. To maintain a reference to a DPC across customer
  1015. // accounts,
  1016. // persist and match the last path component (`DPC_ID`).
  1017. Name string `json:"name,omitempty"`
  1018. // PackageName: Output only. The DPC's Android application ID that looks
  1019. // like a Java
  1020. // package name. Zero-touch enrollment installs the DPC app onto a
  1021. // device
  1022. // using this identifier.
  1023. PackageName string `json:"packageName,omitempty"`
  1024. // ForceSendFields is a list of field names (e.g. "DpcName") to
  1025. // unconditionally include in API requests. By default, fields with
  1026. // empty values are omitted from API requests. However, any non-pointer,
  1027. // non-interface field appearing in ForceSendFields will be sent to the
  1028. // server regardless of whether the field is empty or not. This may be
  1029. // used to include empty fields in Patch requests.
  1030. ForceSendFields []string `json:"-"`
  1031. // NullFields is a list of field names (e.g. "DpcName") to include in
  1032. // API requests with the JSON null value. By default, fields with empty
  1033. // values are omitted from API requests. However, any field with an
  1034. // empty value appearing in NullFields will be sent to the server as
  1035. // null. It is an error if a field in this list has a non-empty value.
  1036. // This may be used to include null fields in Patch requests.
  1037. NullFields []string `json:"-"`
  1038. }
  1039. func (s *Dpc) MarshalJSON() ([]byte, error) {
  1040. type NoMethod Dpc
  1041. raw := NoMethod(*s)
  1042. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1043. }
  1044. // Empty: A generic empty message that you can re-use to avoid defining
  1045. // duplicated
  1046. // empty messages in your APIs. A typical example is to use it as the
  1047. // request
  1048. // or the response type of an API method. For instance:
  1049. //
  1050. // service Foo {
  1051. // rpc Bar(google.protobuf.Empty) returns
  1052. // (google.protobuf.Empty);
  1053. // }
  1054. //
  1055. // The JSON representation for `Empty` is empty JSON object `{}`.
  1056. type Empty struct {
  1057. // ServerResponse contains the HTTP response code and headers from the
  1058. // server.
  1059. googleapi.ServerResponse `json:"-"`
  1060. }
  1061. // FindDevicesByDeviceIdentifierRequest: Request to find devices.
  1062. type FindDevicesByDeviceIdentifierRequest struct {
  1063. // DeviceIdentifier: Required. The device identifier to search for.
  1064. DeviceIdentifier *DeviceIdentifier `json:"deviceIdentifier,omitempty"`
  1065. // Limit: Required. The maximum number of devices to show in a page of
  1066. // results. Must
  1067. // be between 1 and 100 inclusive.
  1068. Limit int64 `json:"limit,omitempty,string"`
  1069. // PageToken: A token specifying which result page to return.
  1070. PageToken string `json:"pageToken,omitempty"`
  1071. // ForceSendFields is a list of field names (e.g. "DeviceIdentifier") to
  1072. // unconditionally include in API requests. By default, fields with
  1073. // empty values are omitted from API requests. However, any non-pointer,
  1074. // non-interface field appearing in ForceSendFields will be sent to the
  1075. // server regardless of whether the field is empty or not. This may be
  1076. // used to include empty fields in Patch requests.
  1077. ForceSendFields []string `json:"-"`
  1078. // NullFields is a list of field names (e.g. "DeviceIdentifier") to
  1079. // include in API requests with the JSON null value. By default, fields
  1080. // with empty values are omitted from API requests. However, any field
  1081. // with an empty value appearing in NullFields will be sent to the
  1082. // server as null. It is an error if a field in this list has a
  1083. // non-empty value. This may be used to include null fields in Patch
  1084. // requests.
  1085. NullFields []string `json:"-"`
  1086. }
  1087. func (s *FindDevicesByDeviceIdentifierRequest) MarshalJSON() ([]byte, error) {
  1088. type NoMethod FindDevicesByDeviceIdentifierRequest
  1089. raw := NoMethod(*s)
  1090. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1091. }
  1092. // FindDevicesByDeviceIdentifierResponse: Response containing found
  1093. // devices.
  1094. type FindDevicesByDeviceIdentifierResponse struct {
  1095. // Devices: Found devices.
  1096. Devices []*Device `json:"devices,omitempty"`
  1097. // NextPageToken: A token used to access the next page of results.
  1098. // Omitted if no further
  1099. // results are available.
  1100. NextPageToken string `json:"nextPageToken,omitempty"`
  1101. // TotalSize: The total count of items in the list irrespective of
  1102. // pagination.
  1103. TotalSize int64 `json:"totalSize,omitempty"`
  1104. // ServerResponse contains the HTTP response code and headers from the
  1105. // server.
  1106. googleapi.ServerResponse `json:"-"`
  1107. // ForceSendFields is a list of field names (e.g. "Devices") to
  1108. // unconditionally include in API requests. By default, fields with
  1109. // empty values are omitted from API requests. However, any non-pointer,
  1110. // non-interface field appearing in ForceSendFields will be sent to the
  1111. // server regardless of whether the field is empty or not. This may be
  1112. // used to include empty fields in Patch requests.
  1113. ForceSendFields []string `json:"-"`
  1114. // NullFields is a list of field names (e.g. "Devices") to include in
  1115. // API requests with the JSON null value. By default, fields with empty
  1116. // values are omitted from API requests. However, any field with an
  1117. // empty value appearing in NullFields will be sent to the server as
  1118. // null. It is an error if a field in this list has a non-empty value.
  1119. // This may be used to include null fields in Patch requests.
  1120. NullFields []string `json:"-"`
  1121. }
  1122. func (s *FindDevicesByDeviceIdentifierResponse) MarshalJSON() ([]byte, error) {
  1123. type NoMethod FindDevicesByDeviceIdentifierResponse
  1124. raw := NoMethod(*s)
  1125. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1126. }
  1127. // FindDevicesByOwnerRequest: Request to find devices by customers.
  1128. type FindDevicesByOwnerRequest struct {
  1129. // CustomerId: Required. The list of customer IDs to search for.
  1130. CustomerId googleapi.Int64s `json:"customerId,omitempty"`
  1131. // Limit: Required. The maximum number of devices to show in a page of
  1132. // results. Must
  1133. // be between 1 and 100 inclusive.
  1134. Limit int64 `json:"limit,omitempty,string"`
  1135. // PageToken: A token specifying which result page to return.
  1136. PageToken string `json:"pageToken,omitempty"`
  1137. // SectionType: Required. The section type of the device's provisioning
  1138. // record.
  1139. //
  1140. // Possible values:
  1141. // "SECTION_TYPE_UNSPECIFIED" - Unspecified section type.
  1142. // "SECTION_TYPE_SIM_LOCK" - SIM-lock section type.
  1143. // "SECTION_TYPE_ZERO_TOUCH" - Zero-touch enrollment section type.
  1144. SectionType string `json:"sectionType,omitempty"`
  1145. // ForceSendFields is a list of field names (e.g. "CustomerId") to
  1146. // unconditionally include in API requests. By default, fields with
  1147. // empty values are omitted from API requests. However, any non-pointer,
  1148. // non-interface field appearing in ForceSendFields will be sent to the
  1149. // server regardless of whether the field is empty or not. This may be
  1150. // used to include empty fields in Patch requests.
  1151. ForceSendFields []string `json:"-"`
  1152. // NullFields is a list of field names (e.g. "CustomerId") to include in
  1153. // API requests with the JSON null value. By default, fields with empty
  1154. // values are omitted from API requests. However, any field with an
  1155. // empty value appearing in NullFields will be sent to the server as
  1156. // null. It is an error if a field in this list has a non-empty value.
  1157. // This may be used to include null fields in Patch requests.
  1158. NullFields []string `json:"-"`
  1159. }
  1160. func (s *FindDevicesByOwnerRequest) MarshalJSON() ([]byte, error) {
  1161. type NoMethod FindDevicesByOwnerRequest
  1162. raw := NoMethod(*s)
  1163. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1164. }
  1165. // FindDevicesByOwnerResponse: Response containing found devices.
  1166. type FindDevicesByOwnerResponse struct {
  1167. // Devices: The customer's devices.
  1168. Devices []*Device `json:"devices,omitempty"`
  1169. // NextPageToken: A token used to access the next page of
  1170. // results.
  1171. // Omitted if no further results are available.
  1172. NextPageToken string `json:"nextPageToken,omitempty"`
  1173. // TotalSize: The total count of items in the list irrespective of
  1174. // pagination.
  1175. TotalSize int64 `json:"totalSize,omitempty"`
  1176. // ServerResponse contains the HTTP response code and headers from the
  1177. // server.
  1178. googleapi.ServerResponse `json:"-"`
  1179. // ForceSendFields is a list of field names (e.g. "Devices") to
  1180. // unconditionally include in API requests. By default, fields with
  1181. // empty values are omitted from API requests. However, any non-pointer,
  1182. // non-interface field appearing in ForceSendFields will be sent to the
  1183. // server regardless of whether the field is empty or not. This may be
  1184. // used to include empty fields in Patch requests.
  1185. ForceSendFields []string `json:"-"`
  1186. // NullFields is a list of field names (e.g. "Devices") to include in
  1187. // API requests with the JSON null value. By default, fields with empty
  1188. // values are omitted from API requests. However, any field with an
  1189. // empty value appearing in NullFields will be sent to the server as
  1190. // null. It is an error if a field in this list has a non-empty value.
  1191. // This may be used to include null fields in Patch requests.
  1192. NullFields []string `json:"-"`
  1193. }
  1194. func (s *FindDevicesByOwnerResponse) MarshalJSON() ([]byte, error) {
  1195. type NoMethod FindDevicesByOwnerResponse
  1196. raw := NoMethod(*s)
  1197. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1198. }
  1199. // ListCustomersResponse: Response message of all customers related to
  1200. // this partner.
  1201. type ListCustomersResponse struct {
  1202. // Customers: List of customers related to this reseller partner.
  1203. Customers []*Company `json:"customers,omitempty"`
  1204. // NextPageToken: A token to retrieve the next page of results. Omitted
  1205. // if no further results
  1206. // are available.
  1207. NextPageToken string `json:"nextPageToken,omitempty"`
  1208. // TotalSize: The total count of items in the list irrespective of
  1209. // pagination.
  1210. TotalSize int64 `json:"totalSize,omitempty"`
  1211. // ServerResponse contains the HTTP response code and headers from the
  1212. // server.
  1213. googleapi.ServerResponse `json:"-"`
  1214. // ForceSendFields is a list of field names (e.g. "Customers") to
  1215. // unconditionally include in API requests. By default, fields with
  1216. // empty values are omitted from API requests. However, any non-pointer,
  1217. // non-interface field appearing in ForceSendFields will be sent to the
  1218. // server regardless of whether the field is empty or not. This may be
  1219. // used to include empty fields in Patch requests.
  1220. ForceSendFields []string `json:"-"`
  1221. // NullFields is a list of field names (e.g. "Customers") to include in
  1222. // API requests with the JSON null value. By default, fields with empty
  1223. // values are omitted from API requests. However, any field with an
  1224. // empty value appearing in NullFields will be sent to the server as
  1225. // null. It is an error if a field in this list has a non-empty value.
  1226. // This may be used to include null fields in Patch requests.
  1227. NullFields []string `json:"-"`
  1228. }
  1229. func (s *ListCustomersResponse) MarshalJSON() ([]byte, error) {
  1230. type NoMethod ListCustomersResponse
  1231. raw := NoMethod(*s)
  1232. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1233. }
  1234. // ListVendorCustomersResponse: Response message to list customers of
  1235. // the vendor.
  1236. type ListVendorCustomersResponse struct {
  1237. // Customers: List of customers of the vendor.
  1238. Customers []*Company `json:"customers,omitempty"`
  1239. // NextPageToken: A token to retrieve the next page of results. Omitted
  1240. // if no further results
  1241. // are available.
  1242. NextPageToken string `json:"nextPageToken,omitempty"`
  1243. // TotalSize: The total count of items in the list irrespective of
  1244. // pagination.
  1245. TotalSize int64 `json:"totalSize,omitempty"`
  1246. // ServerResponse contains the HTTP response code and headers from the
  1247. // server.
  1248. googleapi.ServerResponse `json:"-"`
  1249. // ForceSendFields is a list of field names (e.g. "Customers") to
  1250. // unconditionally include in API requests. By default, fields with
  1251. // empty values are omitted from API requests. However, any non-pointer,
  1252. // non-interface field appearing in ForceSendFields will be sent to the
  1253. // server regardless of whether the field is empty or not. This may be
  1254. // used to include empty fields in Patch requests.
  1255. ForceSendFields []string `json:"-"`
  1256. // NullFields is a list of field names (e.g. "Customers") to include in
  1257. // API requests with the JSON null value. By default, fields with empty
  1258. // values are omitted from API requests. However, any field with an
  1259. // empty value appearing in NullFields will be sent to the server as
  1260. // null. It is an error if a field in this list has a non-empty value.
  1261. // This may be used to include null fields in Patch requests.
  1262. NullFields []string `json:"-"`
  1263. }
  1264. func (s *ListVendorCustomersResponse) MarshalJSON() ([]byte, error) {
  1265. type NoMethod ListVendorCustomersResponse
  1266. raw := NoMethod(*s)
  1267. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1268. }
  1269. // ListVendorsResponse: Response message to list vendors of the partner.
  1270. type ListVendorsResponse struct {
  1271. // NextPageToken: A token to retrieve the next page of results. Omitted
  1272. // if no further results
  1273. // are available.
  1274. NextPageToken string `json:"nextPageToken,omitempty"`
  1275. // TotalSize: The total count of items in the list irrespective of
  1276. // pagination.
  1277. TotalSize int64 `json:"totalSize,omitempty"`
  1278. // Vendors: List of vendors of the reseller partner. Fields `name`,
  1279. // `companyId` and
  1280. // `companyName` are populated to the Company object.
  1281. Vendors []*Company `json:"vendors,omitempty"`
  1282. // ServerResponse contains the HTTP response code and headers from the
  1283. // server.
  1284. googleapi.ServerResponse `json:"-"`
  1285. // ForceSendFields is a list of field names (e.g. "NextPageToken") 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. "NextPageToken") to include
  1293. // in API requests with the JSON null value. By default, fields with
  1294. // empty values are omitted from API requests. However, any field with
  1295. // an 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 *ListVendorsResponse) MarshalJSON() ([]byte, error) {
  1301. type NoMethod ListVendorsResponse
  1302. raw := NoMethod(*s)
  1303. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1304. }
  1305. // Operation: This resource represents a long-running operation that is
  1306. // the result of a
  1307. // network API call.
  1308. type Operation struct {
  1309. // Done: If the value is `false`, it means the operation is still in
  1310. // progress.
  1311. // If `true`, the operation is completed, and either `error` or
  1312. // `response` is
  1313. // available.
  1314. Done bool `json:"done,omitempty"`
  1315. // Error: This field will always be not set if the operation is created
  1316. // by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`. In this
  1317. // case, error information for each device is set in
  1318. // `response.perDeviceStatus.result.status`.
  1319. Error *Status `json:"error,omitempty"`
  1320. // Metadata: This field will contain a
  1321. // `DevicesLongRunningOperationMetadata` object if the operation is
  1322. // created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`.
  1323. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1324. // Name: The server-assigned name, which is only unique within the same
  1325. // service that
  1326. // originally returns it. If you use the default HTTP mapping,
  1327. // the
  1328. // `name` should have the format of `operations/some/unique/name`.
  1329. Name string `json:"name,omitempty"`
  1330. // Response: This field will contain a
  1331. // `DevicesLongRunningOperationResponse` object if the operation is
  1332. // created by `claimAsync`, `unclaimAsync`, or `updateMetadataAsync`.
  1333. Response googleapi.RawMessage `json:"response,omitempty"`
  1334. // ServerResponse contains the HTTP response code and headers from the
  1335. // server.
  1336. googleapi.ServerResponse `json:"-"`
  1337. // ForceSendFields is a list of field names (e.g. "Done") to
  1338. // unconditionally include in API requests. By default, fields with
  1339. // empty values are omitted from API requests. However, any non-pointer,
  1340. // non-interface field appearing in ForceSendFields will be sent to the
  1341. // server regardless of whether the field is empty or not. This may be
  1342. // used to include empty fields in Patch requests.
  1343. ForceSendFields []string `json:"-"`
  1344. // NullFields is a list of field names (e.g. "Done") to include in API
  1345. // requests with the JSON null value. By default, fields with empty
  1346. // values are omitted from API requests. However, any field with an
  1347. // empty value appearing in NullFields will be sent to the server as
  1348. // null. It is an error if a field in this list has a non-empty value.
  1349. // This may be used to include null fields in Patch requests.
  1350. NullFields []string `json:"-"`
  1351. }
  1352. func (s *Operation) MarshalJSON() ([]byte, error) {
  1353. type NoMethod Operation
  1354. raw := NoMethod(*s)
  1355. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1356. }
  1357. // OperationPerDevice: A task for each device in the operation.
  1358. // Corresponds to each device
  1359. // change in the request.
  1360. type OperationPerDevice struct {
  1361. // Claim: A copy of the original device-claim request received by the
  1362. // server.
  1363. Claim *PartnerClaim `json:"claim,omitempty"`
  1364. // Result: The processing result for each device.
  1365. Result *PerDeviceStatusInBatch `json:"result,omitempty"`
  1366. // Unclaim: A copy of the original device-unclaim request received by
  1367. // the server.
  1368. Unclaim *PartnerUnclaim `json:"unclaim,omitempty"`
  1369. // UpdateMetadata: A copy of the original metadata-update request
  1370. // received by the server.
  1371. UpdateMetadata *UpdateMetadataArguments `json:"updateMetadata,omitempty"`
  1372. // ForceSendFields is a list of field names (e.g. "Claim") to
  1373. // unconditionally include in API requests. By default, fields with
  1374. // empty values are omitted from API requests. However, any non-pointer,
  1375. // non-interface field appearing in ForceSendFields will be sent to the
  1376. // server regardless of whether the field is empty or not. This may be
  1377. // used to include empty fields in Patch requests.
  1378. ForceSendFields []string `json:"-"`
  1379. // NullFields is a list of field names (e.g. "Claim") to include in API
  1380. // requests with the JSON null value. By default, fields with empty
  1381. // values are omitted from API requests. However, any field with an
  1382. // empty value appearing in NullFields will be sent to the server as
  1383. // null. It is an error if a field in this list has a non-empty value.
  1384. // This may be used to include null fields in Patch requests.
  1385. NullFields []string `json:"-"`
  1386. }
  1387. func (s *OperationPerDevice) MarshalJSON() ([]byte, error) {
  1388. type NoMethod OperationPerDevice
  1389. raw := NoMethod(*s)
  1390. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1391. }
  1392. // PartnerClaim: Identifies one claim request.
  1393. type PartnerClaim struct {
  1394. // CustomerId: Required. The ID of the customer for whom the device is
  1395. // being claimed.
  1396. CustomerId int64 `json:"customerId,omitempty,string"`
  1397. // DeviceIdentifier: Required. Device identifier of the device.
  1398. DeviceIdentifier *DeviceIdentifier `json:"deviceIdentifier,omitempty"`
  1399. // DeviceMetadata: Required. The metadata to attach to the device at
  1400. // claim.
  1401. DeviceMetadata *DeviceMetadata `json:"deviceMetadata,omitempty"`
  1402. // SectionType: Required. The section type of the device's provisioning
  1403. // record.
  1404. //
  1405. // Possible values:
  1406. // "SECTION_TYPE_UNSPECIFIED" - Unspecified section type.
  1407. // "SECTION_TYPE_SIM_LOCK" - SIM-lock section type.
  1408. // "SECTION_TYPE_ZERO_TOUCH" - Zero-touch enrollment section type.
  1409. SectionType string `json:"sectionType,omitempty"`
  1410. // ForceSendFields is a list of field names (e.g. "CustomerId") 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. "CustomerId") to include in
  1418. // API requests with the JSON null value. By default, fields with empty
  1419. // values are omitted from API requests. However, any field with an
  1420. // empty value appearing in NullFields will be sent to the server as
  1421. // null. It is an error if a field in this list has a non-empty value.
  1422. // This may be used to include null fields in Patch requests.
  1423. NullFields []string `json:"-"`
  1424. }
  1425. func (s *PartnerClaim) MarshalJSON() ([]byte, error) {
  1426. type NoMethod PartnerClaim
  1427. raw := NoMethod(*s)
  1428. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1429. }
  1430. // PartnerUnclaim: Identifies one unclaim request.
  1431. type PartnerUnclaim struct {
  1432. // DeviceId: Device ID of the device.
  1433. DeviceId int64 `json:"deviceId,omitempty,string"`
  1434. // DeviceIdentifier: Device identifier of the device.
  1435. DeviceIdentifier *DeviceIdentifier `json:"deviceIdentifier,omitempty"`
  1436. // SectionType: Required. The section type of the device's provisioning
  1437. // record.
  1438. //
  1439. // Possible values:
  1440. // "SECTION_TYPE_UNSPECIFIED" - Unspecified section type.
  1441. // "SECTION_TYPE_SIM_LOCK" - SIM-lock section type.
  1442. // "SECTION_TYPE_ZERO_TOUCH" - Zero-touch enrollment section type.
  1443. SectionType string `json:"sectionType,omitempty"`
  1444. // ForceSendFields is a list of field names (e.g. "DeviceId") to
  1445. // unconditionally include in API requests. By default, fields with
  1446. // empty values are omitted from API requests. However, any non-pointer,
  1447. // non-interface field appearing in ForceSendFields will be sent to the
  1448. // server regardless of whether the field is empty or not. This may be
  1449. // used to include empty fields in Patch requests.
  1450. ForceSendFields []string `json:"-"`
  1451. // NullFields is a list of field names (e.g. "DeviceId") to include in
  1452. // API requests with the JSON null value. By default, fields with empty
  1453. // values are omitted from API requests. However, any field with an
  1454. // empty value appearing in NullFields will be sent to the server as
  1455. // null. It is an error if a field in this list has a non-empty value.
  1456. // This may be used to include null fields in Patch requests.
  1457. NullFields []string `json:"-"`
  1458. }
  1459. func (s *PartnerUnclaim) MarshalJSON() ([]byte, error) {
  1460. type NoMethod PartnerUnclaim
  1461. raw := NoMethod(*s)
  1462. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1463. }
  1464. // PerDeviceStatusInBatch: Captures the processing status for each
  1465. // device in the operation.
  1466. type PerDeviceStatusInBatch struct {
  1467. // DeviceId: If processing succeeds, the device ID of the device.
  1468. DeviceId int64 `json:"deviceId,omitempty,string"`
  1469. // ErrorIdentifier: If processing fails, the error type.
  1470. ErrorIdentifier string `json:"errorIdentifier,omitempty"`
  1471. // ErrorMessage: If processing fails, a developer message explaining
  1472. // what went wrong.
  1473. ErrorMessage string `json:"errorMessage,omitempty"`
  1474. // Status: The result status of the device after processing.
  1475. //
  1476. // Possible values:
  1477. // "SINGLE_DEVICE_STATUS_UNSPECIFIED" - Invalid code. Shouldn't be
  1478. // used.
  1479. // "SINGLE_DEVICE_STATUS_UNKNOWN_ERROR" - Unknown error.
  1480. // We don't expect this error to occur here.
  1481. // "SINGLE_DEVICE_STATUS_OTHER_ERROR" - Other error.
  1482. // We know/expect this error, but there's no defined error code for
  1483. // the
  1484. // error.
  1485. // "SINGLE_DEVICE_STATUS_SUCCESS" - Success.
  1486. // "SINGLE_DEVICE_STATUS_PERMISSION_DENIED" - Permission denied.
  1487. // "SINGLE_DEVICE_STATUS_INVALID_DEVICE_IDENTIFIER" - Invalid device
  1488. // identifier.
  1489. // "SINGLE_DEVICE_STATUS_INVALID_SECTION_TYPE" - Invalid section type.
  1490. // "SINGLE_DEVICE_STATUS_SECTION_NOT_YOURS" - This section is claimed
  1491. // by another company.
  1492. Status string `json:"status,omitempty"`
  1493. // ForceSendFields is a list of field names (e.g. "DeviceId") to
  1494. // unconditionally include in API requests. By default, fields with
  1495. // empty values are omitted from API requests. However, any non-pointer,
  1496. // non-interface field appearing in ForceSendFields will be sent to the
  1497. // server regardless of whether the field is empty or not. This may be
  1498. // used to include empty fields in Patch requests.
  1499. ForceSendFields []string `json:"-"`
  1500. // NullFields is a list of field names (e.g. "DeviceId") to include in
  1501. // API requests with the JSON null value. By default, fields with empty
  1502. // values are omitted from API requests. However, any field with an
  1503. // empty value appearing in NullFields will be sent to the server as
  1504. // null. It is an error if a field in this list has a non-empty value.
  1505. // This may be used to include null fields in Patch requests.
  1506. NullFields []string `json:"-"`
  1507. }
  1508. func (s *PerDeviceStatusInBatch) MarshalJSON() ([]byte, error) {
  1509. type NoMethod PerDeviceStatusInBatch
  1510. raw := NoMethod(*s)
  1511. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1512. }
  1513. // Status: The `Status` type defines a logical error model that is
  1514. // suitable for
  1515. // different programming environments, including REST APIs and RPC APIs.
  1516. // It is
  1517. // used by [gRPC](https://github.com/grpc). The error model is designed
  1518. // to be:
  1519. //
  1520. // - Simple to use and understand for most users
  1521. // - Flexible enough to meet unexpected needs
  1522. //
  1523. // # Overview
  1524. //
  1525. // The `Status` message contains three pieces of data: error code,
  1526. // error
  1527. // message, and error details. The error code should be an enum value
  1528. // of
  1529. // google.rpc.Code, but it may accept additional error codes if needed.
  1530. // The
  1531. // error message should be a developer-facing English message that
  1532. // helps
  1533. // developers *understand* and *resolve* the error. If a localized
  1534. // user-facing
  1535. // error message is needed, put the localized message in the error
  1536. // details or
  1537. // localize it in the client. The optional error details may contain
  1538. // arbitrary
  1539. // information about the error. There is a predefined set of error
  1540. // detail types
  1541. // in the package `google.rpc` that can be used for common error
  1542. // conditions.
  1543. //
  1544. // # Language mapping
  1545. //
  1546. // The `Status` message is the logical representation of the error
  1547. // model, but it
  1548. // is not necessarily the actual wire format. When the `Status` message
  1549. // is
  1550. // exposed in different client libraries and different wire protocols,
  1551. // it can be
  1552. // mapped differently. For example, it will likely be mapped to some
  1553. // exceptions
  1554. // in Java, but more likely mapped to some error codes in C.
  1555. //
  1556. // # Other uses
  1557. //
  1558. // The error model and the `Status` message can be used in a variety
  1559. // of
  1560. // environments, either with or without APIs, to provide a
  1561. // consistent developer experience across different
  1562. // environments.
  1563. //
  1564. // Example uses of this error model include:
  1565. //
  1566. // - Partial errors. If a service needs to return partial errors to the
  1567. // client,
  1568. // it may embed the `Status` in the normal response to indicate the
  1569. // partial
  1570. // errors.
  1571. //
  1572. // - Workflow errors. A typical workflow has multiple steps. Each step
  1573. // may
  1574. // have a `Status` message for error reporting.
  1575. //
  1576. // - Batch operations. If a client uses batch request and batch
  1577. // response, the
  1578. // `Status` message should be used directly inside batch response,
  1579. // one for
  1580. // each error sub-response.
  1581. //
  1582. // - Asynchronous operations. If an API call embeds asynchronous
  1583. // operation
  1584. // results in its response, the status of those operations should
  1585. // be
  1586. // represented directly using the `Status` message.
  1587. //
  1588. // - Logging. If some API errors are stored in logs, the message
  1589. // `Status` could
  1590. // be used directly after any stripping needed for security/privacy
  1591. // reasons.
  1592. type Status struct {
  1593. // Code: The status code, which should be an enum value of
  1594. // google.rpc.Code.
  1595. Code int64 `json:"code,omitempty"`
  1596. // Details: A list of messages that carry the error details. There is a
  1597. // common set of
  1598. // message types for APIs to use.
  1599. Details []googleapi.RawMessage `json:"details,omitempty"`
  1600. // Message: A developer-facing error message, which should be in
  1601. // English. Any
  1602. // user-facing error message should be localized and sent in
  1603. // the
  1604. // google.rpc.Status.details field, or localized by the client.
  1605. Message string `json:"message,omitempty"`
  1606. // ForceSendFields is a list of field names (e.g. "Code") to
  1607. // unconditionally include in API requests. By default, fields with
  1608. // empty values are omitted from API requests. However, any non-pointer,
  1609. // non-interface field appearing in ForceSendFields will be sent to the
  1610. // server regardless of whether the field is empty or not. This may be
  1611. // used to include empty fields in Patch requests.
  1612. ForceSendFields []string `json:"-"`
  1613. // NullFields is a list of field names (e.g. "Code") to include in API
  1614. // requests with the JSON null value. By default, fields with empty
  1615. // values are omitted from API requests. However, any field with an
  1616. // empty value appearing in NullFields will be sent to the server as
  1617. // null. It is an error if a field in this list has a non-empty value.
  1618. // This may be used to include null fields in Patch requests.
  1619. NullFields []string `json:"-"`
  1620. }
  1621. func (s *Status) MarshalJSON() ([]byte, error) {
  1622. type NoMethod Status
  1623. raw := NoMethod(*s)
  1624. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1625. }
  1626. // UnclaimDeviceRequest: Request message to unclaim a device.
  1627. type UnclaimDeviceRequest struct {
  1628. // DeviceId: The device ID returned by `ClaimDevice`.
  1629. DeviceId int64 `json:"deviceId,omitempty,string"`
  1630. // DeviceIdentifier: The device identifier you used when you claimed
  1631. // this device.
  1632. DeviceIdentifier *DeviceIdentifier `json:"deviceIdentifier,omitempty"`
  1633. // SectionType: Required. The section type of the device's provisioning
  1634. // record.
  1635. //
  1636. // Possible values:
  1637. // "SECTION_TYPE_UNSPECIFIED" - Unspecified section type.
  1638. // "SECTION_TYPE_SIM_LOCK" - SIM-lock section type.
  1639. // "SECTION_TYPE_ZERO_TOUCH" - Zero-touch enrollment section type.
  1640. SectionType string `json:"sectionType,omitempty"`
  1641. // ForceSendFields is a list of field names (e.g. "DeviceId") to
  1642. // unconditionally include in API requests. By default, fields with
  1643. // empty values are omitted from API requests. However, any non-pointer,
  1644. // non-interface field appearing in ForceSendFields will be sent to the
  1645. // server regardless of whether the field is empty or not. This may be
  1646. // used to include empty fields in Patch requests.
  1647. ForceSendFields []string `json:"-"`
  1648. // NullFields is a list of field names (e.g. "DeviceId") to include in
  1649. // API requests with the JSON null value. By default, fields with empty
  1650. // values are omitted from API requests. However, any field with an
  1651. // empty value appearing in NullFields will be sent to the server as
  1652. // null. It is an error if a field in this list has a non-empty value.
  1653. // This may be used to include null fields in Patch requests.
  1654. NullFields []string `json:"-"`
  1655. }
  1656. func (s *UnclaimDeviceRequest) MarshalJSON() ([]byte, error) {
  1657. type NoMethod UnclaimDeviceRequest
  1658. raw := NoMethod(*s)
  1659. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1660. }
  1661. // UnclaimDevicesRequest: Request to unclaim devices asynchronously in
  1662. // batch.
  1663. type UnclaimDevicesRequest struct {
  1664. // Unclaims: Required. The list of devices to unclaim.
  1665. Unclaims []*PartnerUnclaim `json:"unclaims,omitempty"`
  1666. // ForceSendFields is a list of field names (e.g. "Unclaims") to
  1667. // unconditionally include in API requests. By default, fields with
  1668. // empty values are omitted from API requests. However, any non-pointer,
  1669. // non-interface field appearing in ForceSendFields will be sent to the
  1670. // server regardless of whether the field is empty or not. This may be
  1671. // used to include empty fields in Patch requests.
  1672. ForceSendFields []string `json:"-"`
  1673. // NullFields is a list of field names (e.g. "Unclaims") to include in
  1674. // API requests with the JSON null value. By default, fields with empty
  1675. // values are omitted from API requests. However, any field with an
  1676. // empty value appearing in NullFields will be sent to the server as
  1677. // null. It is an error if a field in this list has a non-empty value.
  1678. // This may be used to include null fields in Patch requests.
  1679. NullFields []string `json:"-"`
  1680. }
  1681. func (s *UnclaimDevicesRequest) MarshalJSON() ([]byte, error) {
  1682. type NoMethod UnclaimDevicesRequest
  1683. raw := NoMethod(*s)
  1684. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1685. }
  1686. // UpdateDeviceMetadataInBatchRequest: Request to update device metadata
  1687. // in batch.
  1688. type UpdateDeviceMetadataInBatchRequest struct {
  1689. // Updates: Required. The list of metadata updates.
  1690. Updates []*UpdateMetadataArguments `json:"updates,omitempty"`
  1691. // ForceSendFields is a list of field names (e.g. "Updates") to
  1692. // unconditionally include in API requests. By default, fields with
  1693. // empty values are omitted from API requests. However, any non-pointer,
  1694. // non-interface field appearing in ForceSendFields will be sent to the
  1695. // server regardless of whether the field is empty or not. This may be
  1696. // used to include empty fields in Patch requests.
  1697. ForceSendFields []string `json:"-"`
  1698. // NullFields is a list of field names (e.g. "Updates") to include in
  1699. // API requests with the JSON null value. By default, fields with empty
  1700. // values are omitted from API requests. However, any field with an
  1701. // empty value appearing in NullFields will be sent to the server as
  1702. // null. It is an error if a field in this list has a non-empty value.
  1703. // This may be used to include null fields in Patch requests.
  1704. NullFields []string `json:"-"`
  1705. }
  1706. func (s *UpdateDeviceMetadataInBatchRequest) MarshalJSON() ([]byte, error) {
  1707. type NoMethod UpdateDeviceMetadataInBatchRequest
  1708. raw := NoMethod(*s)
  1709. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1710. }
  1711. // UpdateDeviceMetadataRequest: Request to set metadata for a device.
  1712. type UpdateDeviceMetadataRequest struct {
  1713. // DeviceMetadata: Required. The metdata to attach to the device.
  1714. DeviceMetadata *DeviceMetadata `json:"deviceMetadata,omitempty"`
  1715. // ForceSendFields is a list of field names (e.g. "DeviceMetadata") to
  1716. // unconditionally include in API requests. By default, fields with
  1717. // empty values are omitted from API requests. However, any non-pointer,
  1718. // non-interface field appearing in ForceSendFields will be sent to the
  1719. // server regardless of whether the field is empty or not. This may be
  1720. // used to include empty fields in Patch requests.
  1721. ForceSendFields []string `json:"-"`
  1722. // NullFields is a list of field names (e.g. "DeviceMetadata") to
  1723. // include in API requests with the JSON null value. By default, fields
  1724. // with empty values are omitted from API requests. However, any field
  1725. // with an empty value appearing in NullFields will be sent to the
  1726. // server as null. It is an error if a field in this list has a
  1727. // non-empty value. This may be used to include null fields in Patch
  1728. // requests.
  1729. NullFields []string `json:"-"`
  1730. }
  1731. func (s *UpdateDeviceMetadataRequest) MarshalJSON() ([]byte, error) {
  1732. type NoMethod UpdateDeviceMetadataRequest
  1733. raw := NoMethod(*s)
  1734. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1735. }
  1736. // UpdateMetadataArguments: Identifies metdata updates to one device.
  1737. type UpdateMetadataArguments struct {
  1738. // DeviceId: Device ID of the device.
  1739. DeviceId int64 `json:"deviceId,omitempty,string"`
  1740. // DeviceIdentifier: Device identifier.
  1741. DeviceIdentifier *DeviceIdentifier `json:"deviceIdentifier,omitempty"`
  1742. // DeviceMetadata: Required. The metadata to update.
  1743. DeviceMetadata *DeviceMetadata `json:"deviceMetadata,omitempty"`
  1744. // ForceSendFields is a list of field names (e.g. "DeviceId") to
  1745. // unconditionally include in API requests. By default, fields with
  1746. // empty values are omitted from API requests. However, any non-pointer,
  1747. // non-interface field appearing in ForceSendFields will be sent to the
  1748. // server regardless of whether the field is empty or not. This may be
  1749. // used to include empty fields in Patch requests.
  1750. ForceSendFields []string `json:"-"`
  1751. // NullFields is a list of field names (e.g. "DeviceId") to include in
  1752. // API requests with the JSON null value. By default, fields with empty
  1753. // values are omitted from API requests. However, any field with an
  1754. // empty value appearing in NullFields will be sent to the server as
  1755. // null. It is an error if a field in this list has a non-empty value.
  1756. // This may be used to include null fields in Patch requests.
  1757. NullFields []string `json:"-"`
  1758. }
  1759. func (s *UpdateMetadataArguments) MarshalJSON() ([]byte, error) {
  1760. type NoMethod UpdateMetadataArguments
  1761. raw := NoMethod(*s)
  1762. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1763. }
  1764. // method id "androiddeviceprovisioning.customers.list":
  1765. type CustomersListCall struct {
  1766. s *Service
  1767. urlParams_ gensupport.URLParams
  1768. ifNoneMatch_ string
  1769. ctx_ context.Context
  1770. header_ http.Header
  1771. }
  1772. // List: Lists the user's customer accounts.
  1773. func (r *CustomersService) List() *CustomersListCall {
  1774. c := &CustomersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1775. return c
  1776. }
  1777. // PageSize sets the optional parameter "pageSize": The maximum number
  1778. // of customers to show in a page of results.
  1779. // A number between 1 and 100 (inclusive).
  1780. func (c *CustomersListCall) PageSize(pageSize int64) *CustomersListCall {
  1781. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1782. return c
  1783. }
  1784. // PageToken sets the optional parameter "pageToken": A token specifying
  1785. // which result page to return.
  1786. func (c *CustomersListCall) PageToken(pageToken string) *CustomersListCall {
  1787. c.urlParams_.Set("pageToken", pageToken)
  1788. return c
  1789. }
  1790. // Fields allows partial responses to be retrieved. See
  1791. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1792. // for more information.
  1793. func (c *CustomersListCall) Fields(s ...googleapi.Field) *CustomersListCall {
  1794. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1795. return c
  1796. }
  1797. // IfNoneMatch sets the optional parameter which makes the operation
  1798. // fail if the object's ETag matches the given value. This is useful for
  1799. // getting updates only after the object has changed since the last
  1800. // request. Use googleapi.IsNotModified to check whether the response
  1801. // error from Do is the result of In-None-Match.
  1802. func (c *CustomersListCall) IfNoneMatch(entityTag string) *CustomersListCall {
  1803. c.ifNoneMatch_ = entityTag
  1804. return c
  1805. }
  1806. // Context sets the context to be used in this call's Do method. Any
  1807. // pending HTTP request will be aborted if the provided context is
  1808. // canceled.
  1809. func (c *CustomersListCall) Context(ctx context.Context) *CustomersListCall {
  1810. c.ctx_ = ctx
  1811. return c
  1812. }
  1813. // Header returns an http.Header that can be modified by the caller to
  1814. // add HTTP headers to the request.
  1815. func (c *CustomersListCall) Header() http.Header {
  1816. if c.header_ == nil {
  1817. c.header_ = make(http.Header)
  1818. }
  1819. return c.header_
  1820. }
  1821. func (c *CustomersListCall) doRequest(alt string) (*http.Response, error) {
  1822. reqHeaders := make(http.Header)
  1823. for k, v := range c.header_ {
  1824. reqHeaders[k] = v
  1825. }
  1826. reqHeaders.Set("User-Agent", c.s.userAgent())
  1827. if c.ifNoneMatch_ != "" {
  1828. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1829. }
  1830. var body io.Reader = nil
  1831. c.urlParams_.Set("alt", alt)
  1832. c.urlParams_.Set("prettyPrint", "false")
  1833. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/customers")
  1834. urls += "?" + c.urlParams_.Encode()
  1835. req, err := http.NewRequest("GET", urls, body)
  1836. if err != nil {
  1837. return nil, err
  1838. }
  1839. req.Header = reqHeaders
  1840. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1841. }
  1842. // Do executes the "androiddeviceprovisioning.customers.list" call.
  1843. // Exactly one of *CustomerListCustomersResponse or error will be
  1844. // non-nil. Any non-2xx status code is an error. Response headers are in
  1845. // either *CustomerListCustomersResponse.ServerResponse.Header or (if a
  1846. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1847. // googleapi.IsNotModified to check whether the returned error was
  1848. // because http.StatusNotModified was returned.
  1849. func (c *CustomersListCall) Do(opts ...googleapi.CallOption) (*CustomerListCustomersResponse, error) {
  1850. gensupport.SetOptions(c.urlParams_, opts...)
  1851. res, err := c.doRequest("json")
  1852. if res != nil && res.StatusCode == http.StatusNotModified {
  1853. if res.Body != nil {
  1854. res.Body.Close()
  1855. }
  1856. return nil, &googleapi.Error{
  1857. Code: res.StatusCode,
  1858. Header: res.Header,
  1859. }
  1860. }
  1861. if err != nil {
  1862. return nil, err
  1863. }
  1864. defer googleapi.CloseBody(res)
  1865. if err := googleapi.CheckResponse(res); err != nil {
  1866. return nil, err
  1867. }
  1868. ret := &CustomerListCustomersResponse{
  1869. ServerResponse: googleapi.ServerResponse{
  1870. Header: res.Header,
  1871. HTTPStatusCode: res.StatusCode,
  1872. },
  1873. }
  1874. target := &ret
  1875. if err := gensupport.DecodeResponse(target, res); err != nil {
  1876. return nil, err
  1877. }
  1878. return ret, nil
  1879. // {
  1880. // "description": "Lists the user's customer accounts.",
  1881. // "flatPath": "v1/customers",
  1882. // "httpMethod": "GET",
  1883. // "id": "androiddeviceprovisioning.customers.list",
  1884. // "parameterOrder": [],
  1885. // "parameters": {
  1886. // "pageSize": {
  1887. // "description": "The maximum number of customers to show in a page of results.\nA number between 1 and 100 (inclusive).",
  1888. // "format": "int32",
  1889. // "location": "query",
  1890. // "type": "integer"
  1891. // },
  1892. // "pageToken": {
  1893. // "description": "A token specifying which result page to return.",
  1894. // "location": "query",
  1895. // "type": "string"
  1896. // }
  1897. // },
  1898. // "path": "v1/customers",
  1899. // "response": {
  1900. // "$ref": "CustomerListCustomersResponse"
  1901. // }
  1902. // }
  1903. }
  1904. // Pages invokes f for each page of results.
  1905. // A non-nil error returned from f will halt the iteration.
  1906. // The provided context supersedes any context provided to the Context method.
  1907. func (c *CustomersListCall) Pages(ctx context.Context, f func(*CustomerListCustomersResponse) error) error {
  1908. c.ctx_ = ctx
  1909. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1910. for {
  1911. x, err := c.Do()
  1912. if err != nil {
  1913. return err
  1914. }
  1915. if err := f(x); err != nil {
  1916. return err
  1917. }
  1918. if x.NextPageToken == "" {
  1919. return nil
  1920. }
  1921. c.PageToken(x.NextPageToken)
  1922. }
  1923. }
  1924. // method id "androiddeviceprovisioning.customers.configurations.create":
  1925. type CustomersConfigurationsCreateCall struct {
  1926. s *Service
  1927. parent string
  1928. configuration *Configuration
  1929. urlParams_ gensupport.URLParams
  1930. ctx_ context.Context
  1931. header_ http.Header
  1932. }
  1933. // Create: Creates a new configuration. Once created, a customer can
  1934. // apply the
  1935. // configuration to devices.
  1936. func (r *CustomersConfigurationsService) Create(parent string, configuration *Configuration) *CustomersConfigurationsCreateCall {
  1937. c := &CustomersConfigurationsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1938. c.parent = parent
  1939. c.configuration = configuration
  1940. return c
  1941. }
  1942. // Fields allows partial responses to be retrieved. See
  1943. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1944. // for more information.
  1945. func (c *CustomersConfigurationsCreateCall) Fields(s ...googleapi.Field) *CustomersConfigurationsCreateCall {
  1946. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1947. return c
  1948. }
  1949. // Context sets the context to be used in this call's Do method. Any
  1950. // pending HTTP request will be aborted if the provided context is
  1951. // canceled.
  1952. func (c *CustomersConfigurationsCreateCall) Context(ctx context.Context) *CustomersConfigurationsCreateCall {
  1953. c.ctx_ = ctx
  1954. return c
  1955. }
  1956. // Header returns an http.Header that can be modified by the caller to
  1957. // add HTTP headers to the request.
  1958. func (c *CustomersConfigurationsCreateCall) Header() http.Header {
  1959. if c.header_ == nil {
  1960. c.header_ = make(http.Header)
  1961. }
  1962. return c.header_
  1963. }
  1964. func (c *CustomersConfigurationsCreateCall) doRequest(alt string) (*http.Response, error) {
  1965. reqHeaders := make(http.Header)
  1966. for k, v := range c.header_ {
  1967. reqHeaders[k] = v
  1968. }
  1969. reqHeaders.Set("User-Agent", c.s.userAgent())
  1970. var body io.Reader = nil
  1971. body, err := googleapi.WithoutDataWrapper.JSONReader(c.configuration)
  1972. if err != nil {
  1973. return nil, err
  1974. }
  1975. reqHeaders.Set("Content-Type", "application/json")
  1976. c.urlParams_.Set("alt", alt)
  1977. c.urlParams_.Set("prettyPrint", "false")
  1978. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/configurations")
  1979. urls += "?" + c.urlParams_.Encode()
  1980. req, err := http.NewRequest("POST", urls, body)
  1981. if err != nil {
  1982. return nil, err
  1983. }
  1984. req.Header = reqHeaders
  1985. googleapi.Expand(req.URL, map[string]string{
  1986. "parent": c.parent,
  1987. })
  1988. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1989. }
  1990. // Do executes the "androiddeviceprovisioning.customers.configurations.create" call.
  1991. // Exactly one of *Configuration or error will be non-nil. Any non-2xx
  1992. // status code is an error. Response headers are in either
  1993. // *Configuration.ServerResponse.Header or (if a response was returned
  1994. // at all) in error.(*googleapi.Error).Header. Use
  1995. // googleapi.IsNotModified to check whether the returned error was
  1996. // because http.StatusNotModified was returned.
  1997. func (c *CustomersConfigurationsCreateCall) Do(opts ...googleapi.CallOption) (*Configuration, error) {
  1998. gensupport.SetOptions(c.urlParams_, opts...)
  1999. res, err := c.doRequest("json")
  2000. if res != nil && res.StatusCode == http.StatusNotModified {
  2001. if res.Body != nil {
  2002. res.Body.Close()
  2003. }
  2004. return nil, &googleapi.Error{
  2005. Code: res.StatusCode,
  2006. Header: res.Header,
  2007. }
  2008. }
  2009. if err != nil {
  2010. return nil, err
  2011. }
  2012. defer googleapi.CloseBody(res)
  2013. if err := googleapi.CheckResponse(res); err != nil {
  2014. return nil, err
  2015. }
  2016. ret := &Configuration{
  2017. ServerResponse: googleapi.ServerResponse{
  2018. Header: res.Header,
  2019. HTTPStatusCode: res.StatusCode,
  2020. },
  2021. }
  2022. target := &ret
  2023. if err := gensupport.DecodeResponse(target, res); err != nil {
  2024. return nil, err
  2025. }
  2026. return ret, nil
  2027. // {
  2028. // "description": "Creates a new configuration. Once created, a customer can apply the\nconfiguration to devices.",
  2029. // "flatPath": "v1/customers/{customersId}/configurations",
  2030. // "httpMethod": "POST",
  2031. // "id": "androiddeviceprovisioning.customers.configurations.create",
  2032. // "parameterOrder": [
  2033. // "parent"
  2034. // ],
  2035. // "parameters": {
  2036. // "parent": {
  2037. // "description": "Required. The customer that manages the configuration. An API resource name\nin the format `customers/[CUSTOMER_ID]`.",
  2038. // "location": "path",
  2039. // "pattern": "^customers/[^/]+$",
  2040. // "required": true,
  2041. // "type": "string"
  2042. // }
  2043. // },
  2044. // "path": "v1/{+parent}/configurations",
  2045. // "request": {
  2046. // "$ref": "Configuration"
  2047. // },
  2048. // "response": {
  2049. // "$ref": "Configuration"
  2050. // }
  2051. // }
  2052. }
  2053. // method id "androiddeviceprovisioning.customers.configurations.delete":
  2054. type CustomersConfigurationsDeleteCall struct {
  2055. s *Service
  2056. name string
  2057. urlParams_ gensupport.URLParams
  2058. ctx_ context.Context
  2059. header_ http.Header
  2060. }
  2061. // Delete: Deletes an unused configuration. The API call fails if the
  2062. // customer has
  2063. // devices with the configuration applied.
  2064. func (r *CustomersConfigurationsService) Delete(name string) *CustomersConfigurationsDeleteCall {
  2065. c := &CustomersConfigurationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2066. c.name = name
  2067. return c
  2068. }
  2069. // Fields allows partial responses to be retrieved. See
  2070. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2071. // for more information.
  2072. func (c *CustomersConfigurationsDeleteCall) Fields(s ...googleapi.Field) *CustomersConfigurationsDeleteCall {
  2073. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2074. return c
  2075. }
  2076. // Context sets the context to be used in this call's Do method. Any
  2077. // pending HTTP request will be aborted if the provided context is
  2078. // canceled.
  2079. func (c *CustomersConfigurationsDeleteCall) Context(ctx context.Context) *CustomersConfigurationsDeleteCall {
  2080. c.ctx_ = ctx
  2081. return c
  2082. }
  2083. // Header returns an http.Header that can be modified by the caller to
  2084. // add HTTP headers to the request.
  2085. func (c *CustomersConfigurationsDeleteCall) Header() http.Header {
  2086. if c.header_ == nil {
  2087. c.header_ = make(http.Header)
  2088. }
  2089. return c.header_
  2090. }
  2091. func (c *CustomersConfigurationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2092. reqHeaders := make(http.Header)
  2093. for k, v := range c.header_ {
  2094. reqHeaders[k] = v
  2095. }
  2096. reqHeaders.Set("User-Agent", c.s.userAgent())
  2097. var body io.Reader = nil
  2098. c.urlParams_.Set("alt", alt)
  2099. c.urlParams_.Set("prettyPrint", "false")
  2100. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2101. urls += "?" + c.urlParams_.Encode()
  2102. req, err := http.NewRequest("DELETE", urls, body)
  2103. if err != nil {
  2104. return nil, err
  2105. }
  2106. req.Header = reqHeaders
  2107. googleapi.Expand(req.URL, map[string]string{
  2108. "name": c.name,
  2109. })
  2110. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2111. }
  2112. // Do executes the "androiddeviceprovisioning.customers.configurations.delete" call.
  2113. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2114. // code is an error. Response headers are in either
  2115. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2116. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2117. // check whether the returned error was because http.StatusNotModified
  2118. // was returned.
  2119. func (c *CustomersConfigurationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2120. gensupport.SetOptions(c.urlParams_, opts...)
  2121. res, err := c.doRequest("json")
  2122. if res != nil && res.StatusCode == http.StatusNotModified {
  2123. if res.Body != nil {
  2124. res.Body.Close()
  2125. }
  2126. return nil, &googleapi.Error{
  2127. Code: res.StatusCode,
  2128. Header: res.Header,
  2129. }
  2130. }
  2131. if err != nil {
  2132. return nil, err
  2133. }
  2134. defer googleapi.CloseBody(res)
  2135. if err := googleapi.CheckResponse(res); err != nil {
  2136. return nil, err
  2137. }
  2138. ret := &Empty{
  2139. ServerResponse: googleapi.ServerResponse{
  2140. Header: res.Header,
  2141. HTTPStatusCode: res.StatusCode,
  2142. },
  2143. }
  2144. target := &ret
  2145. if err := gensupport.DecodeResponse(target, res); err != nil {
  2146. return nil, err
  2147. }
  2148. return ret, nil
  2149. // {
  2150. // "description": "Deletes an unused configuration. The API call fails if the customer has\ndevices with the configuration applied.",
  2151. // "flatPath": "v1/customers/{customersId}/configurations/{configurationsId}",
  2152. // "httpMethod": "DELETE",
  2153. // "id": "androiddeviceprovisioning.customers.configurations.delete",
  2154. // "parameterOrder": [
  2155. // "name"
  2156. // ],
  2157. // "parameters": {
  2158. // "name": {
  2159. // "description": "Required. The configuration to delete. An API resource name in the format\n`customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`. If the\nconfiguration is applied to any devices, the API call fails.",
  2160. // "location": "path",
  2161. // "pattern": "^customers/[^/]+/configurations/[^/]+$",
  2162. // "required": true,
  2163. // "type": "string"
  2164. // }
  2165. // },
  2166. // "path": "v1/{+name}",
  2167. // "response": {
  2168. // "$ref": "Empty"
  2169. // }
  2170. // }
  2171. }
  2172. // method id "androiddeviceprovisioning.customers.configurations.get":
  2173. type CustomersConfigurationsGetCall struct {
  2174. s *Service
  2175. name string
  2176. urlParams_ gensupport.URLParams
  2177. ifNoneMatch_ string
  2178. ctx_ context.Context
  2179. header_ http.Header
  2180. }
  2181. // Get: Gets the details of a configuration.
  2182. func (r *CustomersConfigurationsService) Get(name string) *CustomersConfigurationsGetCall {
  2183. c := &CustomersConfigurationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2184. c.name = name
  2185. return c
  2186. }
  2187. // Fields allows partial responses to be retrieved. See
  2188. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2189. // for more information.
  2190. func (c *CustomersConfigurationsGetCall) Fields(s ...googleapi.Field) *CustomersConfigurationsGetCall {
  2191. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2192. return c
  2193. }
  2194. // IfNoneMatch sets the optional parameter which makes the operation
  2195. // fail if the object's ETag matches the given value. This is useful for
  2196. // getting updates only after the object has changed since the last
  2197. // request. Use googleapi.IsNotModified to check whether the response
  2198. // error from Do is the result of In-None-Match.
  2199. func (c *CustomersConfigurationsGetCall) IfNoneMatch(entityTag string) *CustomersConfigurationsGetCall {
  2200. c.ifNoneMatch_ = entityTag
  2201. return c
  2202. }
  2203. // Context sets the context to be used in this call's Do method. Any
  2204. // pending HTTP request will be aborted if the provided context is
  2205. // canceled.
  2206. func (c *CustomersConfigurationsGetCall) Context(ctx context.Context) *CustomersConfigurationsGetCall {
  2207. c.ctx_ = ctx
  2208. return c
  2209. }
  2210. // Header returns an http.Header that can be modified by the caller to
  2211. // add HTTP headers to the request.
  2212. func (c *CustomersConfigurationsGetCall) Header() http.Header {
  2213. if c.header_ == nil {
  2214. c.header_ = make(http.Header)
  2215. }
  2216. return c.header_
  2217. }
  2218. func (c *CustomersConfigurationsGetCall) doRequest(alt string) (*http.Response, error) {
  2219. reqHeaders := make(http.Header)
  2220. for k, v := range c.header_ {
  2221. reqHeaders[k] = v
  2222. }
  2223. reqHeaders.Set("User-Agent", c.s.userAgent())
  2224. if c.ifNoneMatch_ != "" {
  2225. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2226. }
  2227. var body io.Reader = nil
  2228. c.urlParams_.Set("alt", alt)
  2229. c.urlParams_.Set("prettyPrint", "false")
  2230. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2231. urls += "?" + c.urlParams_.Encode()
  2232. req, err := http.NewRequest("GET", urls, body)
  2233. if err != nil {
  2234. return nil, err
  2235. }
  2236. req.Header = reqHeaders
  2237. googleapi.Expand(req.URL, map[string]string{
  2238. "name": c.name,
  2239. })
  2240. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2241. }
  2242. // Do executes the "androiddeviceprovisioning.customers.configurations.get" call.
  2243. // Exactly one of *Configuration or error will be non-nil. Any non-2xx
  2244. // status code is an error. Response headers are in either
  2245. // *Configuration.ServerResponse.Header or (if a response was returned
  2246. // at all) in error.(*googleapi.Error).Header. Use
  2247. // googleapi.IsNotModified to check whether the returned error was
  2248. // because http.StatusNotModified was returned.
  2249. func (c *CustomersConfigurationsGetCall) Do(opts ...googleapi.CallOption) (*Configuration, error) {
  2250. gensupport.SetOptions(c.urlParams_, opts...)
  2251. res, err := c.doRequest("json")
  2252. if res != nil && res.StatusCode == http.StatusNotModified {
  2253. if res.Body != nil {
  2254. res.Body.Close()
  2255. }
  2256. return nil, &googleapi.Error{
  2257. Code: res.StatusCode,
  2258. Header: res.Header,
  2259. }
  2260. }
  2261. if err != nil {
  2262. return nil, err
  2263. }
  2264. defer googleapi.CloseBody(res)
  2265. if err := googleapi.CheckResponse(res); err != nil {
  2266. return nil, err
  2267. }
  2268. ret := &Configuration{
  2269. ServerResponse: googleapi.ServerResponse{
  2270. Header: res.Header,
  2271. HTTPStatusCode: res.StatusCode,
  2272. },
  2273. }
  2274. target := &ret
  2275. if err := gensupport.DecodeResponse(target, res); err != nil {
  2276. return nil, err
  2277. }
  2278. return ret, nil
  2279. // {
  2280. // "description": "Gets the details of a configuration.",
  2281. // "flatPath": "v1/customers/{customersId}/configurations/{configurationsId}",
  2282. // "httpMethod": "GET",
  2283. // "id": "androiddeviceprovisioning.customers.configurations.get",
  2284. // "parameterOrder": [
  2285. // "name"
  2286. // ],
  2287. // "parameters": {
  2288. // "name": {
  2289. // "description": "Required. The configuration to get. An API resource name in the format\n`customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`.",
  2290. // "location": "path",
  2291. // "pattern": "^customers/[^/]+/configurations/[^/]+$",
  2292. // "required": true,
  2293. // "type": "string"
  2294. // }
  2295. // },
  2296. // "path": "v1/{+name}",
  2297. // "response": {
  2298. // "$ref": "Configuration"
  2299. // }
  2300. // }
  2301. }
  2302. // method id "androiddeviceprovisioning.customers.configurations.list":
  2303. type CustomersConfigurationsListCall struct {
  2304. s *Service
  2305. parent string
  2306. urlParams_ gensupport.URLParams
  2307. ifNoneMatch_ string
  2308. ctx_ context.Context
  2309. header_ http.Header
  2310. }
  2311. // List: Lists a customer's configurations.
  2312. func (r *CustomersConfigurationsService) List(parent string) *CustomersConfigurationsListCall {
  2313. c := &CustomersConfigurationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2314. c.parent = parent
  2315. return c
  2316. }
  2317. // Fields allows partial responses to be retrieved. See
  2318. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2319. // for more information.
  2320. func (c *CustomersConfigurationsListCall) Fields(s ...googleapi.Field) *CustomersConfigurationsListCall {
  2321. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2322. return c
  2323. }
  2324. // IfNoneMatch sets the optional parameter which makes the operation
  2325. // fail if the object's ETag matches the given value. This is useful for
  2326. // getting updates only after the object has changed since the last
  2327. // request. Use googleapi.IsNotModified to check whether the response
  2328. // error from Do is the result of In-None-Match.
  2329. func (c *CustomersConfigurationsListCall) IfNoneMatch(entityTag string) *CustomersConfigurationsListCall {
  2330. c.ifNoneMatch_ = entityTag
  2331. return c
  2332. }
  2333. // Context sets the context to be used in this call's Do method. Any
  2334. // pending HTTP request will be aborted if the provided context is
  2335. // canceled.
  2336. func (c *CustomersConfigurationsListCall) Context(ctx context.Context) *CustomersConfigurationsListCall {
  2337. c.ctx_ = ctx
  2338. return c
  2339. }
  2340. // Header returns an http.Header that can be modified by the caller to
  2341. // add HTTP headers to the request.
  2342. func (c *CustomersConfigurationsListCall) Header() http.Header {
  2343. if c.header_ == nil {
  2344. c.header_ = make(http.Header)
  2345. }
  2346. return c.header_
  2347. }
  2348. func (c *CustomersConfigurationsListCall) doRequest(alt string) (*http.Response, error) {
  2349. reqHeaders := make(http.Header)
  2350. for k, v := range c.header_ {
  2351. reqHeaders[k] = v
  2352. }
  2353. reqHeaders.Set("User-Agent", c.s.userAgent())
  2354. if c.ifNoneMatch_ != "" {
  2355. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2356. }
  2357. var body io.Reader = nil
  2358. c.urlParams_.Set("alt", alt)
  2359. c.urlParams_.Set("prettyPrint", "false")
  2360. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/configurations")
  2361. urls += "?" + c.urlParams_.Encode()
  2362. req, err := http.NewRequest("GET", urls, body)
  2363. if err != nil {
  2364. return nil, err
  2365. }
  2366. req.Header = reqHeaders
  2367. googleapi.Expand(req.URL, map[string]string{
  2368. "parent": c.parent,
  2369. })
  2370. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2371. }
  2372. // Do executes the "androiddeviceprovisioning.customers.configurations.list" call.
  2373. // Exactly one of *CustomerListConfigurationsResponse or error will be
  2374. // non-nil. Any non-2xx status code is an error. Response headers are in
  2375. // either *CustomerListConfigurationsResponse.ServerResponse.Header or
  2376. // (if a response was returned at all) in
  2377. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2378. // whether the returned error was because http.StatusNotModified was
  2379. // returned.
  2380. func (c *CustomersConfigurationsListCall) Do(opts ...googleapi.CallOption) (*CustomerListConfigurationsResponse, error) {
  2381. gensupport.SetOptions(c.urlParams_, opts...)
  2382. res, err := c.doRequest("json")
  2383. if res != nil && res.StatusCode == http.StatusNotModified {
  2384. if res.Body != nil {
  2385. res.Body.Close()
  2386. }
  2387. return nil, &googleapi.Error{
  2388. Code: res.StatusCode,
  2389. Header: res.Header,
  2390. }
  2391. }
  2392. if err != nil {
  2393. return nil, err
  2394. }
  2395. defer googleapi.CloseBody(res)
  2396. if err := googleapi.CheckResponse(res); err != nil {
  2397. return nil, err
  2398. }
  2399. ret := &CustomerListConfigurationsResponse{
  2400. ServerResponse: googleapi.ServerResponse{
  2401. Header: res.Header,
  2402. HTTPStatusCode: res.StatusCode,
  2403. },
  2404. }
  2405. target := &ret
  2406. if err := gensupport.DecodeResponse(target, res); err != nil {
  2407. return nil, err
  2408. }
  2409. return ret, nil
  2410. // {
  2411. // "description": "Lists a customer's configurations.",
  2412. // "flatPath": "v1/customers/{customersId}/configurations",
  2413. // "httpMethod": "GET",
  2414. // "id": "androiddeviceprovisioning.customers.configurations.list",
  2415. // "parameterOrder": [
  2416. // "parent"
  2417. // ],
  2418. // "parameters": {
  2419. // "parent": {
  2420. // "description": "Required. The customer that manages the listed configurations. An API\nresource name in the format `customers/[CUSTOMER_ID]`.",
  2421. // "location": "path",
  2422. // "pattern": "^customers/[^/]+$",
  2423. // "required": true,
  2424. // "type": "string"
  2425. // }
  2426. // },
  2427. // "path": "v1/{+parent}/configurations",
  2428. // "response": {
  2429. // "$ref": "CustomerListConfigurationsResponse"
  2430. // }
  2431. // }
  2432. }
  2433. // method id "androiddeviceprovisioning.customers.configurations.patch":
  2434. type CustomersConfigurationsPatchCall struct {
  2435. s *Service
  2436. name string
  2437. configuration *Configuration
  2438. urlParams_ gensupport.URLParams
  2439. ctx_ context.Context
  2440. header_ http.Header
  2441. }
  2442. // Patch: Updates a configuration's field values.
  2443. func (r *CustomersConfigurationsService) Patch(name string, configuration *Configuration) *CustomersConfigurationsPatchCall {
  2444. c := &CustomersConfigurationsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2445. c.name = name
  2446. c.configuration = configuration
  2447. return c
  2448. }
  2449. // UpdateMask sets the optional parameter "updateMask": Required. The
  2450. // field mask applied to the target `Configuration` before
  2451. // updating the fields. To learn more about using field masks,
  2452. // read
  2453. // [FieldMask](/protocol-buffers/docs/reference/google.protobuf#fiel
  2454. // dmask) in
  2455. // the Protocol Buffers documentation.
  2456. func (c *CustomersConfigurationsPatchCall) UpdateMask(updateMask string) *CustomersConfigurationsPatchCall {
  2457. c.urlParams_.Set("updateMask", updateMask)
  2458. return c
  2459. }
  2460. // Fields allows partial responses to be retrieved. See
  2461. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2462. // for more information.
  2463. func (c *CustomersConfigurationsPatchCall) Fields(s ...googleapi.Field) *CustomersConfigurationsPatchCall {
  2464. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2465. return c
  2466. }
  2467. // Context sets the context to be used in this call's Do method. Any
  2468. // pending HTTP request will be aborted if the provided context is
  2469. // canceled.
  2470. func (c *CustomersConfigurationsPatchCall) Context(ctx context.Context) *CustomersConfigurationsPatchCall {
  2471. c.ctx_ = ctx
  2472. return c
  2473. }
  2474. // Header returns an http.Header that can be modified by the caller to
  2475. // add HTTP headers to the request.
  2476. func (c *CustomersConfigurationsPatchCall) Header() http.Header {
  2477. if c.header_ == nil {
  2478. c.header_ = make(http.Header)
  2479. }
  2480. return c.header_
  2481. }
  2482. func (c *CustomersConfigurationsPatchCall) doRequest(alt string) (*http.Response, error) {
  2483. reqHeaders := make(http.Header)
  2484. for k, v := range c.header_ {
  2485. reqHeaders[k] = v
  2486. }
  2487. reqHeaders.Set("User-Agent", c.s.userAgent())
  2488. var body io.Reader = nil
  2489. body, err := googleapi.WithoutDataWrapper.JSONReader(c.configuration)
  2490. if err != nil {
  2491. return nil, err
  2492. }
  2493. reqHeaders.Set("Content-Type", "application/json")
  2494. c.urlParams_.Set("alt", alt)
  2495. c.urlParams_.Set("prettyPrint", "false")
  2496. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2497. urls += "?" + c.urlParams_.Encode()
  2498. req, err := http.NewRequest("PATCH", urls, body)
  2499. if err != nil {
  2500. return nil, err
  2501. }
  2502. req.Header = reqHeaders
  2503. googleapi.Expand(req.URL, map[string]string{
  2504. "name": c.name,
  2505. })
  2506. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2507. }
  2508. // Do executes the "androiddeviceprovisioning.customers.configurations.patch" call.
  2509. // Exactly one of *Configuration or error will be non-nil. Any non-2xx
  2510. // status code is an error. Response headers are in either
  2511. // *Configuration.ServerResponse.Header or (if a response was returned
  2512. // at all) in error.(*googleapi.Error).Header. Use
  2513. // googleapi.IsNotModified to check whether the returned error was
  2514. // because http.StatusNotModified was returned.
  2515. func (c *CustomersConfigurationsPatchCall) Do(opts ...googleapi.CallOption) (*Configuration, error) {
  2516. gensupport.SetOptions(c.urlParams_, opts...)
  2517. res, err := c.doRequest("json")
  2518. if res != nil && res.StatusCode == http.StatusNotModified {
  2519. if res.Body != nil {
  2520. res.Body.Close()
  2521. }
  2522. return nil, &googleapi.Error{
  2523. Code: res.StatusCode,
  2524. Header: res.Header,
  2525. }
  2526. }
  2527. if err != nil {
  2528. return nil, err
  2529. }
  2530. defer googleapi.CloseBody(res)
  2531. if err := googleapi.CheckResponse(res); err != nil {
  2532. return nil, err
  2533. }
  2534. ret := &Configuration{
  2535. ServerResponse: googleapi.ServerResponse{
  2536. Header: res.Header,
  2537. HTTPStatusCode: res.StatusCode,
  2538. },
  2539. }
  2540. target := &ret
  2541. if err := gensupport.DecodeResponse(target, res); err != nil {
  2542. return nil, err
  2543. }
  2544. return ret, nil
  2545. // {
  2546. // "description": "Updates a configuration's field values.",
  2547. // "flatPath": "v1/customers/{customersId}/configurations/{configurationsId}",
  2548. // "httpMethod": "PATCH",
  2549. // "id": "androiddeviceprovisioning.customers.configurations.patch",
  2550. // "parameterOrder": [
  2551. // "name"
  2552. // ],
  2553. // "parameters": {
  2554. // "name": {
  2555. // "description": "Output only. The API resource name in the format\n`customers/[CUSTOMER_ID]/configurations/[CONFIGURATION_ID]`. Assigned by\nthe server.",
  2556. // "location": "path",
  2557. // "pattern": "^customers/[^/]+/configurations/[^/]+$",
  2558. // "required": true,
  2559. // "type": "string"
  2560. // },
  2561. // "updateMask": {
  2562. // "description": "Required. The field mask applied to the target `Configuration` before\nupdating the fields. To learn more about using field masks, read\n[FieldMask](/protocol-buffers/docs/reference/google.protobuf#fieldmask) in\nthe Protocol Buffers documentation.",
  2563. // "format": "google-fieldmask",
  2564. // "location": "query",
  2565. // "type": "string"
  2566. // }
  2567. // },
  2568. // "path": "v1/{+name}",
  2569. // "request": {
  2570. // "$ref": "Configuration"
  2571. // },
  2572. // "response": {
  2573. // "$ref": "Configuration"
  2574. // }
  2575. // }
  2576. }
  2577. // method id "androiddeviceprovisioning.customers.devices.applyConfiguration":
  2578. type CustomersDevicesApplyConfigurationCall struct {
  2579. s *Service
  2580. parent string
  2581. customerapplyconfigurationrequest *CustomerApplyConfigurationRequest
  2582. urlParams_ gensupport.URLParams
  2583. ctx_ context.Context
  2584. header_ http.Header
  2585. }
  2586. // ApplyConfiguration: Applies a Configuration to the device to register
  2587. // the device for zero-touch
  2588. // enrollment. After applying a configuration to a device, the
  2589. // device
  2590. // automatically provisions itself on first boot, or next factory reset.
  2591. func (r *CustomersDevicesService) ApplyConfiguration(parent string, customerapplyconfigurationrequest *CustomerApplyConfigurationRequest) *CustomersDevicesApplyConfigurationCall {
  2592. c := &CustomersDevicesApplyConfigurationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2593. c.parent = parent
  2594. c.customerapplyconfigurationrequest = customerapplyconfigurationrequest
  2595. return c
  2596. }
  2597. // Fields allows partial responses to be retrieved. See
  2598. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2599. // for more information.
  2600. func (c *CustomersDevicesApplyConfigurationCall) Fields(s ...googleapi.Field) *CustomersDevicesApplyConfigurationCall {
  2601. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2602. return c
  2603. }
  2604. // Context sets the context to be used in this call's Do method. Any
  2605. // pending HTTP request will be aborted if the provided context is
  2606. // canceled.
  2607. func (c *CustomersDevicesApplyConfigurationCall) Context(ctx context.Context) *CustomersDevicesApplyConfigurationCall {
  2608. c.ctx_ = ctx
  2609. return c
  2610. }
  2611. // Header returns an http.Header that can be modified by the caller to
  2612. // add HTTP headers to the request.
  2613. func (c *CustomersDevicesApplyConfigurationCall) Header() http.Header {
  2614. if c.header_ == nil {
  2615. c.header_ = make(http.Header)
  2616. }
  2617. return c.header_
  2618. }
  2619. func (c *CustomersDevicesApplyConfigurationCall) doRequest(alt string) (*http.Response, error) {
  2620. reqHeaders := make(http.Header)
  2621. for k, v := range c.header_ {
  2622. reqHeaders[k] = v
  2623. }
  2624. reqHeaders.Set("User-Agent", c.s.userAgent())
  2625. var body io.Reader = nil
  2626. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customerapplyconfigurationrequest)
  2627. if err != nil {
  2628. return nil, err
  2629. }
  2630. reqHeaders.Set("Content-Type", "application/json")
  2631. c.urlParams_.Set("alt", alt)
  2632. c.urlParams_.Set("prettyPrint", "false")
  2633. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices:applyConfiguration")
  2634. urls += "?" + c.urlParams_.Encode()
  2635. req, err := http.NewRequest("POST", urls, body)
  2636. if err != nil {
  2637. return nil, err
  2638. }
  2639. req.Header = reqHeaders
  2640. googleapi.Expand(req.URL, map[string]string{
  2641. "parent": c.parent,
  2642. })
  2643. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2644. }
  2645. // Do executes the "androiddeviceprovisioning.customers.devices.applyConfiguration" call.
  2646. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2647. // code is an error. Response headers are in either
  2648. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2649. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2650. // check whether the returned error was because http.StatusNotModified
  2651. // was returned.
  2652. func (c *CustomersDevicesApplyConfigurationCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2653. gensupport.SetOptions(c.urlParams_, opts...)
  2654. res, err := c.doRequest("json")
  2655. if res != nil && res.StatusCode == http.StatusNotModified {
  2656. if res.Body != nil {
  2657. res.Body.Close()
  2658. }
  2659. return nil, &googleapi.Error{
  2660. Code: res.StatusCode,
  2661. Header: res.Header,
  2662. }
  2663. }
  2664. if err != nil {
  2665. return nil, err
  2666. }
  2667. defer googleapi.CloseBody(res)
  2668. if err := googleapi.CheckResponse(res); err != nil {
  2669. return nil, err
  2670. }
  2671. ret := &Empty{
  2672. ServerResponse: googleapi.ServerResponse{
  2673. Header: res.Header,
  2674. HTTPStatusCode: res.StatusCode,
  2675. },
  2676. }
  2677. target := &ret
  2678. if err := gensupport.DecodeResponse(target, res); err != nil {
  2679. return nil, err
  2680. }
  2681. return ret, nil
  2682. // {
  2683. // "description": "Applies a Configuration to the device to register the device for zero-touch\nenrollment. After applying a configuration to a device, the device\nautomatically provisions itself on first boot, or next factory reset.",
  2684. // "flatPath": "v1/customers/{customersId}/devices:applyConfiguration",
  2685. // "httpMethod": "POST",
  2686. // "id": "androiddeviceprovisioning.customers.devices.applyConfiguration",
  2687. // "parameterOrder": [
  2688. // "parent"
  2689. // ],
  2690. // "parameters": {
  2691. // "parent": {
  2692. // "description": "Required. The customer managing the device. An API resource name in the\nformat `customers/[CUSTOMER_ID]`.",
  2693. // "location": "path",
  2694. // "pattern": "^customers/[^/]+$",
  2695. // "required": true,
  2696. // "type": "string"
  2697. // }
  2698. // },
  2699. // "path": "v1/{+parent}/devices:applyConfiguration",
  2700. // "request": {
  2701. // "$ref": "CustomerApplyConfigurationRequest"
  2702. // },
  2703. // "response": {
  2704. // "$ref": "Empty"
  2705. // }
  2706. // }
  2707. }
  2708. // method id "androiddeviceprovisioning.customers.devices.get":
  2709. type CustomersDevicesGetCall struct {
  2710. s *Service
  2711. name string
  2712. urlParams_ gensupport.URLParams
  2713. ifNoneMatch_ string
  2714. ctx_ context.Context
  2715. header_ http.Header
  2716. }
  2717. // Get: Gets the details of a device.
  2718. func (r *CustomersDevicesService) Get(name string) *CustomersDevicesGetCall {
  2719. c := &CustomersDevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2720. c.name = name
  2721. return c
  2722. }
  2723. // Fields allows partial responses to be retrieved. See
  2724. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2725. // for more information.
  2726. func (c *CustomersDevicesGetCall) Fields(s ...googleapi.Field) *CustomersDevicesGetCall {
  2727. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2728. return c
  2729. }
  2730. // IfNoneMatch sets the optional parameter which makes the operation
  2731. // fail if the object's ETag matches the given value. This is useful for
  2732. // getting updates only after the object has changed since the last
  2733. // request. Use googleapi.IsNotModified to check whether the response
  2734. // error from Do is the result of In-None-Match.
  2735. func (c *CustomersDevicesGetCall) IfNoneMatch(entityTag string) *CustomersDevicesGetCall {
  2736. c.ifNoneMatch_ = entityTag
  2737. return c
  2738. }
  2739. // Context sets the context to be used in this call's Do method. Any
  2740. // pending HTTP request will be aborted if the provided context is
  2741. // canceled.
  2742. func (c *CustomersDevicesGetCall) Context(ctx context.Context) *CustomersDevicesGetCall {
  2743. c.ctx_ = ctx
  2744. return c
  2745. }
  2746. // Header returns an http.Header that can be modified by the caller to
  2747. // add HTTP headers to the request.
  2748. func (c *CustomersDevicesGetCall) Header() http.Header {
  2749. if c.header_ == nil {
  2750. c.header_ = make(http.Header)
  2751. }
  2752. return c.header_
  2753. }
  2754. func (c *CustomersDevicesGetCall) doRequest(alt string) (*http.Response, error) {
  2755. reqHeaders := make(http.Header)
  2756. for k, v := range c.header_ {
  2757. reqHeaders[k] = v
  2758. }
  2759. reqHeaders.Set("User-Agent", c.s.userAgent())
  2760. if c.ifNoneMatch_ != "" {
  2761. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2762. }
  2763. var body io.Reader = nil
  2764. c.urlParams_.Set("alt", alt)
  2765. c.urlParams_.Set("prettyPrint", "false")
  2766. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2767. urls += "?" + c.urlParams_.Encode()
  2768. req, err := http.NewRequest("GET", urls, body)
  2769. if err != nil {
  2770. return nil, err
  2771. }
  2772. req.Header = reqHeaders
  2773. googleapi.Expand(req.URL, map[string]string{
  2774. "name": c.name,
  2775. })
  2776. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2777. }
  2778. // Do executes the "androiddeviceprovisioning.customers.devices.get" call.
  2779. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  2780. // code is an error. Response headers are in either
  2781. // *Device.ServerResponse.Header or (if a response was returned at all)
  2782. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2783. // check whether the returned error was because http.StatusNotModified
  2784. // was returned.
  2785. func (c *CustomersDevicesGetCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  2786. gensupport.SetOptions(c.urlParams_, opts...)
  2787. res, err := c.doRequest("json")
  2788. if res != nil && res.StatusCode == http.StatusNotModified {
  2789. if res.Body != nil {
  2790. res.Body.Close()
  2791. }
  2792. return nil, &googleapi.Error{
  2793. Code: res.StatusCode,
  2794. Header: res.Header,
  2795. }
  2796. }
  2797. if err != nil {
  2798. return nil, err
  2799. }
  2800. defer googleapi.CloseBody(res)
  2801. if err := googleapi.CheckResponse(res); err != nil {
  2802. return nil, err
  2803. }
  2804. ret := &Device{
  2805. ServerResponse: googleapi.ServerResponse{
  2806. Header: res.Header,
  2807. HTTPStatusCode: res.StatusCode,
  2808. },
  2809. }
  2810. target := &ret
  2811. if err := gensupport.DecodeResponse(target, res); err != nil {
  2812. return nil, err
  2813. }
  2814. return ret, nil
  2815. // {
  2816. // "description": "Gets the details of a device.",
  2817. // "flatPath": "v1/customers/{customersId}/devices/{devicesId}",
  2818. // "httpMethod": "GET",
  2819. // "id": "androiddeviceprovisioning.customers.devices.get",
  2820. // "parameterOrder": [
  2821. // "name"
  2822. // ],
  2823. // "parameters": {
  2824. // "name": {
  2825. // "description": "Required. The device to get. An API resource name in the format\n`customers/[CUSTOMER_ID]/devices/[DEVICE_ID]`.",
  2826. // "location": "path",
  2827. // "pattern": "^customers/[^/]+/devices/[^/]+$",
  2828. // "required": true,
  2829. // "type": "string"
  2830. // }
  2831. // },
  2832. // "path": "v1/{+name}",
  2833. // "response": {
  2834. // "$ref": "Device"
  2835. // }
  2836. // }
  2837. }
  2838. // method id "androiddeviceprovisioning.customers.devices.list":
  2839. type CustomersDevicesListCall struct {
  2840. s *Service
  2841. parent string
  2842. urlParams_ gensupport.URLParams
  2843. ifNoneMatch_ string
  2844. ctx_ context.Context
  2845. header_ http.Header
  2846. }
  2847. // List: Lists a customer's devices.
  2848. func (r *CustomersDevicesService) List(parent string) *CustomersDevicesListCall {
  2849. c := &CustomersDevicesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2850. c.parent = parent
  2851. return c
  2852. }
  2853. // PageSize sets the optional parameter "pageSize": The maximum number
  2854. // of devices to show in a page of results.
  2855. // Must be between 1 and 100 inclusive.
  2856. func (c *CustomersDevicesListCall) PageSize(pageSize int64) *CustomersDevicesListCall {
  2857. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2858. return c
  2859. }
  2860. // PageToken sets the optional parameter "pageToken": A token specifying
  2861. // which result page to return.
  2862. func (c *CustomersDevicesListCall) PageToken(pageToken string) *CustomersDevicesListCall {
  2863. c.urlParams_.Set("pageToken", pageToken)
  2864. return c
  2865. }
  2866. // Fields allows partial responses to be retrieved. See
  2867. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2868. // for more information.
  2869. func (c *CustomersDevicesListCall) Fields(s ...googleapi.Field) *CustomersDevicesListCall {
  2870. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2871. return c
  2872. }
  2873. // IfNoneMatch sets the optional parameter which makes the operation
  2874. // fail if the object's ETag matches the given value. This is useful for
  2875. // getting updates only after the object has changed since the last
  2876. // request. Use googleapi.IsNotModified to check whether the response
  2877. // error from Do is the result of In-None-Match.
  2878. func (c *CustomersDevicesListCall) IfNoneMatch(entityTag string) *CustomersDevicesListCall {
  2879. c.ifNoneMatch_ = entityTag
  2880. return c
  2881. }
  2882. // Context sets the context to be used in this call's Do method. Any
  2883. // pending HTTP request will be aborted if the provided context is
  2884. // canceled.
  2885. func (c *CustomersDevicesListCall) Context(ctx context.Context) *CustomersDevicesListCall {
  2886. c.ctx_ = ctx
  2887. return c
  2888. }
  2889. // Header returns an http.Header that can be modified by the caller to
  2890. // add HTTP headers to the request.
  2891. func (c *CustomersDevicesListCall) Header() http.Header {
  2892. if c.header_ == nil {
  2893. c.header_ = make(http.Header)
  2894. }
  2895. return c.header_
  2896. }
  2897. func (c *CustomersDevicesListCall) doRequest(alt string) (*http.Response, error) {
  2898. reqHeaders := make(http.Header)
  2899. for k, v := range c.header_ {
  2900. reqHeaders[k] = v
  2901. }
  2902. reqHeaders.Set("User-Agent", c.s.userAgent())
  2903. if c.ifNoneMatch_ != "" {
  2904. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2905. }
  2906. var body io.Reader = nil
  2907. c.urlParams_.Set("alt", alt)
  2908. c.urlParams_.Set("prettyPrint", "false")
  2909. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices")
  2910. urls += "?" + c.urlParams_.Encode()
  2911. req, err := http.NewRequest("GET", urls, body)
  2912. if err != nil {
  2913. return nil, err
  2914. }
  2915. req.Header = reqHeaders
  2916. googleapi.Expand(req.URL, map[string]string{
  2917. "parent": c.parent,
  2918. })
  2919. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2920. }
  2921. // Do executes the "androiddeviceprovisioning.customers.devices.list" call.
  2922. // Exactly one of *CustomerListDevicesResponse or error will be non-nil.
  2923. // Any non-2xx status code is an error. Response headers are in either
  2924. // *CustomerListDevicesResponse.ServerResponse.Header or (if a response
  2925. // was returned at all) in error.(*googleapi.Error).Header. Use
  2926. // googleapi.IsNotModified to check whether the returned error was
  2927. // because http.StatusNotModified was returned.
  2928. func (c *CustomersDevicesListCall) Do(opts ...googleapi.CallOption) (*CustomerListDevicesResponse, error) {
  2929. gensupport.SetOptions(c.urlParams_, opts...)
  2930. res, err := c.doRequest("json")
  2931. if res != nil && res.StatusCode == http.StatusNotModified {
  2932. if res.Body != nil {
  2933. res.Body.Close()
  2934. }
  2935. return nil, &googleapi.Error{
  2936. Code: res.StatusCode,
  2937. Header: res.Header,
  2938. }
  2939. }
  2940. if err != nil {
  2941. return nil, err
  2942. }
  2943. defer googleapi.CloseBody(res)
  2944. if err := googleapi.CheckResponse(res); err != nil {
  2945. return nil, err
  2946. }
  2947. ret := &CustomerListDevicesResponse{
  2948. ServerResponse: googleapi.ServerResponse{
  2949. Header: res.Header,
  2950. HTTPStatusCode: res.StatusCode,
  2951. },
  2952. }
  2953. target := &ret
  2954. if err := gensupport.DecodeResponse(target, res); err != nil {
  2955. return nil, err
  2956. }
  2957. return ret, nil
  2958. // {
  2959. // "description": "Lists a customer's devices.",
  2960. // "flatPath": "v1/customers/{customersId}/devices",
  2961. // "httpMethod": "GET",
  2962. // "id": "androiddeviceprovisioning.customers.devices.list",
  2963. // "parameterOrder": [
  2964. // "parent"
  2965. // ],
  2966. // "parameters": {
  2967. // "pageSize": {
  2968. // "description": "The maximum number of devices to show in a page of results.\nMust be between 1 and 100 inclusive.",
  2969. // "format": "int64",
  2970. // "location": "query",
  2971. // "type": "string"
  2972. // },
  2973. // "pageToken": {
  2974. // "description": "A token specifying which result page to return.",
  2975. // "location": "query",
  2976. // "type": "string"
  2977. // },
  2978. // "parent": {
  2979. // "description": "Required. The customer managing the devices. An API resource name in the\nformat `customers/[CUSTOMER_ID]`.",
  2980. // "location": "path",
  2981. // "pattern": "^customers/[^/]+$",
  2982. // "required": true,
  2983. // "type": "string"
  2984. // }
  2985. // },
  2986. // "path": "v1/{+parent}/devices",
  2987. // "response": {
  2988. // "$ref": "CustomerListDevicesResponse"
  2989. // }
  2990. // }
  2991. }
  2992. // Pages invokes f for each page of results.
  2993. // A non-nil error returned from f will halt the iteration.
  2994. // The provided context supersedes any context provided to the Context method.
  2995. func (c *CustomersDevicesListCall) Pages(ctx context.Context, f func(*CustomerListDevicesResponse) error) error {
  2996. c.ctx_ = ctx
  2997. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2998. for {
  2999. x, err := c.Do()
  3000. if err != nil {
  3001. return err
  3002. }
  3003. if err := f(x); err != nil {
  3004. return err
  3005. }
  3006. if x.NextPageToken == "" {
  3007. return nil
  3008. }
  3009. c.PageToken(x.NextPageToken)
  3010. }
  3011. }
  3012. // method id "androiddeviceprovisioning.customers.devices.removeConfiguration":
  3013. type CustomersDevicesRemoveConfigurationCall struct {
  3014. s *Service
  3015. parent string
  3016. customerremoveconfigurationrequest *CustomerRemoveConfigurationRequest
  3017. urlParams_ gensupport.URLParams
  3018. ctx_ context.Context
  3019. header_ http.Header
  3020. }
  3021. // RemoveConfiguration: Removes a configuration from device.
  3022. func (r *CustomersDevicesService) RemoveConfiguration(parent string, customerremoveconfigurationrequest *CustomerRemoveConfigurationRequest) *CustomersDevicesRemoveConfigurationCall {
  3023. c := &CustomersDevicesRemoveConfigurationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3024. c.parent = parent
  3025. c.customerremoveconfigurationrequest = customerremoveconfigurationrequest
  3026. return c
  3027. }
  3028. // Fields allows partial responses to be retrieved. See
  3029. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3030. // for more information.
  3031. func (c *CustomersDevicesRemoveConfigurationCall) Fields(s ...googleapi.Field) *CustomersDevicesRemoveConfigurationCall {
  3032. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3033. return c
  3034. }
  3035. // Context sets the context to be used in this call's Do method. Any
  3036. // pending HTTP request will be aborted if the provided context is
  3037. // canceled.
  3038. func (c *CustomersDevicesRemoveConfigurationCall) Context(ctx context.Context) *CustomersDevicesRemoveConfigurationCall {
  3039. c.ctx_ = ctx
  3040. return c
  3041. }
  3042. // Header returns an http.Header that can be modified by the caller to
  3043. // add HTTP headers to the request.
  3044. func (c *CustomersDevicesRemoveConfigurationCall) Header() http.Header {
  3045. if c.header_ == nil {
  3046. c.header_ = make(http.Header)
  3047. }
  3048. return c.header_
  3049. }
  3050. func (c *CustomersDevicesRemoveConfigurationCall) doRequest(alt string) (*http.Response, error) {
  3051. reqHeaders := make(http.Header)
  3052. for k, v := range c.header_ {
  3053. reqHeaders[k] = v
  3054. }
  3055. reqHeaders.Set("User-Agent", c.s.userAgent())
  3056. var body io.Reader = nil
  3057. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customerremoveconfigurationrequest)
  3058. if err != nil {
  3059. return nil, err
  3060. }
  3061. reqHeaders.Set("Content-Type", "application/json")
  3062. c.urlParams_.Set("alt", alt)
  3063. c.urlParams_.Set("prettyPrint", "false")
  3064. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices:removeConfiguration")
  3065. urls += "?" + c.urlParams_.Encode()
  3066. req, err := http.NewRequest("POST", urls, body)
  3067. if err != nil {
  3068. return nil, err
  3069. }
  3070. req.Header = reqHeaders
  3071. googleapi.Expand(req.URL, map[string]string{
  3072. "parent": c.parent,
  3073. })
  3074. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3075. }
  3076. // Do executes the "androiddeviceprovisioning.customers.devices.removeConfiguration" call.
  3077. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3078. // code is an error. Response headers are in either
  3079. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3080. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3081. // check whether the returned error was because http.StatusNotModified
  3082. // was returned.
  3083. func (c *CustomersDevicesRemoveConfigurationCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3084. gensupport.SetOptions(c.urlParams_, opts...)
  3085. res, err := c.doRequest("json")
  3086. if res != nil && res.StatusCode == http.StatusNotModified {
  3087. if res.Body != nil {
  3088. res.Body.Close()
  3089. }
  3090. return nil, &googleapi.Error{
  3091. Code: res.StatusCode,
  3092. Header: res.Header,
  3093. }
  3094. }
  3095. if err != nil {
  3096. return nil, err
  3097. }
  3098. defer googleapi.CloseBody(res)
  3099. if err := googleapi.CheckResponse(res); err != nil {
  3100. return nil, err
  3101. }
  3102. ret := &Empty{
  3103. ServerResponse: googleapi.ServerResponse{
  3104. Header: res.Header,
  3105. HTTPStatusCode: res.StatusCode,
  3106. },
  3107. }
  3108. target := &ret
  3109. if err := gensupport.DecodeResponse(target, res); err != nil {
  3110. return nil, err
  3111. }
  3112. return ret, nil
  3113. // {
  3114. // "description": "Removes a configuration from device.",
  3115. // "flatPath": "v1/customers/{customersId}/devices:removeConfiguration",
  3116. // "httpMethod": "POST",
  3117. // "id": "androiddeviceprovisioning.customers.devices.removeConfiguration",
  3118. // "parameterOrder": [
  3119. // "parent"
  3120. // ],
  3121. // "parameters": {
  3122. // "parent": {
  3123. // "description": "Required. The customer managing the device in the format\n`customers/[CUSTOMER_ID]`.",
  3124. // "location": "path",
  3125. // "pattern": "^customers/[^/]+$",
  3126. // "required": true,
  3127. // "type": "string"
  3128. // }
  3129. // },
  3130. // "path": "v1/{+parent}/devices:removeConfiguration",
  3131. // "request": {
  3132. // "$ref": "CustomerRemoveConfigurationRequest"
  3133. // },
  3134. // "response": {
  3135. // "$ref": "Empty"
  3136. // }
  3137. // }
  3138. }
  3139. // method id "androiddeviceprovisioning.customers.devices.unclaim":
  3140. type CustomersDevicesUnclaimCall struct {
  3141. s *Service
  3142. parent string
  3143. customerunclaimdevicerequest *CustomerUnclaimDeviceRequest
  3144. urlParams_ gensupport.URLParams
  3145. ctx_ context.Context
  3146. header_ http.Header
  3147. }
  3148. // Unclaim: Unclaims a device from a customer and removes it from
  3149. // zero-touch
  3150. // enrollment.
  3151. //
  3152. // After removing a device, a customer must contact their reseller to
  3153. // register
  3154. // the device into zero-touch enrollment again.
  3155. func (r *CustomersDevicesService) Unclaim(parent string, customerunclaimdevicerequest *CustomerUnclaimDeviceRequest) *CustomersDevicesUnclaimCall {
  3156. c := &CustomersDevicesUnclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3157. c.parent = parent
  3158. c.customerunclaimdevicerequest = customerunclaimdevicerequest
  3159. return c
  3160. }
  3161. // Fields allows partial responses to be retrieved. See
  3162. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3163. // for more information.
  3164. func (c *CustomersDevicesUnclaimCall) Fields(s ...googleapi.Field) *CustomersDevicesUnclaimCall {
  3165. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3166. return c
  3167. }
  3168. // Context sets the context to be used in this call's Do method. Any
  3169. // pending HTTP request will be aborted if the provided context is
  3170. // canceled.
  3171. func (c *CustomersDevicesUnclaimCall) Context(ctx context.Context) *CustomersDevicesUnclaimCall {
  3172. c.ctx_ = ctx
  3173. return c
  3174. }
  3175. // Header returns an http.Header that can be modified by the caller to
  3176. // add HTTP headers to the request.
  3177. func (c *CustomersDevicesUnclaimCall) Header() http.Header {
  3178. if c.header_ == nil {
  3179. c.header_ = make(http.Header)
  3180. }
  3181. return c.header_
  3182. }
  3183. func (c *CustomersDevicesUnclaimCall) doRequest(alt string) (*http.Response, error) {
  3184. reqHeaders := make(http.Header)
  3185. for k, v := range c.header_ {
  3186. reqHeaders[k] = v
  3187. }
  3188. reqHeaders.Set("User-Agent", c.s.userAgent())
  3189. var body io.Reader = nil
  3190. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customerunclaimdevicerequest)
  3191. if err != nil {
  3192. return nil, err
  3193. }
  3194. reqHeaders.Set("Content-Type", "application/json")
  3195. c.urlParams_.Set("alt", alt)
  3196. c.urlParams_.Set("prettyPrint", "false")
  3197. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/devices:unclaim")
  3198. urls += "?" + c.urlParams_.Encode()
  3199. req, err := http.NewRequest("POST", urls, body)
  3200. if err != nil {
  3201. return nil, err
  3202. }
  3203. req.Header = reqHeaders
  3204. googleapi.Expand(req.URL, map[string]string{
  3205. "parent": c.parent,
  3206. })
  3207. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3208. }
  3209. // Do executes the "androiddeviceprovisioning.customers.devices.unclaim" call.
  3210. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3211. // code is an error. Response headers are in either
  3212. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3213. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3214. // check whether the returned error was because http.StatusNotModified
  3215. // was returned.
  3216. func (c *CustomersDevicesUnclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3217. gensupport.SetOptions(c.urlParams_, opts...)
  3218. res, err := c.doRequest("json")
  3219. if res != nil && res.StatusCode == http.StatusNotModified {
  3220. if res.Body != nil {
  3221. res.Body.Close()
  3222. }
  3223. return nil, &googleapi.Error{
  3224. Code: res.StatusCode,
  3225. Header: res.Header,
  3226. }
  3227. }
  3228. if err != nil {
  3229. return nil, err
  3230. }
  3231. defer googleapi.CloseBody(res)
  3232. if err := googleapi.CheckResponse(res); err != nil {
  3233. return nil, err
  3234. }
  3235. ret := &Empty{
  3236. ServerResponse: googleapi.ServerResponse{
  3237. Header: res.Header,
  3238. HTTPStatusCode: res.StatusCode,
  3239. },
  3240. }
  3241. target := &ret
  3242. if err := gensupport.DecodeResponse(target, res); err != nil {
  3243. return nil, err
  3244. }
  3245. return ret, nil
  3246. // {
  3247. // "description": "Unclaims a device from a customer and removes it from zero-touch\nenrollment.\n\nAfter removing a device, a customer must contact their reseller to register\nthe device into zero-touch enrollment again.",
  3248. // "flatPath": "v1/customers/{customersId}/devices:unclaim",
  3249. // "httpMethod": "POST",
  3250. // "id": "androiddeviceprovisioning.customers.devices.unclaim",
  3251. // "parameterOrder": [
  3252. // "parent"
  3253. // ],
  3254. // "parameters": {
  3255. // "parent": {
  3256. // "description": "Required. The customer managing the device. An API resource name in the\nformat `customers/[CUSTOMER_ID]`.",
  3257. // "location": "path",
  3258. // "pattern": "^customers/[^/]+$",
  3259. // "required": true,
  3260. // "type": "string"
  3261. // }
  3262. // },
  3263. // "path": "v1/{+parent}/devices:unclaim",
  3264. // "request": {
  3265. // "$ref": "CustomerUnclaimDeviceRequest"
  3266. // },
  3267. // "response": {
  3268. // "$ref": "Empty"
  3269. // }
  3270. // }
  3271. }
  3272. // method id "androiddeviceprovisioning.customers.dpcs.list":
  3273. type CustomersDpcsListCall struct {
  3274. s *Service
  3275. parent string
  3276. urlParams_ gensupport.URLParams
  3277. ifNoneMatch_ string
  3278. ctx_ context.Context
  3279. header_ http.Header
  3280. }
  3281. // List: Lists the DPCs (device policy controllers) that support
  3282. // zero-touch
  3283. // enrollment.
  3284. func (r *CustomersDpcsService) List(parent string) *CustomersDpcsListCall {
  3285. c := &CustomersDpcsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3286. c.parent = parent
  3287. return c
  3288. }
  3289. // Fields allows partial responses to be retrieved. See
  3290. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3291. // for more information.
  3292. func (c *CustomersDpcsListCall) Fields(s ...googleapi.Field) *CustomersDpcsListCall {
  3293. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3294. return c
  3295. }
  3296. // IfNoneMatch sets the optional parameter which makes the operation
  3297. // fail if the object's ETag matches the given value. This is useful for
  3298. // getting updates only after the object has changed since the last
  3299. // request. Use googleapi.IsNotModified to check whether the response
  3300. // error from Do is the result of In-None-Match.
  3301. func (c *CustomersDpcsListCall) IfNoneMatch(entityTag string) *CustomersDpcsListCall {
  3302. c.ifNoneMatch_ = entityTag
  3303. return c
  3304. }
  3305. // Context sets the context to be used in this call's Do method. Any
  3306. // pending HTTP request will be aborted if the provided context is
  3307. // canceled.
  3308. func (c *CustomersDpcsListCall) Context(ctx context.Context) *CustomersDpcsListCall {
  3309. c.ctx_ = ctx
  3310. return c
  3311. }
  3312. // Header returns an http.Header that can be modified by the caller to
  3313. // add HTTP headers to the request.
  3314. func (c *CustomersDpcsListCall) Header() http.Header {
  3315. if c.header_ == nil {
  3316. c.header_ = make(http.Header)
  3317. }
  3318. return c.header_
  3319. }
  3320. func (c *CustomersDpcsListCall) doRequest(alt string) (*http.Response, error) {
  3321. reqHeaders := make(http.Header)
  3322. for k, v := range c.header_ {
  3323. reqHeaders[k] = v
  3324. }
  3325. reqHeaders.Set("User-Agent", c.s.userAgent())
  3326. if c.ifNoneMatch_ != "" {
  3327. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3328. }
  3329. var body io.Reader = nil
  3330. c.urlParams_.Set("alt", alt)
  3331. c.urlParams_.Set("prettyPrint", "false")
  3332. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/dpcs")
  3333. urls += "?" + c.urlParams_.Encode()
  3334. req, err := http.NewRequest("GET", urls, body)
  3335. if err != nil {
  3336. return nil, err
  3337. }
  3338. req.Header = reqHeaders
  3339. googleapi.Expand(req.URL, map[string]string{
  3340. "parent": c.parent,
  3341. })
  3342. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3343. }
  3344. // Do executes the "androiddeviceprovisioning.customers.dpcs.list" call.
  3345. // Exactly one of *CustomerListDpcsResponse or error will be non-nil.
  3346. // Any non-2xx status code is an error. Response headers are in either
  3347. // *CustomerListDpcsResponse.ServerResponse.Header or (if a response was
  3348. // returned at all) in error.(*googleapi.Error).Header. Use
  3349. // googleapi.IsNotModified to check whether the returned error was
  3350. // because http.StatusNotModified was returned.
  3351. func (c *CustomersDpcsListCall) Do(opts ...googleapi.CallOption) (*CustomerListDpcsResponse, error) {
  3352. gensupport.SetOptions(c.urlParams_, opts...)
  3353. res, err := c.doRequest("json")
  3354. if res != nil && res.StatusCode == http.StatusNotModified {
  3355. if res.Body != nil {
  3356. res.Body.Close()
  3357. }
  3358. return nil, &googleapi.Error{
  3359. Code: res.StatusCode,
  3360. Header: res.Header,
  3361. }
  3362. }
  3363. if err != nil {
  3364. return nil, err
  3365. }
  3366. defer googleapi.CloseBody(res)
  3367. if err := googleapi.CheckResponse(res); err != nil {
  3368. return nil, err
  3369. }
  3370. ret := &CustomerListDpcsResponse{
  3371. ServerResponse: googleapi.ServerResponse{
  3372. Header: res.Header,
  3373. HTTPStatusCode: res.StatusCode,
  3374. },
  3375. }
  3376. target := &ret
  3377. if err := gensupport.DecodeResponse(target, res); err != nil {
  3378. return nil, err
  3379. }
  3380. return ret, nil
  3381. // {
  3382. // "description": "Lists the DPCs (device policy controllers) that support zero-touch\nenrollment.",
  3383. // "flatPath": "v1/customers/{customersId}/dpcs",
  3384. // "httpMethod": "GET",
  3385. // "id": "androiddeviceprovisioning.customers.dpcs.list",
  3386. // "parameterOrder": [
  3387. // "parent"
  3388. // ],
  3389. // "parameters": {
  3390. // "parent": {
  3391. // "description": "Required. The customer that can use the DPCs in configurations. An API\nresource name in the format `customers/[CUSTOMER_ID]`.",
  3392. // "location": "path",
  3393. // "pattern": "^customers/[^/]+$",
  3394. // "required": true,
  3395. // "type": "string"
  3396. // }
  3397. // },
  3398. // "path": "v1/{+parent}/dpcs",
  3399. // "response": {
  3400. // "$ref": "CustomerListDpcsResponse"
  3401. // }
  3402. // }
  3403. }
  3404. // method id "androiddeviceprovisioning.operations.get":
  3405. type OperationsGetCall struct {
  3406. s *Service
  3407. name string
  3408. urlParams_ gensupport.URLParams
  3409. ifNoneMatch_ string
  3410. ctx_ context.Context
  3411. header_ http.Header
  3412. }
  3413. // Get: Gets the latest state of a long-running operation. Clients can
  3414. // use this
  3415. // method to poll the operation result at intervals as recommended by
  3416. // the API
  3417. // service.
  3418. func (r *OperationsService) Get(name string) *OperationsGetCall {
  3419. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3420. c.name = name
  3421. return c
  3422. }
  3423. // Fields allows partial responses to be retrieved. See
  3424. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3425. // for more information.
  3426. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  3427. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3428. return c
  3429. }
  3430. // IfNoneMatch sets the optional parameter which makes the operation
  3431. // fail if the object's ETag matches the given value. This is useful for
  3432. // getting updates only after the object has changed since the last
  3433. // request. Use googleapi.IsNotModified to check whether the response
  3434. // error from Do is the result of In-None-Match.
  3435. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  3436. c.ifNoneMatch_ = entityTag
  3437. return c
  3438. }
  3439. // Context sets the context to be used in this call's Do method. Any
  3440. // pending HTTP request will be aborted if the provided context is
  3441. // canceled.
  3442. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  3443. c.ctx_ = ctx
  3444. return c
  3445. }
  3446. // Header returns an http.Header that can be modified by the caller to
  3447. // add HTTP headers to the request.
  3448. func (c *OperationsGetCall) Header() http.Header {
  3449. if c.header_ == nil {
  3450. c.header_ = make(http.Header)
  3451. }
  3452. return c.header_
  3453. }
  3454. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  3455. reqHeaders := make(http.Header)
  3456. for k, v := range c.header_ {
  3457. reqHeaders[k] = v
  3458. }
  3459. reqHeaders.Set("User-Agent", c.s.userAgent())
  3460. if c.ifNoneMatch_ != "" {
  3461. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3462. }
  3463. var body io.Reader = nil
  3464. c.urlParams_.Set("alt", alt)
  3465. c.urlParams_.Set("prettyPrint", "false")
  3466. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3467. urls += "?" + c.urlParams_.Encode()
  3468. req, err := http.NewRequest("GET", urls, body)
  3469. if err != nil {
  3470. return nil, err
  3471. }
  3472. req.Header = reqHeaders
  3473. googleapi.Expand(req.URL, map[string]string{
  3474. "name": c.name,
  3475. })
  3476. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3477. }
  3478. // Do executes the "androiddeviceprovisioning.operations.get" call.
  3479. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3480. // status code is an error. Response headers are in either
  3481. // *Operation.ServerResponse.Header or (if a response was returned at
  3482. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3483. // to check whether the returned error was because
  3484. // http.StatusNotModified was returned.
  3485. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3486. gensupport.SetOptions(c.urlParams_, opts...)
  3487. res, err := c.doRequest("json")
  3488. if res != nil && res.StatusCode == http.StatusNotModified {
  3489. if res.Body != nil {
  3490. res.Body.Close()
  3491. }
  3492. return nil, &googleapi.Error{
  3493. Code: res.StatusCode,
  3494. Header: res.Header,
  3495. }
  3496. }
  3497. if err != nil {
  3498. return nil, err
  3499. }
  3500. defer googleapi.CloseBody(res)
  3501. if err := googleapi.CheckResponse(res); err != nil {
  3502. return nil, err
  3503. }
  3504. ret := &Operation{
  3505. ServerResponse: googleapi.ServerResponse{
  3506. Header: res.Header,
  3507. HTTPStatusCode: res.StatusCode,
  3508. },
  3509. }
  3510. target := &ret
  3511. if err := gensupport.DecodeResponse(target, res); err != nil {
  3512. return nil, err
  3513. }
  3514. return ret, nil
  3515. // {
  3516. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  3517. // "flatPath": "v1/operations/{operationsId}",
  3518. // "httpMethod": "GET",
  3519. // "id": "androiddeviceprovisioning.operations.get",
  3520. // "parameterOrder": [
  3521. // "name"
  3522. // ],
  3523. // "parameters": {
  3524. // "name": {
  3525. // "description": "The name of the operation resource.",
  3526. // "location": "path",
  3527. // "pattern": "^operations/.+$",
  3528. // "required": true,
  3529. // "type": "string"
  3530. // }
  3531. // },
  3532. // "path": "v1/{+name}",
  3533. // "response": {
  3534. // "$ref": "Operation"
  3535. // }
  3536. // }
  3537. }
  3538. // method id "androiddeviceprovisioning.partners.customers.create":
  3539. type PartnersCustomersCreateCall struct {
  3540. s *Service
  3541. parent string
  3542. createcustomerrequest *CreateCustomerRequest
  3543. urlParams_ gensupport.URLParams
  3544. ctx_ context.Context
  3545. header_ http.Header
  3546. }
  3547. // Create: Creates a customer for zero-touch enrollment. After the
  3548. // method returns
  3549. // successfully, admin and owner roles can manage devices and EMM
  3550. // configs
  3551. // by calling API methods or using their zero-touch enrollment
  3552. // portal.
  3553. // The customer receives an email that welcomes them to zero-touch
  3554. // enrollment
  3555. // and explains how to sign into the portal.
  3556. func (r *PartnersCustomersService) Create(parent string, createcustomerrequest *CreateCustomerRequest) *PartnersCustomersCreateCall {
  3557. c := &PartnersCustomersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3558. c.parent = parent
  3559. c.createcustomerrequest = createcustomerrequest
  3560. return c
  3561. }
  3562. // Fields allows partial responses to be retrieved. See
  3563. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3564. // for more information.
  3565. func (c *PartnersCustomersCreateCall) Fields(s ...googleapi.Field) *PartnersCustomersCreateCall {
  3566. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3567. return c
  3568. }
  3569. // Context sets the context to be used in this call's Do method. Any
  3570. // pending HTTP request will be aborted if the provided context is
  3571. // canceled.
  3572. func (c *PartnersCustomersCreateCall) Context(ctx context.Context) *PartnersCustomersCreateCall {
  3573. c.ctx_ = ctx
  3574. return c
  3575. }
  3576. // Header returns an http.Header that can be modified by the caller to
  3577. // add HTTP headers to the request.
  3578. func (c *PartnersCustomersCreateCall) Header() http.Header {
  3579. if c.header_ == nil {
  3580. c.header_ = make(http.Header)
  3581. }
  3582. return c.header_
  3583. }
  3584. func (c *PartnersCustomersCreateCall) doRequest(alt string) (*http.Response, error) {
  3585. reqHeaders := make(http.Header)
  3586. for k, v := range c.header_ {
  3587. reqHeaders[k] = v
  3588. }
  3589. reqHeaders.Set("User-Agent", c.s.userAgent())
  3590. var body io.Reader = nil
  3591. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createcustomerrequest)
  3592. if err != nil {
  3593. return nil, err
  3594. }
  3595. reqHeaders.Set("Content-Type", "application/json")
  3596. c.urlParams_.Set("alt", alt)
  3597. c.urlParams_.Set("prettyPrint", "false")
  3598. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/customers")
  3599. urls += "?" + c.urlParams_.Encode()
  3600. req, err := http.NewRequest("POST", urls, body)
  3601. if err != nil {
  3602. return nil, err
  3603. }
  3604. req.Header = reqHeaders
  3605. googleapi.Expand(req.URL, map[string]string{
  3606. "parent": c.parent,
  3607. })
  3608. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3609. }
  3610. // Do executes the "androiddeviceprovisioning.partners.customers.create" call.
  3611. // Exactly one of *Company or error will be non-nil. Any non-2xx status
  3612. // code is an error. Response headers are in either
  3613. // *Company.ServerResponse.Header or (if a response was returned at all)
  3614. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3615. // check whether the returned error was because http.StatusNotModified
  3616. // was returned.
  3617. func (c *PartnersCustomersCreateCall) Do(opts ...googleapi.CallOption) (*Company, error) {
  3618. gensupport.SetOptions(c.urlParams_, opts...)
  3619. res, err := c.doRequest("json")
  3620. if res != nil && res.StatusCode == http.StatusNotModified {
  3621. if res.Body != nil {
  3622. res.Body.Close()
  3623. }
  3624. return nil, &googleapi.Error{
  3625. Code: res.StatusCode,
  3626. Header: res.Header,
  3627. }
  3628. }
  3629. if err != nil {
  3630. return nil, err
  3631. }
  3632. defer googleapi.CloseBody(res)
  3633. if err := googleapi.CheckResponse(res); err != nil {
  3634. return nil, err
  3635. }
  3636. ret := &Company{
  3637. ServerResponse: googleapi.ServerResponse{
  3638. Header: res.Header,
  3639. HTTPStatusCode: res.StatusCode,
  3640. },
  3641. }
  3642. target := &ret
  3643. if err := gensupport.DecodeResponse(target, res); err != nil {
  3644. return nil, err
  3645. }
  3646. return ret, nil
  3647. // {
  3648. // "description": "Creates a customer for zero-touch enrollment. After the method returns\nsuccessfully, admin and owner roles can manage devices and EMM configs\nby calling API methods or using their zero-touch enrollment portal.\nThe customer receives an email that welcomes them to zero-touch enrollment\nand explains how to sign into the portal.",
  3649. // "flatPath": "v1/partners/{partnersId}/customers",
  3650. // "httpMethod": "POST",
  3651. // "id": "androiddeviceprovisioning.partners.customers.create",
  3652. // "parameterOrder": [
  3653. // "parent"
  3654. // ],
  3655. // "parameters": {
  3656. // "parent": {
  3657. // "description": "Required. The parent resource ID in the format `partners/[PARTNER_ID]` that\nidentifies the reseller.",
  3658. // "location": "path",
  3659. // "pattern": "^partners/[^/]+$",
  3660. // "required": true,
  3661. // "type": "string"
  3662. // }
  3663. // },
  3664. // "path": "v1/{+parent}/customers",
  3665. // "request": {
  3666. // "$ref": "CreateCustomerRequest"
  3667. // },
  3668. // "response": {
  3669. // "$ref": "Company"
  3670. // }
  3671. // }
  3672. }
  3673. // method id "androiddeviceprovisioning.partners.customers.list":
  3674. type PartnersCustomersListCall struct {
  3675. s *Service
  3676. partnerId int64
  3677. urlParams_ gensupport.URLParams
  3678. ifNoneMatch_ string
  3679. ctx_ context.Context
  3680. header_ http.Header
  3681. }
  3682. // List: Lists the customers that are enrolled to the reseller
  3683. // identified by the
  3684. // `partnerId` argument. This list includes customers that the
  3685. // reseller
  3686. // created and customers that enrolled themselves using the portal.
  3687. func (r *PartnersCustomersService) List(partnerId int64) *PartnersCustomersListCall {
  3688. c := &PartnersCustomersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3689. c.partnerId = partnerId
  3690. return c
  3691. }
  3692. // PageSize sets the optional parameter "pageSize": The maximum number
  3693. // of results to be returned. If not specified or 0, all
  3694. // the records are returned.
  3695. func (c *PartnersCustomersListCall) PageSize(pageSize int64) *PartnersCustomersListCall {
  3696. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3697. return c
  3698. }
  3699. // PageToken sets the optional parameter "pageToken": A token
  3700. // identifying a page of results returned by the server.
  3701. func (c *PartnersCustomersListCall) PageToken(pageToken string) *PartnersCustomersListCall {
  3702. c.urlParams_.Set("pageToken", pageToken)
  3703. return c
  3704. }
  3705. // Fields allows partial responses to be retrieved. See
  3706. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3707. // for more information.
  3708. func (c *PartnersCustomersListCall) Fields(s ...googleapi.Field) *PartnersCustomersListCall {
  3709. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3710. return c
  3711. }
  3712. // IfNoneMatch sets the optional parameter which makes the operation
  3713. // fail if the object's ETag matches the given value. This is useful for
  3714. // getting updates only after the object has changed since the last
  3715. // request. Use googleapi.IsNotModified to check whether the response
  3716. // error from Do is the result of In-None-Match.
  3717. func (c *PartnersCustomersListCall) IfNoneMatch(entityTag string) *PartnersCustomersListCall {
  3718. c.ifNoneMatch_ = entityTag
  3719. return c
  3720. }
  3721. // Context sets the context to be used in this call's Do method. Any
  3722. // pending HTTP request will be aborted if the provided context is
  3723. // canceled.
  3724. func (c *PartnersCustomersListCall) Context(ctx context.Context) *PartnersCustomersListCall {
  3725. c.ctx_ = ctx
  3726. return c
  3727. }
  3728. // Header returns an http.Header that can be modified by the caller to
  3729. // add HTTP headers to the request.
  3730. func (c *PartnersCustomersListCall) Header() http.Header {
  3731. if c.header_ == nil {
  3732. c.header_ = make(http.Header)
  3733. }
  3734. return c.header_
  3735. }
  3736. func (c *PartnersCustomersListCall) doRequest(alt string) (*http.Response, error) {
  3737. reqHeaders := make(http.Header)
  3738. for k, v := range c.header_ {
  3739. reqHeaders[k] = v
  3740. }
  3741. reqHeaders.Set("User-Agent", c.s.userAgent())
  3742. if c.ifNoneMatch_ != "" {
  3743. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3744. }
  3745. var body io.Reader = nil
  3746. c.urlParams_.Set("alt", alt)
  3747. c.urlParams_.Set("prettyPrint", "false")
  3748. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/partners/{+partnerId}/customers")
  3749. urls += "?" + c.urlParams_.Encode()
  3750. req, err := http.NewRequest("GET", urls, body)
  3751. if err != nil {
  3752. return nil, err
  3753. }
  3754. req.Header = reqHeaders
  3755. googleapi.Expand(req.URL, map[string]string{
  3756. "partnerId": strconv.FormatInt(c.partnerId, 10),
  3757. })
  3758. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3759. }
  3760. // Do executes the "androiddeviceprovisioning.partners.customers.list" call.
  3761. // Exactly one of *ListCustomersResponse or error will be non-nil. Any
  3762. // non-2xx status code is an error. Response headers are in either
  3763. // *ListCustomersResponse.ServerResponse.Header or (if a response was
  3764. // returned at all) in error.(*googleapi.Error).Header. Use
  3765. // googleapi.IsNotModified to check whether the returned error was
  3766. // because http.StatusNotModified was returned.
  3767. func (c *PartnersCustomersListCall) Do(opts ...googleapi.CallOption) (*ListCustomersResponse, error) {
  3768. gensupport.SetOptions(c.urlParams_, opts...)
  3769. res, err := c.doRequest("json")
  3770. if res != nil && res.StatusCode == http.StatusNotModified {
  3771. if res.Body != nil {
  3772. res.Body.Close()
  3773. }
  3774. return nil, &googleapi.Error{
  3775. Code: res.StatusCode,
  3776. Header: res.Header,
  3777. }
  3778. }
  3779. if err != nil {
  3780. return nil, err
  3781. }
  3782. defer googleapi.CloseBody(res)
  3783. if err := googleapi.CheckResponse(res); err != nil {
  3784. return nil, err
  3785. }
  3786. ret := &ListCustomersResponse{
  3787. ServerResponse: googleapi.ServerResponse{
  3788. Header: res.Header,
  3789. HTTPStatusCode: res.StatusCode,
  3790. },
  3791. }
  3792. target := &ret
  3793. if err := gensupport.DecodeResponse(target, res); err != nil {
  3794. return nil, err
  3795. }
  3796. return ret, nil
  3797. // {
  3798. // "description": "Lists the customers that are enrolled to the reseller identified by the\n`partnerId` argument. This list includes customers that the reseller\ncreated and customers that enrolled themselves using the portal.",
  3799. // "flatPath": "v1/partners/{partnersId}/customers",
  3800. // "httpMethod": "GET",
  3801. // "id": "androiddeviceprovisioning.partners.customers.list",
  3802. // "parameterOrder": [
  3803. // "partnerId"
  3804. // ],
  3805. // "parameters": {
  3806. // "pageSize": {
  3807. // "description": "The maximum number of results to be returned. If not specified or 0, all\nthe records are returned.",
  3808. // "format": "int32",
  3809. // "location": "query",
  3810. // "type": "integer"
  3811. // },
  3812. // "pageToken": {
  3813. // "description": "A token identifying a page of results returned by the server.",
  3814. // "location": "query",
  3815. // "type": "string"
  3816. // },
  3817. // "partnerId": {
  3818. // "description": "Required. The ID of the reseller partner.",
  3819. // "format": "int64",
  3820. // "location": "path",
  3821. // "pattern": "^[^/]+$",
  3822. // "required": true,
  3823. // "type": "string"
  3824. // }
  3825. // },
  3826. // "path": "v1/partners/{+partnerId}/customers",
  3827. // "response": {
  3828. // "$ref": "ListCustomersResponse"
  3829. // }
  3830. // }
  3831. }
  3832. // Pages invokes f for each page of results.
  3833. // A non-nil error returned from f will halt the iteration.
  3834. // The provided context supersedes any context provided to the Context method.
  3835. func (c *PartnersCustomersListCall) Pages(ctx context.Context, f func(*ListCustomersResponse) error) error {
  3836. c.ctx_ = ctx
  3837. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3838. for {
  3839. x, err := c.Do()
  3840. if err != nil {
  3841. return err
  3842. }
  3843. if err := f(x); err != nil {
  3844. return err
  3845. }
  3846. if x.NextPageToken == "" {
  3847. return nil
  3848. }
  3849. c.PageToken(x.NextPageToken)
  3850. }
  3851. }
  3852. // method id "androiddeviceprovisioning.partners.devices.claim":
  3853. type PartnersDevicesClaimCall struct {
  3854. s *Service
  3855. partnerId int64
  3856. claimdevicerequest *ClaimDeviceRequest
  3857. urlParams_ gensupport.URLParams
  3858. ctx_ context.Context
  3859. header_ http.Header
  3860. }
  3861. // Claim: Claims a device for a customer and adds it to zero-touch
  3862. // enrollment. If the
  3863. // device is already claimed by another customer, the call returns an
  3864. // error.
  3865. func (r *PartnersDevicesService) Claim(partnerId int64, claimdevicerequest *ClaimDeviceRequest) *PartnersDevicesClaimCall {
  3866. c := &PartnersDevicesClaimCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3867. c.partnerId = partnerId
  3868. c.claimdevicerequest = claimdevicerequest
  3869. return c
  3870. }
  3871. // Fields allows partial responses to be retrieved. See
  3872. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3873. // for more information.
  3874. func (c *PartnersDevicesClaimCall) Fields(s ...googleapi.Field) *PartnersDevicesClaimCall {
  3875. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3876. return c
  3877. }
  3878. // Context sets the context to be used in this call's Do method. Any
  3879. // pending HTTP request will be aborted if the provided context is
  3880. // canceled.
  3881. func (c *PartnersDevicesClaimCall) Context(ctx context.Context) *PartnersDevicesClaimCall {
  3882. c.ctx_ = ctx
  3883. return c
  3884. }
  3885. // Header returns an http.Header that can be modified by the caller to
  3886. // add HTTP headers to the request.
  3887. func (c *PartnersDevicesClaimCall) Header() http.Header {
  3888. if c.header_ == nil {
  3889. c.header_ = make(http.Header)
  3890. }
  3891. return c.header_
  3892. }
  3893. func (c *PartnersDevicesClaimCall) doRequest(alt string) (*http.Response, error) {
  3894. reqHeaders := make(http.Header)
  3895. for k, v := range c.header_ {
  3896. reqHeaders[k] = v
  3897. }
  3898. reqHeaders.Set("User-Agent", c.s.userAgent())
  3899. var body io.Reader = nil
  3900. body, err := googleapi.WithoutDataWrapper.JSONReader(c.claimdevicerequest)
  3901. if err != nil {
  3902. return nil, err
  3903. }
  3904. reqHeaders.Set("Content-Type", "application/json")
  3905. c.urlParams_.Set("alt", alt)
  3906. c.urlParams_.Set("prettyPrint", "false")
  3907. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/partners/{+partnerId}/devices:claim")
  3908. urls += "?" + c.urlParams_.Encode()
  3909. req, err := http.NewRequest("POST", urls, body)
  3910. if err != nil {
  3911. return nil, err
  3912. }
  3913. req.Header = reqHeaders
  3914. googleapi.Expand(req.URL, map[string]string{
  3915. "partnerId": strconv.FormatInt(c.partnerId, 10),
  3916. })
  3917. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3918. }
  3919. // Do executes the "androiddeviceprovisioning.partners.devices.claim" call.
  3920. // Exactly one of *ClaimDeviceResponse or error will be non-nil. Any
  3921. // non-2xx status code is an error. Response headers are in either
  3922. // *ClaimDeviceResponse.ServerResponse.Header or (if a response was
  3923. // returned at all) in error.(*googleapi.Error).Header. Use
  3924. // googleapi.IsNotModified to check whether the returned error was
  3925. // because http.StatusNotModified was returned.
  3926. func (c *PartnersDevicesClaimCall) Do(opts ...googleapi.CallOption) (*ClaimDeviceResponse, error) {
  3927. gensupport.SetOptions(c.urlParams_, opts...)
  3928. res, err := c.doRequest("json")
  3929. if res != nil && res.StatusCode == http.StatusNotModified {
  3930. if res.Body != nil {
  3931. res.Body.Close()
  3932. }
  3933. return nil, &googleapi.Error{
  3934. Code: res.StatusCode,
  3935. Header: res.Header,
  3936. }
  3937. }
  3938. if err != nil {
  3939. return nil, err
  3940. }
  3941. defer googleapi.CloseBody(res)
  3942. if err := googleapi.CheckResponse(res); err != nil {
  3943. return nil, err
  3944. }
  3945. ret := &ClaimDeviceResponse{
  3946. ServerResponse: googleapi.ServerResponse{
  3947. Header: res.Header,
  3948. HTTPStatusCode: res.StatusCode,
  3949. },
  3950. }
  3951. target := &ret
  3952. if err := gensupport.DecodeResponse(target, res); err != nil {
  3953. return nil, err
  3954. }
  3955. return ret, nil
  3956. // {
  3957. // "description": "Claims a device for a customer and adds it to zero-touch enrollment. If the\ndevice is already claimed by another customer, the call returns an error.",
  3958. // "flatPath": "v1/partners/{partnersId}/devices:claim",
  3959. // "httpMethod": "POST",
  3960. // "id": "androiddeviceprovisioning.partners.devices.claim",
  3961. // "parameterOrder": [
  3962. // "partnerId"
  3963. // ],
  3964. // "parameters": {
  3965. // "partnerId": {
  3966. // "description": "Required. The ID of the reseller partner.",
  3967. // "format": "int64",
  3968. // "location": "path",
  3969. // "pattern": "^[^/]+$",
  3970. // "required": true,
  3971. // "type": "string"
  3972. // }
  3973. // },
  3974. // "path": "v1/partners/{+partnerId}/devices:claim",
  3975. // "request": {
  3976. // "$ref": "ClaimDeviceRequest"
  3977. // },
  3978. // "response": {
  3979. // "$ref": "ClaimDeviceResponse"
  3980. // }
  3981. // }
  3982. }
  3983. // method id "androiddeviceprovisioning.partners.devices.claimAsync":
  3984. type PartnersDevicesClaimAsyncCall struct {
  3985. s *Service
  3986. partnerId int64
  3987. claimdevicesrequest *ClaimDevicesRequest
  3988. urlParams_ gensupport.URLParams
  3989. ctx_ context.Context
  3990. header_ http.Header
  3991. }
  3992. // ClaimAsync: Claims a batch of devices for a customer asynchronously.
  3993. // Adds the devices
  3994. // to zero-touch enrollment. To learn more, read [Long‑running
  3995. // batch
  3996. // operations](/zero-touch/guides/how-it-works#operations).
  3997. func (r *PartnersDevicesService) ClaimAsync(partnerId int64, claimdevicesrequest *ClaimDevicesRequest) *PartnersDevicesClaimAsyncCall {
  3998. c := &PartnersDevicesClaimAsyncCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3999. c.partnerId = partnerId
  4000. c.claimdevicesrequest = claimdevicesrequest
  4001. return c
  4002. }
  4003. // Fields allows partial responses to be retrieved. See
  4004. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4005. // for more information.
  4006. func (c *PartnersDevicesClaimAsyncCall) Fields(s ...googleapi.Field) *PartnersDevicesClaimAsyncCall {
  4007. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4008. return c
  4009. }
  4010. // Context sets the context to be used in this call's Do method. Any
  4011. // pending HTTP request will be aborted if the provided context is
  4012. // canceled.
  4013. func (c *PartnersDevicesClaimAsyncCall) Context(ctx context.Context) *PartnersDevicesClaimAsyncCall {
  4014. c.ctx_ = ctx
  4015. return c
  4016. }
  4017. // Header returns an http.Header that can be modified by the caller to
  4018. // add HTTP headers to the request.
  4019. func (c *PartnersDevicesClaimAsyncCall) Header() http.Header {
  4020. if c.header_ == nil {
  4021. c.header_ = make(http.Header)
  4022. }
  4023. return c.header_
  4024. }
  4025. func (c *PartnersDevicesClaimAsyncCall) doRequest(alt string) (*http.Response, error) {
  4026. reqHeaders := make(http.Header)
  4027. for k, v := range c.header_ {
  4028. reqHeaders[k] = v
  4029. }
  4030. reqHeaders.Set("User-Agent", c.s.userAgent())
  4031. var body io.Reader = nil
  4032. body, err := googleapi.WithoutDataWrapper.JSONReader(c.claimdevicesrequest)
  4033. if err != nil {
  4034. return nil, err
  4035. }
  4036. reqHeaders.Set("Content-Type", "application/json")
  4037. c.urlParams_.Set("alt", alt)
  4038. c.urlParams_.Set("prettyPrint", "false")
  4039. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/partners/{+partnerId}/devices:claimAsync")
  4040. urls += "?" + c.urlParams_.Encode()
  4041. req, err := http.NewRequest("POST", urls, body)
  4042. if err != nil {
  4043. return nil, err
  4044. }
  4045. req.Header = reqHeaders
  4046. googleapi.Expand(req.URL, map[string]string{
  4047. "partnerId": strconv.FormatInt(c.partnerId, 10),
  4048. })
  4049. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4050. }
  4051. // Do executes the "androiddeviceprovisioning.partners.devices.claimAsync" call.
  4052. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4053. // status code is an error. Response headers are in either
  4054. // *Operation.ServerResponse.Header or (if a response was returned at
  4055. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4056. // to check whether the returned error was because
  4057. // http.StatusNotModified was returned.
  4058. func (c *PartnersDevicesClaimAsyncCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4059. gensupport.SetOptions(c.urlParams_, opts...)
  4060. res, err := c.doRequest("json")
  4061. if res != nil && res.StatusCode == http.StatusNotModified {
  4062. if res.Body != nil {
  4063. res.Body.Close()
  4064. }
  4065. return nil, &googleapi.Error{
  4066. Code: res.StatusCode,
  4067. Header: res.Header,
  4068. }
  4069. }
  4070. if err != nil {
  4071. return nil, err
  4072. }
  4073. defer googleapi.CloseBody(res)
  4074. if err := googleapi.CheckResponse(res); err != nil {
  4075. return nil, err
  4076. }
  4077. ret := &Operation{
  4078. ServerResponse: googleapi.ServerResponse{
  4079. Header: res.Header,
  4080. HTTPStatusCode: res.StatusCode,
  4081. },
  4082. }
  4083. target := &ret
  4084. if err := gensupport.DecodeResponse(target, res); err != nil {
  4085. return nil, err
  4086. }
  4087. return ret, nil
  4088. // {
  4089. // "description": "Claims a batch of devices for a customer asynchronously. Adds the devices\nto zero-touch enrollment. To learn more, read [Long‑running batch\noperations](/zero-touch/guides/how-it-works#operations).",
  4090. // "flatPath": "v1/partners/{partnersId}/devices:claimAsync",
  4091. // "httpMethod": "POST",
  4092. // "id": "androiddeviceprovisioning.partners.devices.claimAsync",
  4093. // "parameterOrder": [
  4094. // "partnerId"
  4095. // ],
  4096. // "parameters": {
  4097. // "partnerId": {
  4098. // "description": "Required. The ID of the reseller partner.",
  4099. // "format": "int64",
  4100. // "location": "path",
  4101. // "pattern": "^[^/]+$",
  4102. // "required": true,
  4103. // "type": "string"
  4104. // }
  4105. // },
  4106. // "path": "v1/partners/{+partnerId}/devices:claimAsync",
  4107. // "request": {
  4108. // "$ref": "ClaimDevicesRequest"
  4109. // },
  4110. // "response": {
  4111. // "$ref": "Operation"
  4112. // }
  4113. // }
  4114. }
  4115. // method id "androiddeviceprovisioning.partners.devices.findByIdentifier":
  4116. type PartnersDevicesFindByIdentifierCall struct {
  4117. s *Service
  4118. partnerId int64
  4119. finddevicesbydeviceidentifierrequest *FindDevicesByDeviceIdentifierRequest
  4120. urlParams_ gensupport.URLParams
  4121. ctx_ context.Context
  4122. header_ http.Header
  4123. }
  4124. // FindByIdentifier: Finds devices by hardware identifiers, such as
  4125. // IMEI.
  4126. func (r *PartnersDevicesService) FindByIdentifier(partnerId int64, finddevicesbydeviceidentifierrequest *FindDevicesByDeviceIdentifierRequest) *PartnersDevicesFindByIdentifierCall {
  4127. c := &PartnersDevicesFindByIdentifierCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4128. c.partnerId = partnerId
  4129. c.finddevicesbydeviceidentifierrequest = finddevicesbydeviceidentifierrequest
  4130. return c
  4131. }
  4132. // Fields allows partial responses to be retrieved. See
  4133. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4134. // for more information.
  4135. func (c *PartnersDevicesFindByIdentifierCall) Fields(s ...googleapi.Field) *PartnersDevicesFindByIdentifierCall {
  4136. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4137. return c
  4138. }
  4139. // Context sets the context to be used in this call's Do method. Any
  4140. // pending HTTP request will be aborted if the provided context is
  4141. // canceled.
  4142. func (c *PartnersDevicesFindByIdentifierCall) Context(ctx context.Context) *PartnersDevicesFindByIdentifierCall {
  4143. c.ctx_ = ctx
  4144. return c
  4145. }
  4146. // Header returns an http.Header that can be modified by the caller to
  4147. // add HTTP headers to the request.
  4148. func (c *PartnersDevicesFindByIdentifierCall) Header() http.Header {
  4149. if c.header_ == nil {
  4150. c.header_ = make(http.Header)
  4151. }
  4152. return c.header_
  4153. }
  4154. func (c *PartnersDevicesFindByIdentifierCall) doRequest(alt string) (*http.Response, error) {
  4155. reqHeaders := make(http.Header)
  4156. for k, v := range c.header_ {
  4157. reqHeaders[k] = v
  4158. }
  4159. reqHeaders.Set("User-Agent", c.s.userAgent())
  4160. var body io.Reader = nil
  4161. body, err := googleapi.WithoutDataWrapper.JSONReader(c.finddevicesbydeviceidentifierrequest)
  4162. if err != nil {
  4163. return nil, err
  4164. }
  4165. reqHeaders.Set("Content-Type", "application/json")
  4166. c.urlParams_.Set("alt", alt)
  4167. c.urlParams_.Set("prettyPrint", "false")
  4168. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/partners/{+partnerId}/devices:findByIdentifier")
  4169. urls += "?" + c.urlParams_.Encode()
  4170. req, err := http.NewRequest("POST", urls, body)
  4171. if err != nil {
  4172. return nil, err
  4173. }
  4174. req.Header = reqHeaders
  4175. googleapi.Expand(req.URL, map[string]string{
  4176. "partnerId": strconv.FormatInt(c.partnerId, 10),
  4177. })
  4178. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4179. }
  4180. // Do executes the "androiddeviceprovisioning.partners.devices.findByIdentifier" call.
  4181. // Exactly one of *FindDevicesByDeviceIdentifierResponse or error will
  4182. // be non-nil. Any non-2xx status code is an error. Response headers are
  4183. // in either
  4184. // *FindDevicesByDeviceIdentifierResponse.ServerResponse.Header or (if a
  4185. // response was returned at all) in error.(*googleapi.Error).Header. Use
  4186. // googleapi.IsNotModified to check whether the returned error was
  4187. // because http.StatusNotModified was returned.
  4188. func (c *PartnersDevicesFindByIdentifierCall) Do(opts ...googleapi.CallOption) (*FindDevicesByDeviceIdentifierResponse, error) {
  4189. gensupport.SetOptions(c.urlParams_, opts...)
  4190. res, err := c.doRequest("json")
  4191. if res != nil && res.StatusCode == http.StatusNotModified {
  4192. if res.Body != nil {
  4193. res.Body.Close()
  4194. }
  4195. return nil, &googleapi.Error{
  4196. Code: res.StatusCode,
  4197. Header: res.Header,
  4198. }
  4199. }
  4200. if err != nil {
  4201. return nil, err
  4202. }
  4203. defer googleapi.CloseBody(res)
  4204. if err := googleapi.CheckResponse(res); err != nil {
  4205. return nil, err
  4206. }
  4207. ret := &FindDevicesByDeviceIdentifierResponse{
  4208. ServerResponse: googleapi.ServerResponse{
  4209. Header: res.Header,
  4210. HTTPStatusCode: res.StatusCode,
  4211. },
  4212. }
  4213. target := &ret
  4214. if err := gensupport.DecodeResponse(target, res); err != nil {
  4215. return nil, err
  4216. }
  4217. return ret, nil
  4218. // {
  4219. // "description": "Finds devices by hardware identifiers, such as IMEI.",
  4220. // "flatPath": "v1/partners/{partnersId}/devices:findByIdentifier",
  4221. // "httpMethod": "POST",
  4222. // "id": "androiddeviceprovisioning.partners.devices.findByIdentifier",
  4223. // "parameterOrder": [
  4224. // "partnerId"
  4225. // ],
  4226. // "parameters": {
  4227. // "partnerId": {
  4228. // "description": "Required. The ID of the reseller partner.",
  4229. // "format": "int64",
  4230. // "location": "path",
  4231. // "pattern": "^[^/]+$",
  4232. // "required": true,
  4233. // "type": "string"
  4234. // }
  4235. // },
  4236. // "path": "v1/partners/{+partnerId}/devices:findByIdentifier",
  4237. // "request": {
  4238. // "$ref": "FindDevicesByDeviceIdentifierRequest"
  4239. // },
  4240. // "response": {
  4241. // "$ref": "FindDevicesByDeviceIdentifierResponse"
  4242. // }
  4243. // }
  4244. }
  4245. // Pages invokes f for each page of results.
  4246. // A non-nil error returned from f will halt the iteration.
  4247. // The provided context supersedes any context provided to the Context method.
  4248. func (c *PartnersDevicesFindByIdentifierCall) Pages(ctx context.Context, f func(*FindDevicesByDeviceIdentifierResponse) error) error {
  4249. c.ctx_ = ctx
  4250. defer func(pt string) { c.finddevicesbydeviceidentifierrequest.PageToken = pt }(c.finddevicesbydeviceidentifierrequest.PageToken) // reset paging to original point
  4251. for {
  4252. x, err := c.Do()
  4253. if err != nil {
  4254. return err
  4255. }
  4256. if err := f(x); err != nil {
  4257. return err
  4258. }
  4259. if x.NextPageToken == "" {
  4260. return nil
  4261. }
  4262. c.finddevicesbydeviceidentifierrequest.PageToken = x.NextPageToken
  4263. }
  4264. }
  4265. // method id "androiddeviceprovisioning.partners.devices.findByOwner":
  4266. type PartnersDevicesFindByOwnerCall struct {
  4267. s *Service
  4268. partnerId int64
  4269. finddevicesbyownerrequest *FindDevicesByOwnerRequest
  4270. urlParams_ gensupport.URLParams
  4271. ctx_ context.Context
  4272. header_ http.Header
  4273. }
  4274. // FindByOwner: Finds devices claimed for customers. The results only
  4275. // contain devices
  4276. // registered to the reseller that's identified by the `partnerId`
  4277. // argument.
  4278. // The customer's devices purchased from other resellers don't appear in
  4279. // the
  4280. // results.
  4281. func (r *PartnersDevicesService) FindByOwner(partnerId int64, finddevicesbyownerrequest *FindDevicesByOwnerRequest) *PartnersDevicesFindByOwnerCall {
  4282. c := &PartnersDevicesFindByOwnerCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4283. c.partnerId = partnerId
  4284. c.finddevicesbyownerrequest = finddevicesbyownerrequest
  4285. return c
  4286. }
  4287. // Fields allows partial responses to be retrieved. See
  4288. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4289. // for more information.
  4290. func (c *PartnersDevicesFindByOwnerCall) Fields(s ...googleapi.Field) *PartnersDevicesFindByOwnerCall {
  4291. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4292. return c
  4293. }
  4294. // Context sets the context to be used in this call's Do method. Any
  4295. // pending HTTP request will be aborted if the provided context is
  4296. // canceled.
  4297. func (c *PartnersDevicesFindByOwnerCall) Context(ctx context.Context) *PartnersDevicesFindByOwnerCall {
  4298. c.ctx_ = ctx
  4299. return c
  4300. }
  4301. // Header returns an http.Header that can be modified by the caller to
  4302. // add HTTP headers to the request.
  4303. func (c *PartnersDevicesFindByOwnerCall) Header() http.Header {
  4304. if c.header_ == nil {
  4305. c.header_ = make(http.Header)
  4306. }
  4307. return c.header_
  4308. }
  4309. func (c *PartnersDevicesFindByOwnerCall) doRequest(alt string) (*http.Response, error) {
  4310. reqHeaders := make(http.Header)
  4311. for k, v := range c.header_ {
  4312. reqHeaders[k] = v
  4313. }
  4314. reqHeaders.Set("User-Agent", c.s.userAgent())
  4315. var body io.Reader = nil
  4316. body, err := googleapi.WithoutDataWrapper.JSONReader(c.finddevicesbyownerrequest)
  4317. if err != nil {
  4318. return nil, err
  4319. }
  4320. reqHeaders.Set("Content-Type", "application/json")
  4321. c.urlParams_.Set("alt", alt)
  4322. c.urlParams_.Set("prettyPrint", "false")
  4323. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/partners/{+partnerId}/devices:findByOwner")
  4324. urls += "?" + c.urlParams_.Encode()
  4325. req, err := http.NewRequest("POST", urls, body)
  4326. if err != nil {
  4327. return nil, err
  4328. }
  4329. req.Header = reqHeaders
  4330. googleapi.Expand(req.URL, map[string]string{
  4331. "partnerId": strconv.FormatInt(c.partnerId, 10),
  4332. })
  4333. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4334. }
  4335. // Do executes the "androiddeviceprovisioning.partners.devices.findByOwner" call.
  4336. // Exactly one of *FindDevicesByOwnerResponse or error will be non-nil.
  4337. // Any non-2xx status code is an error. Response headers are in either
  4338. // *FindDevicesByOwnerResponse.ServerResponse.Header or (if a response
  4339. // was returned at all) in error.(*googleapi.Error).Header. Use
  4340. // googleapi.IsNotModified to check whether the returned error was
  4341. // because http.StatusNotModified was returned.
  4342. func (c *PartnersDevicesFindByOwnerCall) Do(opts ...googleapi.CallOption) (*FindDevicesByOwnerResponse, error) {
  4343. gensupport.SetOptions(c.urlParams_, opts...)
  4344. res, err := c.doRequest("json")
  4345. if res != nil && res.StatusCode == http.StatusNotModified {
  4346. if res.Body != nil {
  4347. res.Body.Close()
  4348. }
  4349. return nil, &googleapi.Error{
  4350. Code: res.StatusCode,
  4351. Header: res.Header,
  4352. }
  4353. }
  4354. if err != nil {
  4355. return nil, err
  4356. }
  4357. defer googleapi.CloseBody(res)
  4358. if err := googleapi.CheckResponse(res); err != nil {
  4359. return nil, err
  4360. }
  4361. ret := &FindDevicesByOwnerResponse{
  4362. ServerResponse: googleapi.ServerResponse{
  4363. Header: res.Header,
  4364. HTTPStatusCode: res.StatusCode,
  4365. },
  4366. }
  4367. target := &ret
  4368. if err := gensupport.DecodeResponse(target, res); err != nil {
  4369. return nil, err
  4370. }
  4371. return ret, nil
  4372. // {
  4373. // "description": "Finds devices claimed for customers. The results only contain devices\nregistered to the reseller that's identified by the `partnerId` argument.\nThe customer's devices purchased from other resellers don't appear in the\nresults.",
  4374. // "flatPath": "v1/partners/{partnersId}/devices:findByOwner",
  4375. // "httpMethod": "POST",
  4376. // "id": "androiddeviceprovisioning.partners.devices.findByOwner",
  4377. // "parameterOrder": [
  4378. // "partnerId"
  4379. // ],
  4380. // "parameters": {
  4381. // "partnerId": {
  4382. // "description": "Required. The ID of the reseller partner.",
  4383. // "format": "int64",
  4384. // "location": "path",
  4385. // "pattern": "^[^/]+$",
  4386. // "required": true,
  4387. // "type": "string"
  4388. // }
  4389. // },
  4390. // "path": "v1/partners/{+partnerId}/devices:findByOwner",
  4391. // "request": {
  4392. // "$ref": "FindDevicesByOwnerRequest"
  4393. // },
  4394. // "response": {
  4395. // "$ref": "FindDevicesByOwnerResponse"
  4396. // }
  4397. // }
  4398. }
  4399. // Pages invokes f for each page of results.
  4400. // A non-nil error returned from f will halt the iteration.
  4401. // The provided context supersedes any context provided to the Context method.
  4402. func (c *PartnersDevicesFindByOwnerCall) Pages(ctx context.Context, f func(*FindDevicesByOwnerResponse) error) error {
  4403. c.ctx_ = ctx
  4404. defer func(pt string) { c.finddevicesbyownerrequest.PageToken = pt }(c.finddevicesbyownerrequest.PageToken) // reset paging to original point
  4405. for {
  4406. x, err := c.Do()
  4407. if err != nil {
  4408. return err
  4409. }
  4410. if err := f(x); err != nil {
  4411. return err
  4412. }
  4413. if x.NextPageToken == "" {
  4414. return nil
  4415. }
  4416. c.finddevicesbyownerrequest.PageToken = x.NextPageToken
  4417. }
  4418. }
  4419. // method id "androiddeviceprovisioning.partners.devices.get":
  4420. type PartnersDevicesGetCall struct {
  4421. s *Service
  4422. name string
  4423. urlParams_ gensupport.URLParams
  4424. ifNoneMatch_ string
  4425. ctx_ context.Context
  4426. header_ http.Header
  4427. }
  4428. // Get: Gets a device.
  4429. func (r *PartnersDevicesService) Get(name string) *PartnersDevicesGetCall {
  4430. c := &PartnersDevicesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4431. c.name = name
  4432. return c
  4433. }
  4434. // Fields allows partial responses to be retrieved. See
  4435. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4436. // for more information.
  4437. func (c *PartnersDevicesGetCall) Fields(s ...googleapi.Field) *PartnersDevicesGetCall {
  4438. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4439. return c
  4440. }
  4441. // IfNoneMatch sets the optional parameter which makes the operation
  4442. // fail if the object's ETag matches the given value. This is useful for
  4443. // getting updates only after the object has changed since the last
  4444. // request. Use googleapi.IsNotModified to check whether the response
  4445. // error from Do is the result of In-None-Match.
  4446. func (c *PartnersDevicesGetCall) IfNoneMatch(entityTag string) *PartnersDevicesGetCall {
  4447. c.ifNoneMatch_ = entityTag
  4448. return c
  4449. }
  4450. // Context sets the context to be used in this call's Do method. Any
  4451. // pending HTTP request will be aborted if the provided context is
  4452. // canceled.
  4453. func (c *PartnersDevicesGetCall) Context(ctx context.Context) *PartnersDevicesGetCall {
  4454. c.ctx_ = ctx
  4455. return c
  4456. }
  4457. // Header returns an http.Header that can be modified by the caller to
  4458. // add HTTP headers to the request.
  4459. func (c *PartnersDevicesGetCall) Header() http.Header {
  4460. if c.header_ == nil {
  4461. c.header_ = make(http.Header)
  4462. }
  4463. return c.header_
  4464. }
  4465. func (c *PartnersDevicesGetCall) doRequest(alt string) (*http.Response, error) {
  4466. reqHeaders := make(http.Header)
  4467. for k, v := range c.header_ {
  4468. reqHeaders[k] = v
  4469. }
  4470. reqHeaders.Set("User-Agent", c.s.userAgent())
  4471. if c.ifNoneMatch_ != "" {
  4472. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4473. }
  4474. var body io.Reader = nil
  4475. c.urlParams_.Set("alt", alt)
  4476. c.urlParams_.Set("prettyPrint", "false")
  4477. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4478. urls += "?" + c.urlParams_.Encode()
  4479. req, err := http.NewRequest("GET", urls, body)
  4480. if err != nil {
  4481. return nil, err
  4482. }
  4483. req.Header = reqHeaders
  4484. googleapi.Expand(req.URL, map[string]string{
  4485. "name": c.name,
  4486. })
  4487. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4488. }
  4489. // Do executes the "androiddeviceprovisioning.partners.devices.get" call.
  4490. // Exactly one of *Device or error will be non-nil. Any non-2xx status
  4491. // code is an error. Response headers are in either
  4492. // *Device.ServerResponse.Header or (if a response was returned at all)
  4493. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4494. // check whether the returned error was because http.StatusNotModified
  4495. // was returned.
  4496. func (c *PartnersDevicesGetCall) Do(opts ...googleapi.CallOption) (*Device, error) {
  4497. gensupport.SetOptions(c.urlParams_, opts...)
  4498. res, err := c.doRequest("json")
  4499. if res != nil && res.StatusCode == http.StatusNotModified {
  4500. if res.Body != nil {
  4501. res.Body.Close()
  4502. }
  4503. return nil, &googleapi.Error{
  4504. Code: res.StatusCode,
  4505. Header: res.Header,
  4506. }
  4507. }
  4508. if err != nil {
  4509. return nil, err
  4510. }
  4511. defer googleapi.CloseBody(res)
  4512. if err := googleapi.CheckResponse(res); err != nil {
  4513. return nil, err
  4514. }
  4515. ret := &Device{
  4516. ServerResponse: googleapi.ServerResponse{
  4517. Header: res.Header,
  4518. HTTPStatusCode: res.StatusCode,
  4519. },
  4520. }
  4521. target := &ret
  4522. if err := gensupport.DecodeResponse(target, res); err != nil {
  4523. return nil, err
  4524. }
  4525. return ret, nil
  4526. // {
  4527. // "description": "Gets a device.",
  4528. // "flatPath": "v1/partners/{partnersId}/devices/{devicesId}",
  4529. // "httpMethod": "GET",
  4530. // "id": "androiddeviceprovisioning.partners.devices.get",
  4531. // "parameterOrder": [
  4532. // "name"
  4533. // ],
  4534. // "parameters": {
  4535. // "name": {
  4536. // "description": "Required. The device API resource name in the format\n`partners/[PARTNER_ID]/devices/[DEVICE_ID]`.",
  4537. // "location": "path",
  4538. // "pattern": "^partners/[^/]+/devices/[^/]+$",
  4539. // "required": true,
  4540. // "type": "string"
  4541. // }
  4542. // },
  4543. // "path": "v1/{+name}",
  4544. // "response": {
  4545. // "$ref": "Device"
  4546. // }
  4547. // }
  4548. }
  4549. // method id "androiddeviceprovisioning.partners.devices.metadata":
  4550. type PartnersDevicesMetadataCall struct {
  4551. s *Service
  4552. metadataOwnerId int64
  4553. deviceId int64
  4554. updatedevicemetadatarequest *UpdateDeviceMetadataRequest
  4555. urlParams_ gensupport.URLParams
  4556. ctx_ context.Context
  4557. header_ http.Header
  4558. }
  4559. // Metadata: Updates reseller metadata associated with the device.
  4560. func (r *PartnersDevicesService) Metadata(metadataOwnerId int64, deviceId int64, updatedevicemetadatarequest *UpdateDeviceMetadataRequest) *PartnersDevicesMetadataCall {
  4561. c := &PartnersDevicesMetadataCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4562. c.metadataOwnerId = metadataOwnerId
  4563. c.deviceId = deviceId
  4564. c.updatedevicemetadatarequest = updatedevicemetadatarequest
  4565. return c
  4566. }
  4567. // Fields allows partial responses to be retrieved. See
  4568. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4569. // for more information.
  4570. func (c *PartnersDevicesMetadataCall) Fields(s ...googleapi.Field) *PartnersDevicesMetadataCall {
  4571. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4572. return c
  4573. }
  4574. // Context sets the context to be used in this call's Do method. Any
  4575. // pending HTTP request will be aborted if the provided context is
  4576. // canceled.
  4577. func (c *PartnersDevicesMetadataCall) Context(ctx context.Context) *PartnersDevicesMetadataCall {
  4578. c.ctx_ = ctx
  4579. return c
  4580. }
  4581. // Header returns an http.Header that can be modified by the caller to
  4582. // add HTTP headers to the request.
  4583. func (c *PartnersDevicesMetadataCall) Header() http.Header {
  4584. if c.header_ == nil {
  4585. c.header_ = make(http.Header)
  4586. }
  4587. return c.header_
  4588. }
  4589. func (c *PartnersDevicesMetadataCall) doRequest(alt string) (*http.Response, error) {
  4590. reqHeaders := make(http.Header)
  4591. for k, v := range c.header_ {
  4592. reqHeaders[k] = v
  4593. }
  4594. reqHeaders.Set("User-Agent", c.s.userAgent())
  4595. var body io.Reader = nil
  4596. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatedevicemetadatarequest)
  4597. if err != nil {
  4598. return nil, err
  4599. }
  4600. reqHeaders.Set("Content-Type", "application/json")
  4601. c.urlParams_.Set("alt", alt)
  4602. c.urlParams_.Set("prettyPrint", "false")
  4603. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/partners/{+metadataOwnerId}/devices/{+deviceId}/metadata")
  4604. urls += "?" + c.urlParams_.Encode()
  4605. req, err := http.NewRequest("POST", urls, body)
  4606. if err != nil {
  4607. return nil, err
  4608. }
  4609. req.Header = reqHeaders
  4610. googleapi.Expand(req.URL, map[string]string{
  4611. "metadataOwnerId": strconv.FormatInt(c.metadataOwnerId, 10),
  4612. "deviceId": strconv.FormatInt(c.deviceId, 10),
  4613. })
  4614. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4615. }
  4616. // Do executes the "androiddeviceprovisioning.partners.devices.metadata" call.
  4617. // Exactly one of *DeviceMetadata or error will be non-nil. Any non-2xx
  4618. // status code is an error. Response headers are in either
  4619. // *DeviceMetadata.ServerResponse.Header or (if a response was returned
  4620. // at all) in error.(*googleapi.Error).Header. Use
  4621. // googleapi.IsNotModified to check whether the returned error was
  4622. // because http.StatusNotModified was returned.
  4623. func (c *PartnersDevicesMetadataCall) Do(opts ...googleapi.CallOption) (*DeviceMetadata, error) {
  4624. gensupport.SetOptions(c.urlParams_, opts...)
  4625. res, err := c.doRequest("json")
  4626. if res != nil && res.StatusCode == http.StatusNotModified {
  4627. if res.Body != nil {
  4628. res.Body.Close()
  4629. }
  4630. return nil, &googleapi.Error{
  4631. Code: res.StatusCode,
  4632. Header: res.Header,
  4633. }
  4634. }
  4635. if err != nil {
  4636. return nil, err
  4637. }
  4638. defer googleapi.CloseBody(res)
  4639. if err := googleapi.CheckResponse(res); err != nil {
  4640. return nil, err
  4641. }
  4642. ret := &DeviceMetadata{
  4643. ServerResponse: googleapi.ServerResponse{
  4644. Header: res.Header,
  4645. HTTPStatusCode: res.StatusCode,
  4646. },
  4647. }
  4648. target := &ret
  4649. if err := gensupport.DecodeResponse(target, res); err != nil {
  4650. return nil, err
  4651. }
  4652. return ret, nil
  4653. // {
  4654. // "description": "Updates reseller metadata associated with the device.",
  4655. // "flatPath": "v1/partners/{partnersId}/devices/{devicesId}/metadata",
  4656. // "httpMethod": "POST",
  4657. // "id": "androiddeviceprovisioning.partners.devices.metadata",
  4658. // "parameterOrder": [
  4659. // "metadataOwnerId",
  4660. // "deviceId"
  4661. // ],
  4662. // "parameters": {
  4663. // "deviceId": {
  4664. // "description": "Required. The ID of the device.",
  4665. // "format": "int64",
  4666. // "location": "path",
  4667. // "pattern": "^[^/]+$",
  4668. // "required": true,
  4669. // "type": "string"
  4670. // },
  4671. // "metadataOwnerId": {
  4672. // "description": "Required. The owner of the newly set metadata. Set this to the partner ID.",
  4673. // "format": "int64",
  4674. // "location": "path",
  4675. // "pattern": "^[^/]+$",
  4676. // "required": true,
  4677. // "type": "string"
  4678. // }
  4679. // },
  4680. // "path": "v1/partners/{+metadataOwnerId}/devices/{+deviceId}/metadata",
  4681. // "request": {
  4682. // "$ref": "UpdateDeviceMetadataRequest"
  4683. // },
  4684. // "response": {
  4685. // "$ref": "DeviceMetadata"
  4686. // }
  4687. // }
  4688. }
  4689. // method id "androiddeviceprovisioning.partners.devices.unclaim":
  4690. type PartnersDevicesUnclaimCall struct {
  4691. s *Service
  4692. partnerId int64
  4693. unclaimdevicerequest *UnclaimDeviceRequest
  4694. urlParams_ gensupport.URLParams
  4695. ctx_ context.Context
  4696. header_ http.Header
  4697. }
  4698. // Unclaim: Unclaims a device from a customer and removes it from
  4699. // zero-touch
  4700. // enrollment.
  4701. func (r *PartnersDevicesService) Unclaim(partnerId int64, unclaimdevicerequest *UnclaimDeviceRequest) *PartnersDevicesUnclaimCall {
  4702. c := &PartnersDevicesUnclaimCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4703. c.partnerId = partnerId
  4704. c.unclaimdevicerequest = unclaimdevicerequest
  4705. return c
  4706. }
  4707. // Fields allows partial responses to be retrieved. See
  4708. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4709. // for more information.
  4710. func (c *PartnersDevicesUnclaimCall) Fields(s ...googleapi.Field) *PartnersDevicesUnclaimCall {
  4711. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4712. return c
  4713. }
  4714. // Context sets the context to be used in this call's Do method. Any
  4715. // pending HTTP request will be aborted if the provided context is
  4716. // canceled.
  4717. func (c *PartnersDevicesUnclaimCall) Context(ctx context.Context) *PartnersDevicesUnclaimCall {
  4718. c.ctx_ = ctx
  4719. return c
  4720. }
  4721. // Header returns an http.Header that can be modified by the caller to
  4722. // add HTTP headers to the request.
  4723. func (c *PartnersDevicesUnclaimCall) Header() http.Header {
  4724. if c.header_ == nil {
  4725. c.header_ = make(http.Header)
  4726. }
  4727. return c.header_
  4728. }
  4729. func (c *PartnersDevicesUnclaimCall) doRequest(alt string) (*http.Response, error) {
  4730. reqHeaders := make(http.Header)
  4731. for k, v := range c.header_ {
  4732. reqHeaders[k] = v
  4733. }
  4734. reqHeaders.Set("User-Agent", c.s.userAgent())
  4735. var body io.Reader = nil
  4736. body, err := googleapi.WithoutDataWrapper.JSONReader(c.unclaimdevicerequest)
  4737. if err != nil {
  4738. return nil, err
  4739. }
  4740. reqHeaders.Set("Content-Type", "application/json")
  4741. c.urlParams_.Set("alt", alt)
  4742. c.urlParams_.Set("prettyPrint", "false")
  4743. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/partners/{+partnerId}/devices:unclaim")
  4744. urls += "?" + c.urlParams_.Encode()
  4745. req, err := http.NewRequest("POST", urls, body)
  4746. if err != nil {
  4747. return nil, err
  4748. }
  4749. req.Header = reqHeaders
  4750. googleapi.Expand(req.URL, map[string]string{
  4751. "partnerId": strconv.FormatInt(c.partnerId, 10),
  4752. })
  4753. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4754. }
  4755. // Do executes the "androiddeviceprovisioning.partners.devices.unclaim" call.
  4756. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4757. // code is an error. Response headers are in either
  4758. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4759. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4760. // check whether the returned error was because http.StatusNotModified
  4761. // was returned.
  4762. func (c *PartnersDevicesUnclaimCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4763. gensupport.SetOptions(c.urlParams_, opts...)
  4764. res, err := c.doRequest("json")
  4765. if res != nil && res.StatusCode == http.StatusNotModified {
  4766. if res.Body != nil {
  4767. res.Body.Close()
  4768. }
  4769. return nil, &googleapi.Error{
  4770. Code: res.StatusCode,
  4771. Header: res.Header,
  4772. }
  4773. }
  4774. if err != nil {
  4775. return nil, err
  4776. }
  4777. defer googleapi.CloseBody(res)
  4778. if err := googleapi.CheckResponse(res); err != nil {
  4779. return nil, err
  4780. }
  4781. ret := &Empty{
  4782. ServerResponse: googleapi.ServerResponse{
  4783. Header: res.Header,
  4784. HTTPStatusCode: res.StatusCode,
  4785. },
  4786. }
  4787. target := &ret
  4788. if err := gensupport.DecodeResponse(target, res); err != nil {
  4789. return nil, err
  4790. }
  4791. return ret, nil
  4792. // {
  4793. // "description": "Unclaims a device from a customer and removes it from zero-touch\nenrollment.",
  4794. // "flatPath": "v1/partners/{partnersId}/devices:unclaim",
  4795. // "httpMethod": "POST",
  4796. // "id": "androiddeviceprovisioning.partners.devices.unclaim",
  4797. // "parameterOrder": [
  4798. // "partnerId"
  4799. // ],
  4800. // "parameters": {
  4801. // "partnerId": {
  4802. // "description": "Required. The ID of the reseller partner.",
  4803. // "format": "int64",
  4804. // "location": "path",
  4805. // "pattern": "^[^/]+$",
  4806. // "required": true,
  4807. // "type": "string"
  4808. // }
  4809. // },
  4810. // "path": "v1/partners/{+partnerId}/devices:unclaim",
  4811. // "request": {
  4812. // "$ref": "UnclaimDeviceRequest"
  4813. // },
  4814. // "response": {
  4815. // "$ref": "Empty"
  4816. // }
  4817. // }
  4818. }
  4819. // method id "androiddeviceprovisioning.partners.devices.unclaimAsync":
  4820. type PartnersDevicesUnclaimAsyncCall struct {
  4821. s *Service
  4822. partnerId int64
  4823. unclaimdevicesrequest *UnclaimDevicesRequest
  4824. urlParams_ gensupport.URLParams
  4825. ctx_ context.Context
  4826. header_ http.Header
  4827. }
  4828. // UnclaimAsync: Unclaims a batch of devices for a customer
  4829. // asynchronously. Removes the
  4830. // devices from zero-touch enrollment. To learn more, read
  4831. // [Long‑running
  4832. // batch
  4833. // operations](/zero-touch/guides/how-it-works#operations).
  4834. func (r *PartnersDevicesService) UnclaimAsync(partnerId int64, unclaimdevicesrequest *UnclaimDevicesRequest) *PartnersDevicesUnclaimAsyncCall {
  4835. c := &PartnersDevicesUnclaimAsyncCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4836. c.partnerId = partnerId
  4837. c.unclaimdevicesrequest = unclaimdevicesrequest
  4838. return c
  4839. }
  4840. // Fields allows partial responses to be retrieved. See
  4841. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4842. // for more information.
  4843. func (c *PartnersDevicesUnclaimAsyncCall) Fields(s ...googleapi.Field) *PartnersDevicesUnclaimAsyncCall {
  4844. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4845. return c
  4846. }
  4847. // Context sets the context to be used in this call's Do method. Any
  4848. // pending HTTP request will be aborted if the provided context is
  4849. // canceled.
  4850. func (c *PartnersDevicesUnclaimAsyncCall) Context(ctx context.Context) *PartnersDevicesUnclaimAsyncCall {
  4851. c.ctx_ = ctx
  4852. return c
  4853. }
  4854. // Header returns an http.Header that can be modified by the caller to
  4855. // add HTTP headers to the request.
  4856. func (c *PartnersDevicesUnclaimAsyncCall) Header() http.Header {
  4857. if c.header_ == nil {
  4858. c.header_ = make(http.Header)
  4859. }
  4860. return c.header_
  4861. }
  4862. func (c *PartnersDevicesUnclaimAsyncCall) doRequest(alt string) (*http.Response, error) {
  4863. reqHeaders := make(http.Header)
  4864. for k, v := range c.header_ {
  4865. reqHeaders[k] = v
  4866. }
  4867. reqHeaders.Set("User-Agent", c.s.userAgent())
  4868. var body io.Reader = nil
  4869. body, err := googleapi.WithoutDataWrapper.JSONReader(c.unclaimdevicesrequest)
  4870. if err != nil {
  4871. return nil, err
  4872. }
  4873. reqHeaders.Set("Content-Type", "application/json")
  4874. c.urlParams_.Set("alt", alt)
  4875. c.urlParams_.Set("prettyPrint", "false")
  4876. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/partners/{+partnerId}/devices:unclaimAsync")
  4877. urls += "?" + c.urlParams_.Encode()
  4878. req, err := http.NewRequest("POST", urls, body)
  4879. if err != nil {
  4880. return nil, err
  4881. }
  4882. req.Header = reqHeaders
  4883. googleapi.Expand(req.URL, map[string]string{
  4884. "partnerId": strconv.FormatInt(c.partnerId, 10),
  4885. })
  4886. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4887. }
  4888. // Do executes the "androiddeviceprovisioning.partners.devices.unclaimAsync" call.
  4889. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  4890. // status code is an error. Response headers are in either
  4891. // *Operation.ServerResponse.Header or (if a response was returned at
  4892. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4893. // to check whether the returned error was because
  4894. // http.StatusNotModified was returned.
  4895. func (c *PartnersDevicesUnclaimAsyncCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  4896. gensupport.SetOptions(c.urlParams_, opts...)
  4897. res, err := c.doRequest("json")
  4898. if res != nil && res.StatusCode == http.StatusNotModified {
  4899. if res.Body != nil {
  4900. res.Body.Close()
  4901. }
  4902. return nil, &googleapi.Error{
  4903. Code: res.StatusCode,
  4904. Header: res.Header,
  4905. }
  4906. }
  4907. if err != nil {
  4908. return nil, err
  4909. }
  4910. defer googleapi.CloseBody(res)
  4911. if err := googleapi.CheckResponse(res); err != nil {
  4912. return nil, err
  4913. }
  4914. ret := &Operation{
  4915. ServerResponse: googleapi.ServerResponse{
  4916. Header: res.Header,
  4917. HTTPStatusCode: res.StatusCode,
  4918. },
  4919. }
  4920. target := &ret
  4921. if err := gensupport.DecodeResponse(target, res); err != nil {
  4922. return nil, err
  4923. }
  4924. return ret, nil
  4925. // {
  4926. // "description": "Unclaims a batch of devices for a customer asynchronously. Removes the\ndevices from zero-touch enrollment. To learn more, read [Long‑running batch\noperations](/zero-touch/guides/how-it-works#operations).",
  4927. // "flatPath": "v1/partners/{partnersId}/devices:unclaimAsync",
  4928. // "httpMethod": "POST",
  4929. // "id": "androiddeviceprovisioning.partners.devices.unclaimAsync",
  4930. // "parameterOrder": [
  4931. // "partnerId"
  4932. // ],
  4933. // "parameters": {
  4934. // "partnerId": {
  4935. // "description": "Required. The reseller partner ID.",
  4936. // "format": "int64",
  4937. // "location": "path",
  4938. // "pattern": "^[^/]+$",
  4939. // "required": true,
  4940. // "type": "string"
  4941. // }
  4942. // },
  4943. // "path": "v1/partners/{+partnerId}/devices:unclaimAsync",
  4944. // "request": {
  4945. // "$ref": "UnclaimDevicesRequest"
  4946. // },
  4947. // "response": {
  4948. // "$ref": "Operation"
  4949. // }
  4950. // }
  4951. }
  4952. // method id "androiddeviceprovisioning.partners.devices.updateMetadataAsync":
  4953. type PartnersDevicesUpdateMetadataAsyncCall struct {
  4954. s *Service
  4955. partnerId int64
  4956. updatedevicemetadatainbatchrequest *UpdateDeviceMetadataInBatchRequest
  4957. urlParams_ gensupport.URLParams
  4958. ctx_ context.Context
  4959. header_ http.Header
  4960. }
  4961. // UpdateMetadataAsync: Updates the reseller metadata attached to a
  4962. // batch of devices. This method
  4963. // updates devices asynchronously and returns an `Operation` that can be
  4964. // used
  4965. // to track progress. Read [Long‑running
  4966. // batch
  4967. // operations](/zero-touch/guides/how-it-works#operations).
  4968. func (r *PartnersDevicesService) UpdateMetadataAsync(partnerId int64, updatedevicemetadatainbatchrequest *UpdateDeviceMetadataInBatchRequest) *PartnersDevicesUpdateMetadataAsyncCall {
  4969. c := &PartnersDevicesUpdateMetadataAsyncCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4970. c.partnerId = partnerId
  4971. c.updatedevicemetadatainbatchrequest = updatedevicemetadatainbatchrequest
  4972. return c
  4973. }
  4974. // Fields allows partial responses to be retrieved. See
  4975. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4976. // for more information.
  4977. func (c *PartnersDevicesUpdateMetadataAsyncCall) Fields(s ...googleapi.Field) *PartnersDevicesUpdateMetadataAsyncCall {
  4978. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4979. return c
  4980. }
  4981. // Context sets the context to be used in this call's Do method. Any
  4982. // pending HTTP request will be aborted if the provided context is
  4983. // canceled.
  4984. func (c *PartnersDevicesUpdateMetadataAsyncCall) Context(ctx context.Context) *PartnersDevicesUpdateMetadataAsyncCall {
  4985. c.ctx_ = ctx
  4986. return c
  4987. }
  4988. // Header returns an http.Header that can be modified by the caller to
  4989. // add HTTP headers to the request.
  4990. func (c *PartnersDevicesUpdateMetadataAsyncCall) Header() http.Header {
  4991. if c.header_ == nil {
  4992. c.header_ = make(http.Header)
  4993. }
  4994. return c.header_
  4995. }
  4996. func (c *PartnersDevicesUpdateMetadataAsyncCall) doRequest(alt string) (*http.Response, error) {
  4997. reqHeaders := make(http.Header)
  4998. for k, v := range c.header_ {
  4999. reqHeaders[k] = v
  5000. }
  5001. reqHeaders.Set("User-Agent", c.s.userAgent())
  5002. var body io.Reader = nil
  5003. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatedevicemetadatainbatchrequest)
  5004. if err != nil {
  5005. return nil, err
  5006. }
  5007. reqHeaders.Set("Content-Type", "application/json")
  5008. c.urlParams_.Set("alt", alt)
  5009. c.urlParams_.Set("prettyPrint", "false")
  5010. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/partners/{+partnerId}/devices:updateMetadataAsync")
  5011. urls += "?" + c.urlParams_.Encode()
  5012. req, err := http.NewRequest("POST", urls, body)
  5013. if err != nil {
  5014. return nil, err
  5015. }
  5016. req.Header = reqHeaders
  5017. googleapi.Expand(req.URL, map[string]string{
  5018. "partnerId": strconv.FormatInt(c.partnerId, 10),
  5019. })
  5020. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5021. }
  5022. // Do executes the "androiddeviceprovisioning.partners.devices.updateMetadataAsync" call.
  5023. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  5024. // status code is an error. Response headers are in either
  5025. // *Operation.ServerResponse.Header or (if a response was returned at
  5026. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5027. // to check whether the returned error was because
  5028. // http.StatusNotModified was returned.
  5029. func (c *PartnersDevicesUpdateMetadataAsyncCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  5030. gensupport.SetOptions(c.urlParams_, opts...)
  5031. res, err := c.doRequest("json")
  5032. if res != nil && res.StatusCode == http.StatusNotModified {
  5033. if res.Body != nil {
  5034. res.Body.Close()
  5035. }
  5036. return nil, &googleapi.Error{
  5037. Code: res.StatusCode,
  5038. Header: res.Header,
  5039. }
  5040. }
  5041. if err != nil {
  5042. return nil, err
  5043. }
  5044. defer googleapi.CloseBody(res)
  5045. if err := googleapi.CheckResponse(res); err != nil {
  5046. return nil, err
  5047. }
  5048. ret := &Operation{
  5049. ServerResponse: googleapi.ServerResponse{
  5050. Header: res.Header,
  5051. HTTPStatusCode: res.StatusCode,
  5052. },
  5053. }
  5054. target := &ret
  5055. if err := gensupport.DecodeResponse(target, res); err != nil {
  5056. return nil, err
  5057. }
  5058. return ret, nil
  5059. // {
  5060. // "description": "Updates the reseller metadata attached to a batch of devices. This method\nupdates devices asynchronously and returns an `Operation` that can be used\nto track progress. Read [Long‑running batch\noperations](/zero-touch/guides/how-it-works#operations).",
  5061. // "flatPath": "v1/partners/{partnersId}/devices:updateMetadataAsync",
  5062. // "httpMethod": "POST",
  5063. // "id": "androiddeviceprovisioning.partners.devices.updateMetadataAsync",
  5064. // "parameterOrder": [
  5065. // "partnerId"
  5066. // ],
  5067. // "parameters": {
  5068. // "partnerId": {
  5069. // "description": "Required. The reseller partner ID.",
  5070. // "format": "int64",
  5071. // "location": "path",
  5072. // "pattern": "^[^/]+$",
  5073. // "required": true,
  5074. // "type": "string"
  5075. // }
  5076. // },
  5077. // "path": "v1/partners/{+partnerId}/devices:updateMetadataAsync",
  5078. // "request": {
  5079. // "$ref": "UpdateDeviceMetadataInBatchRequest"
  5080. // },
  5081. // "response": {
  5082. // "$ref": "Operation"
  5083. // }
  5084. // }
  5085. }
  5086. // method id "androiddeviceprovisioning.partners.vendors.list":
  5087. type PartnersVendorsListCall struct {
  5088. s *Service
  5089. parent string
  5090. urlParams_ gensupport.URLParams
  5091. ifNoneMatch_ string
  5092. ctx_ context.Context
  5093. header_ http.Header
  5094. }
  5095. // List: Lists the vendors of the partner.
  5096. func (r *PartnersVendorsService) List(parent string) *PartnersVendorsListCall {
  5097. c := &PartnersVendorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5098. c.parent = parent
  5099. return c
  5100. }
  5101. // PageSize sets the optional parameter "pageSize": The maximum number
  5102. // of results to be returned.
  5103. func (c *PartnersVendorsListCall) PageSize(pageSize int64) *PartnersVendorsListCall {
  5104. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5105. return c
  5106. }
  5107. // PageToken sets the optional parameter "pageToken": A token
  5108. // identifying a page of results returned by the server.
  5109. func (c *PartnersVendorsListCall) PageToken(pageToken string) *PartnersVendorsListCall {
  5110. c.urlParams_.Set("pageToken", pageToken)
  5111. return c
  5112. }
  5113. // Fields allows partial responses to be retrieved. See
  5114. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5115. // for more information.
  5116. func (c *PartnersVendorsListCall) Fields(s ...googleapi.Field) *PartnersVendorsListCall {
  5117. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5118. return c
  5119. }
  5120. // IfNoneMatch sets the optional parameter which makes the operation
  5121. // fail if the object's ETag matches the given value. This is useful for
  5122. // getting updates only after the object has changed since the last
  5123. // request. Use googleapi.IsNotModified to check whether the response
  5124. // error from Do is the result of In-None-Match.
  5125. func (c *PartnersVendorsListCall) IfNoneMatch(entityTag string) *PartnersVendorsListCall {
  5126. c.ifNoneMatch_ = entityTag
  5127. return c
  5128. }
  5129. // Context sets the context to be used in this call's Do method. Any
  5130. // pending HTTP request will be aborted if the provided context is
  5131. // canceled.
  5132. func (c *PartnersVendorsListCall) Context(ctx context.Context) *PartnersVendorsListCall {
  5133. c.ctx_ = ctx
  5134. return c
  5135. }
  5136. // Header returns an http.Header that can be modified by the caller to
  5137. // add HTTP headers to the request.
  5138. func (c *PartnersVendorsListCall) Header() http.Header {
  5139. if c.header_ == nil {
  5140. c.header_ = make(http.Header)
  5141. }
  5142. return c.header_
  5143. }
  5144. func (c *PartnersVendorsListCall) doRequest(alt string) (*http.Response, error) {
  5145. reqHeaders := make(http.Header)
  5146. for k, v := range c.header_ {
  5147. reqHeaders[k] = v
  5148. }
  5149. reqHeaders.Set("User-Agent", c.s.userAgent())
  5150. if c.ifNoneMatch_ != "" {
  5151. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5152. }
  5153. var body io.Reader = nil
  5154. c.urlParams_.Set("alt", alt)
  5155. c.urlParams_.Set("prettyPrint", "false")
  5156. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/vendors")
  5157. urls += "?" + c.urlParams_.Encode()
  5158. req, err := http.NewRequest("GET", urls, body)
  5159. if err != nil {
  5160. return nil, err
  5161. }
  5162. req.Header = reqHeaders
  5163. googleapi.Expand(req.URL, map[string]string{
  5164. "parent": c.parent,
  5165. })
  5166. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5167. }
  5168. // Do executes the "androiddeviceprovisioning.partners.vendors.list" call.
  5169. // Exactly one of *ListVendorsResponse or error will be non-nil. Any
  5170. // non-2xx status code is an error. Response headers are in either
  5171. // *ListVendorsResponse.ServerResponse.Header or (if a response was
  5172. // returned at all) in error.(*googleapi.Error).Header. Use
  5173. // googleapi.IsNotModified to check whether the returned error was
  5174. // because http.StatusNotModified was returned.
  5175. func (c *PartnersVendorsListCall) Do(opts ...googleapi.CallOption) (*ListVendorsResponse, error) {
  5176. gensupport.SetOptions(c.urlParams_, opts...)
  5177. res, err := c.doRequest("json")
  5178. if res != nil && res.StatusCode == http.StatusNotModified {
  5179. if res.Body != nil {
  5180. res.Body.Close()
  5181. }
  5182. return nil, &googleapi.Error{
  5183. Code: res.StatusCode,
  5184. Header: res.Header,
  5185. }
  5186. }
  5187. if err != nil {
  5188. return nil, err
  5189. }
  5190. defer googleapi.CloseBody(res)
  5191. if err := googleapi.CheckResponse(res); err != nil {
  5192. return nil, err
  5193. }
  5194. ret := &ListVendorsResponse{
  5195. ServerResponse: googleapi.ServerResponse{
  5196. Header: res.Header,
  5197. HTTPStatusCode: res.StatusCode,
  5198. },
  5199. }
  5200. target := &ret
  5201. if err := gensupport.DecodeResponse(target, res); err != nil {
  5202. return nil, err
  5203. }
  5204. return ret, nil
  5205. // {
  5206. // "description": "Lists the vendors of the partner.",
  5207. // "flatPath": "v1/partners/{partnersId}/vendors",
  5208. // "httpMethod": "GET",
  5209. // "id": "androiddeviceprovisioning.partners.vendors.list",
  5210. // "parameterOrder": [
  5211. // "parent"
  5212. // ],
  5213. // "parameters": {
  5214. // "pageSize": {
  5215. // "description": "The maximum number of results to be returned.",
  5216. // "format": "int32",
  5217. // "location": "query",
  5218. // "type": "integer"
  5219. // },
  5220. // "pageToken": {
  5221. // "description": "A token identifying a page of results returned by the server.",
  5222. // "location": "query",
  5223. // "type": "string"
  5224. // },
  5225. // "parent": {
  5226. // "description": "Required. The resource name in the format `partners/[PARTNER_ID]`.",
  5227. // "location": "path",
  5228. // "pattern": "^partners/[^/]+$",
  5229. // "required": true,
  5230. // "type": "string"
  5231. // }
  5232. // },
  5233. // "path": "v1/{+parent}/vendors",
  5234. // "response": {
  5235. // "$ref": "ListVendorsResponse"
  5236. // }
  5237. // }
  5238. }
  5239. // Pages invokes f for each page of results.
  5240. // A non-nil error returned from f will halt the iteration.
  5241. // The provided context supersedes any context provided to the Context method.
  5242. func (c *PartnersVendorsListCall) Pages(ctx context.Context, f func(*ListVendorsResponse) error) error {
  5243. c.ctx_ = ctx
  5244. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5245. for {
  5246. x, err := c.Do()
  5247. if err != nil {
  5248. return err
  5249. }
  5250. if err := f(x); err != nil {
  5251. return err
  5252. }
  5253. if x.NextPageToken == "" {
  5254. return nil
  5255. }
  5256. c.PageToken(x.NextPageToken)
  5257. }
  5258. }
  5259. // method id "androiddeviceprovisioning.partners.vendors.customers.list":
  5260. type PartnersVendorsCustomersListCall struct {
  5261. s *Service
  5262. parent string
  5263. urlParams_ gensupport.URLParams
  5264. ifNoneMatch_ string
  5265. ctx_ context.Context
  5266. header_ http.Header
  5267. }
  5268. // List: Lists the customers of the vendor.
  5269. func (r *PartnersVendorsCustomersService) List(parent string) *PartnersVendorsCustomersListCall {
  5270. c := &PartnersVendorsCustomersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5271. c.parent = parent
  5272. return c
  5273. }
  5274. // PageSize sets the optional parameter "pageSize": The maximum number
  5275. // of results to be returned.
  5276. func (c *PartnersVendorsCustomersListCall) PageSize(pageSize int64) *PartnersVendorsCustomersListCall {
  5277. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5278. return c
  5279. }
  5280. // PageToken sets the optional parameter "pageToken": A token
  5281. // identifying a page of results returned by the server.
  5282. func (c *PartnersVendorsCustomersListCall) PageToken(pageToken string) *PartnersVendorsCustomersListCall {
  5283. c.urlParams_.Set("pageToken", pageToken)
  5284. return c
  5285. }
  5286. // Fields allows partial responses to be retrieved. See
  5287. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5288. // for more information.
  5289. func (c *PartnersVendorsCustomersListCall) Fields(s ...googleapi.Field) *PartnersVendorsCustomersListCall {
  5290. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5291. return c
  5292. }
  5293. // IfNoneMatch sets the optional parameter which makes the operation
  5294. // fail if the object's ETag matches the given value. This is useful for
  5295. // getting updates only after the object has changed since the last
  5296. // request. Use googleapi.IsNotModified to check whether the response
  5297. // error from Do is the result of In-None-Match.
  5298. func (c *PartnersVendorsCustomersListCall) IfNoneMatch(entityTag string) *PartnersVendorsCustomersListCall {
  5299. c.ifNoneMatch_ = entityTag
  5300. return c
  5301. }
  5302. // Context sets the context to be used in this call's Do method. Any
  5303. // pending HTTP request will be aborted if the provided context is
  5304. // canceled.
  5305. func (c *PartnersVendorsCustomersListCall) Context(ctx context.Context) *PartnersVendorsCustomersListCall {
  5306. c.ctx_ = ctx
  5307. return c
  5308. }
  5309. // Header returns an http.Header that can be modified by the caller to
  5310. // add HTTP headers to the request.
  5311. func (c *PartnersVendorsCustomersListCall) Header() http.Header {
  5312. if c.header_ == nil {
  5313. c.header_ = make(http.Header)
  5314. }
  5315. return c.header_
  5316. }
  5317. func (c *PartnersVendorsCustomersListCall) doRequest(alt string) (*http.Response, error) {
  5318. reqHeaders := make(http.Header)
  5319. for k, v := range c.header_ {
  5320. reqHeaders[k] = v
  5321. }
  5322. reqHeaders.Set("User-Agent", c.s.userAgent())
  5323. if c.ifNoneMatch_ != "" {
  5324. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5325. }
  5326. var body io.Reader = nil
  5327. c.urlParams_.Set("alt", alt)
  5328. c.urlParams_.Set("prettyPrint", "false")
  5329. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/customers")
  5330. urls += "?" + c.urlParams_.Encode()
  5331. req, err := http.NewRequest("GET", urls, body)
  5332. if err != nil {
  5333. return nil, err
  5334. }
  5335. req.Header = reqHeaders
  5336. googleapi.Expand(req.URL, map[string]string{
  5337. "parent": c.parent,
  5338. })
  5339. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5340. }
  5341. // Do executes the "androiddeviceprovisioning.partners.vendors.customers.list" call.
  5342. // Exactly one of *ListVendorCustomersResponse or error will be non-nil.
  5343. // Any non-2xx status code is an error. Response headers are in either
  5344. // *ListVendorCustomersResponse.ServerResponse.Header or (if a response
  5345. // was returned at all) in error.(*googleapi.Error).Header. Use
  5346. // googleapi.IsNotModified to check whether the returned error was
  5347. // because http.StatusNotModified was returned.
  5348. func (c *PartnersVendorsCustomersListCall) Do(opts ...googleapi.CallOption) (*ListVendorCustomersResponse, error) {
  5349. gensupport.SetOptions(c.urlParams_, opts...)
  5350. res, err := c.doRequest("json")
  5351. if res != nil && res.StatusCode == http.StatusNotModified {
  5352. if res.Body != nil {
  5353. res.Body.Close()
  5354. }
  5355. return nil, &googleapi.Error{
  5356. Code: res.StatusCode,
  5357. Header: res.Header,
  5358. }
  5359. }
  5360. if err != nil {
  5361. return nil, err
  5362. }
  5363. defer googleapi.CloseBody(res)
  5364. if err := googleapi.CheckResponse(res); err != nil {
  5365. return nil, err
  5366. }
  5367. ret := &ListVendorCustomersResponse{
  5368. ServerResponse: googleapi.ServerResponse{
  5369. Header: res.Header,
  5370. HTTPStatusCode: res.StatusCode,
  5371. },
  5372. }
  5373. target := &ret
  5374. if err := gensupport.DecodeResponse(target, res); err != nil {
  5375. return nil, err
  5376. }
  5377. return ret, nil
  5378. // {
  5379. // "description": "Lists the customers of the vendor.",
  5380. // "flatPath": "v1/partners/{partnersId}/vendors/{vendorsId}/customers",
  5381. // "httpMethod": "GET",
  5382. // "id": "androiddeviceprovisioning.partners.vendors.customers.list",
  5383. // "parameterOrder": [
  5384. // "parent"
  5385. // ],
  5386. // "parameters": {
  5387. // "pageSize": {
  5388. // "description": "The maximum number of results to be returned.",
  5389. // "format": "int32",
  5390. // "location": "query",
  5391. // "type": "integer"
  5392. // },
  5393. // "pageToken": {
  5394. // "description": "A token identifying a page of results returned by the server.",
  5395. // "location": "query",
  5396. // "type": "string"
  5397. // },
  5398. // "parent": {
  5399. // "description": "Required. The resource name in the format\n`partners/[PARTNER_ID]/vendors/[VENDOR_ID]`.",
  5400. // "location": "path",
  5401. // "pattern": "^partners/[^/]+/vendors/[^/]+$",
  5402. // "required": true,
  5403. // "type": "string"
  5404. // }
  5405. // },
  5406. // "path": "v1/{+parent}/customers",
  5407. // "response": {
  5408. // "$ref": "ListVendorCustomersResponse"
  5409. // }
  5410. // }
  5411. }
  5412. // Pages invokes f for each page of results.
  5413. // A non-nil error returned from f will halt the iteration.
  5414. // The provided context supersedes any context provided to the Context method.
  5415. func (c *PartnersVendorsCustomersListCall) Pages(ctx context.Context, f func(*ListVendorCustomersResponse) error) error {
  5416. c.ctx_ = ctx
  5417. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5418. for {
  5419. x, err := c.Do()
  5420. if err != nil {
  5421. return err
  5422. }
  5423. if err := f(x); err != nil {
  5424. return err
  5425. }
  5426. if x.NextPageToken == "" {
  5427. return nil
  5428. }
  5429. c.PageToken(x.NextPageToken)
  5430. }
  5431. }