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.
 
 
 

1245 lines
41 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 admin provides access to the Admin Data Transfer API.
  6. //
  7. // For product documentation, see: https://developers.google.com/admin-sdk/data-transfer/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/admin/datatransfer/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // adminService, err := admin.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // adminService, err := admin.NewService(ctx, option.WithScopes(admin.AdminDatatransferReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // adminService, err := admin.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // adminService, err := admin.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package admin // import "google.golang.org/api/admin/datatransfer/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "admin:datatransfer_v1"
  71. const apiName = "admin"
  72. const apiVersion = "datatransfer_v1"
  73. const basePath = "https://www.googleapis.com/admin/datatransfer/v1/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage data transfers between users in your organization
  77. AdminDatatransferScope = "https://www.googleapis.com/auth/admin.datatransfer"
  78. // View data transfers between users in your organization
  79. AdminDatatransferReadonlyScope = "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  80. )
  81. // NewService creates a new Service.
  82. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  83. scopesOption := option.WithScopes(
  84. "https://www.googleapis.com/auth/admin.datatransfer",
  85. "https://www.googleapis.com/auth/admin.datatransfer.readonly",
  86. )
  87. // NOTE: prepend, so we don't override user-specified scopes.
  88. opts = append([]option.ClientOption{scopesOption}, opts...)
  89. client, endpoint, err := htransport.NewClient(ctx, opts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. s, err := New(client)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if endpoint != "" {
  98. s.BasePath = endpoint
  99. }
  100. return s, nil
  101. }
  102. // New creates a new Service. It uses the provided http.Client for requests.
  103. //
  104. // Deprecated: please use NewService instead.
  105. // To provide a custom HTTP client, use option.WithHTTPClient.
  106. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  107. func New(client *http.Client) (*Service, error) {
  108. if client == nil {
  109. return nil, errors.New("client is nil")
  110. }
  111. s := &Service{client: client, BasePath: basePath}
  112. s.Applications = NewApplicationsService(s)
  113. s.Transfers = NewTransfersService(s)
  114. return s, nil
  115. }
  116. type Service struct {
  117. client *http.Client
  118. BasePath string // API endpoint base URL
  119. UserAgent string // optional additional User-Agent fragment
  120. Applications *ApplicationsService
  121. Transfers *TransfersService
  122. }
  123. func (s *Service) userAgent() string {
  124. if s.UserAgent == "" {
  125. return googleapi.UserAgent
  126. }
  127. return googleapi.UserAgent + " " + s.UserAgent
  128. }
  129. func NewApplicationsService(s *Service) *ApplicationsService {
  130. rs := &ApplicationsService{s: s}
  131. return rs
  132. }
  133. type ApplicationsService struct {
  134. s *Service
  135. }
  136. func NewTransfersService(s *Service) *TransfersService {
  137. rs := &TransfersService{s: s}
  138. return rs
  139. }
  140. type TransfersService struct {
  141. s *Service
  142. }
  143. // Application: The JSON template for an Application resource.
  144. type Application struct {
  145. // Etag: Etag of the resource.
  146. Etag string `json:"etag,omitempty"`
  147. // Id: The application's ID.
  148. Id int64 `json:"id,omitempty,string"`
  149. // Kind: Identifies the resource as a DataTransfer Application Resource.
  150. Kind string `json:"kind,omitempty"`
  151. // Name: The application's name.
  152. Name string `json:"name,omitempty"`
  153. // TransferParams: The list of all possible transfer parameters for this
  154. // application. These parameters can be used to select the data of the
  155. // user in this application to be transfered.
  156. TransferParams []*ApplicationTransferParam `json:"transferParams,omitempty"`
  157. // ServerResponse contains the HTTP response code and headers from the
  158. // server.
  159. googleapi.ServerResponse `json:"-"`
  160. // ForceSendFields is a list of field names (e.g. "Etag") to
  161. // unconditionally include in API requests. By default, fields with
  162. // empty values are omitted from API requests. However, any non-pointer,
  163. // non-interface field appearing in ForceSendFields will be sent to the
  164. // server regardless of whether the field is empty or not. This may be
  165. // used to include empty fields in Patch requests.
  166. ForceSendFields []string `json:"-"`
  167. // NullFields is a list of field names (e.g. "Etag") to include in API
  168. // requests with the JSON null value. By default, fields with empty
  169. // values are omitted from API requests. However, any field with an
  170. // empty value appearing in NullFields will be sent to the server as
  171. // null. It is an error if a field in this list has a non-empty value.
  172. // This may be used to include null fields in Patch requests.
  173. NullFields []string `json:"-"`
  174. }
  175. func (s *Application) MarshalJSON() ([]byte, error) {
  176. type NoMethod Application
  177. raw := NoMethod(*s)
  178. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  179. }
  180. // ApplicationDataTransfer: Template to map fields of
  181. // ApplicationDataTransfer resource.
  182. type ApplicationDataTransfer struct {
  183. // ApplicationId: The application's ID.
  184. ApplicationId int64 `json:"applicationId,omitempty,string"`
  185. // ApplicationTransferParams: The transfer parameters for the
  186. // application. These parameters are used to select the data which will
  187. // get transfered in context of this application.
  188. ApplicationTransferParams []*ApplicationTransferParam `json:"applicationTransferParams,omitempty"`
  189. // ApplicationTransferStatus: Current status of transfer for this
  190. // application. (Read-only)
  191. ApplicationTransferStatus string `json:"applicationTransferStatus,omitempty"`
  192. // ForceSendFields is a list of field names (e.g. "ApplicationId") to
  193. // unconditionally include in API requests. By default, fields with
  194. // empty values are omitted from API requests. However, any non-pointer,
  195. // non-interface field appearing in ForceSendFields will be sent to the
  196. // server regardless of whether the field is empty or not. This may be
  197. // used to include empty fields in Patch requests.
  198. ForceSendFields []string `json:"-"`
  199. // NullFields is a list of field names (e.g. "ApplicationId") to include
  200. // in API requests with the JSON null value. By default, fields with
  201. // empty values are omitted from API requests. However, any field with
  202. // an empty value appearing in NullFields will be sent to the server as
  203. // null. It is an error if a field in this list has a non-empty value.
  204. // This may be used to include null fields in Patch requests.
  205. NullFields []string `json:"-"`
  206. }
  207. func (s *ApplicationDataTransfer) MarshalJSON() ([]byte, error) {
  208. type NoMethod ApplicationDataTransfer
  209. raw := NoMethod(*s)
  210. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  211. }
  212. // ApplicationTransferParam: Template for application transfer
  213. // parameters.
  214. type ApplicationTransferParam struct {
  215. // Key: The type of the transfer parameter. eg: 'PRIVACY_LEVEL'
  216. Key string `json:"key,omitempty"`
  217. // Value: The value of the coressponding transfer parameter. eg:
  218. // 'PRIVATE' or 'SHARED'
  219. Value []string `json:"value,omitempty"`
  220. // ForceSendFields is a list of field names (e.g. "Key") to
  221. // unconditionally include in API requests. By default, fields with
  222. // empty values are omitted from API requests. However, any non-pointer,
  223. // non-interface field appearing in ForceSendFields will be sent to the
  224. // server regardless of whether the field is empty or not. This may be
  225. // used to include empty fields in Patch requests.
  226. ForceSendFields []string `json:"-"`
  227. // NullFields is a list of field names (e.g. "Key") to include in API
  228. // requests with the JSON null value. By default, fields with empty
  229. // values are omitted from API requests. However, any field with an
  230. // empty value appearing in NullFields will be sent to the server as
  231. // null. It is an error if a field in this list has a non-empty value.
  232. // This may be used to include null fields in Patch requests.
  233. NullFields []string `json:"-"`
  234. }
  235. func (s *ApplicationTransferParam) MarshalJSON() ([]byte, error) {
  236. type NoMethod ApplicationTransferParam
  237. raw := NoMethod(*s)
  238. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  239. }
  240. // ApplicationsListResponse: Template for a collection of Applications.
  241. type ApplicationsListResponse struct {
  242. // Applications: List of applications that support data transfer and are
  243. // also installed for the customer.
  244. Applications []*Application `json:"applications,omitempty"`
  245. // Etag: ETag of the resource.
  246. Etag string `json:"etag,omitempty"`
  247. // Kind: Identifies the resource as a collection of Applications.
  248. Kind string `json:"kind,omitempty"`
  249. // NextPageToken: Continuation token which will be used to specify next
  250. // page in list API.
  251. NextPageToken string `json:"nextPageToken,omitempty"`
  252. // ServerResponse contains the HTTP response code and headers from the
  253. // server.
  254. googleapi.ServerResponse `json:"-"`
  255. // ForceSendFields is a list of field names (e.g. "Applications") to
  256. // unconditionally include in API requests. By default, fields with
  257. // empty values are omitted from API requests. However, any non-pointer,
  258. // non-interface field appearing in ForceSendFields will be sent to the
  259. // server regardless of whether the field is empty or not. This may be
  260. // used to include empty fields in Patch requests.
  261. ForceSendFields []string `json:"-"`
  262. // NullFields is a list of field names (e.g. "Applications") to include
  263. // in API requests with the JSON null value. By default, fields with
  264. // empty values are omitted from API requests. However, any field with
  265. // an empty value appearing in NullFields will be sent to the server as
  266. // null. It is an error if a field in this list has a non-empty value.
  267. // This may be used to include null fields in Patch requests.
  268. NullFields []string `json:"-"`
  269. }
  270. func (s *ApplicationsListResponse) MarshalJSON() ([]byte, error) {
  271. type NoMethod ApplicationsListResponse
  272. raw := NoMethod(*s)
  273. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  274. }
  275. // DataTransfer: The JSON template for a DataTransfer resource.
  276. type DataTransfer struct {
  277. // ApplicationDataTransfers: List of per application data transfer
  278. // resources. It contains data transfer details of the applications
  279. // associated with this transfer resource. Note that this list is also
  280. // used to specify the applications for which data transfer has to be
  281. // done at the time of the transfer resource creation.
  282. ApplicationDataTransfers []*ApplicationDataTransfer `json:"applicationDataTransfers,omitempty"`
  283. // Etag: ETag of the resource.
  284. Etag string `json:"etag,omitempty"`
  285. // Id: The transfer's ID (Read-only).
  286. Id string `json:"id,omitempty"`
  287. // Kind: Identifies the resource as a DataTransfer request.
  288. Kind string `json:"kind,omitempty"`
  289. // NewOwnerUserId: ID of the user to whom the data is being transfered.
  290. NewOwnerUserId string `json:"newOwnerUserId,omitempty"`
  291. // OldOwnerUserId: ID of the user whose data is being transfered.
  292. OldOwnerUserId string `json:"oldOwnerUserId,omitempty"`
  293. // OverallTransferStatusCode: Overall transfer status (Read-only).
  294. OverallTransferStatusCode string `json:"overallTransferStatusCode,omitempty"`
  295. // RequestTime: The time at which the data transfer was requested
  296. // (Read-only).
  297. RequestTime string `json:"requestTime,omitempty"`
  298. // ServerResponse contains the HTTP response code and headers from the
  299. // server.
  300. googleapi.ServerResponse `json:"-"`
  301. // ForceSendFields is a list of field names (e.g.
  302. // "ApplicationDataTransfers") to unconditionally include in API
  303. // requests. By default, fields with empty values are omitted from API
  304. // requests. However, any non-pointer, non-interface field appearing in
  305. // ForceSendFields will be sent to the server regardless of whether the
  306. // field is empty or not. This may be used to include empty fields in
  307. // Patch requests.
  308. ForceSendFields []string `json:"-"`
  309. // NullFields is a list of field names (e.g. "ApplicationDataTransfers")
  310. // to include in API requests with the JSON null value. By default,
  311. // fields with empty values are omitted from API requests. However, any
  312. // field with an empty value appearing in NullFields will be sent to the
  313. // server as null. It is an error if a field in this list has a
  314. // non-empty value. This may be used to include null fields in Patch
  315. // requests.
  316. NullFields []string `json:"-"`
  317. }
  318. func (s *DataTransfer) MarshalJSON() ([]byte, error) {
  319. type NoMethod DataTransfer
  320. raw := NoMethod(*s)
  321. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  322. }
  323. // DataTransfersListResponse: Template for a collection of DataTransfer
  324. // resources.
  325. type DataTransfersListResponse struct {
  326. // DataTransfers: List of data transfer requests.
  327. DataTransfers []*DataTransfer `json:"dataTransfers,omitempty"`
  328. // Etag: ETag of the resource.
  329. Etag string `json:"etag,omitempty"`
  330. // Kind: Identifies the resource as a collection of data transfer
  331. // requests.
  332. Kind string `json:"kind,omitempty"`
  333. // NextPageToken: Continuation token which will be used to specify next
  334. // page in list API.
  335. NextPageToken string `json:"nextPageToken,omitempty"`
  336. // ServerResponse contains the HTTP response code and headers from the
  337. // server.
  338. googleapi.ServerResponse `json:"-"`
  339. // ForceSendFields is a list of field names (e.g. "DataTransfers") to
  340. // unconditionally include in API requests. By default, fields with
  341. // empty values are omitted from API requests. However, any non-pointer,
  342. // non-interface field appearing in ForceSendFields will be sent to the
  343. // server regardless of whether the field is empty or not. This may be
  344. // used to include empty fields in Patch requests.
  345. ForceSendFields []string `json:"-"`
  346. // NullFields is a list of field names (e.g. "DataTransfers") to include
  347. // in API requests with the JSON null value. By default, fields with
  348. // empty values are omitted from API requests. However, any field with
  349. // an empty value appearing in NullFields will be sent to the server as
  350. // null. It is an error if a field in this list has a non-empty value.
  351. // This may be used to include null fields in Patch requests.
  352. NullFields []string `json:"-"`
  353. }
  354. func (s *DataTransfersListResponse) MarshalJSON() ([]byte, error) {
  355. type NoMethod DataTransfersListResponse
  356. raw := NoMethod(*s)
  357. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  358. }
  359. // method id "datatransfer.applications.get":
  360. type ApplicationsGetCall struct {
  361. s *Service
  362. applicationId int64
  363. urlParams_ gensupport.URLParams
  364. ifNoneMatch_ string
  365. ctx_ context.Context
  366. header_ http.Header
  367. }
  368. // Get: Retrieves information about an application for the given
  369. // application ID.
  370. func (r *ApplicationsService) Get(applicationId int64) *ApplicationsGetCall {
  371. c := &ApplicationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  372. c.applicationId = applicationId
  373. return c
  374. }
  375. // Fields allows partial responses to be retrieved. See
  376. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  377. // for more information.
  378. func (c *ApplicationsGetCall) Fields(s ...googleapi.Field) *ApplicationsGetCall {
  379. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  380. return c
  381. }
  382. // IfNoneMatch sets the optional parameter which makes the operation
  383. // fail if the object's ETag matches the given value. This is useful for
  384. // getting updates only after the object has changed since the last
  385. // request. Use googleapi.IsNotModified to check whether the response
  386. // error from Do is the result of In-None-Match.
  387. func (c *ApplicationsGetCall) IfNoneMatch(entityTag string) *ApplicationsGetCall {
  388. c.ifNoneMatch_ = entityTag
  389. return c
  390. }
  391. // Context sets the context to be used in this call's Do method. Any
  392. // pending HTTP request will be aborted if the provided context is
  393. // canceled.
  394. func (c *ApplicationsGetCall) Context(ctx context.Context) *ApplicationsGetCall {
  395. c.ctx_ = ctx
  396. return c
  397. }
  398. // Header returns an http.Header that can be modified by the caller to
  399. // add HTTP headers to the request.
  400. func (c *ApplicationsGetCall) Header() http.Header {
  401. if c.header_ == nil {
  402. c.header_ = make(http.Header)
  403. }
  404. return c.header_
  405. }
  406. func (c *ApplicationsGetCall) doRequest(alt string) (*http.Response, error) {
  407. reqHeaders := make(http.Header)
  408. for k, v := range c.header_ {
  409. reqHeaders[k] = v
  410. }
  411. reqHeaders.Set("User-Agent", c.s.userAgent())
  412. if c.ifNoneMatch_ != "" {
  413. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  414. }
  415. var body io.Reader = nil
  416. c.urlParams_.Set("alt", alt)
  417. c.urlParams_.Set("prettyPrint", "false")
  418. urls := googleapi.ResolveRelative(c.s.BasePath, "applications/{applicationId}")
  419. urls += "?" + c.urlParams_.Encode()
  420. req, err := http.NewRequest("GET", urls, body)
  421. if err != nil {
  422. return nil, err
  423. }
  424. req.Header = reqHeaders
  425. googleapi.Expand(req.URL, map[string]string{
  426. "applicationId": strconv.FormatInt(c.applicationId, 10),
  427. })
  428. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  429. }
  430. // Do executes the "datatransfer.applications.get" call.
  431. // Exactly one of *Application or error will be non-nil. Any non-2xx
  432. // status code is an error. Response headers are in either
  433. // *Application.ServerResponse.Header or (if a response was returned at
  434. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  435. // to check whether the returned error was because
  436. // http.StatusNotModified was returned.
  437. func (c *ApplicationsGetCall) Do(opts ...googleapi.CallOption) (*Application, error) {
  438. gensupport.SetOptions(c.urlParams_, opts...)
  439. res, err := c.doRequest("json")
  440. if res != nil && res.StatusCode == http.StatusNotModified {
  441. if res.Body != nil {
  442. res.Body.Close()
  443. }
  444. return nil, &googleapi.Error{
  445. Code: res.StatusCode,
  446. Header: res.Header,
  447. }
  448. }
  449. if err != nil {
  450. return nil, err
  451. }
  452. defer googleapi.CloseBody(res)
  453. if err := googleapi.CheckResponse(res); err != nil {
  454. return nil, err
  455. }
  456. ret := &Application{
  457. ServerResponse: googleapi.ServerResponse{
  458. Header: res.Header,
  459. HTTPStatusCode: res.StatusCode,
  460. },
  461. }
  462. target := &ret
  463. if err := gensupport.DecodeResponse(target, res); err != nil {
  464. return nil, err
  465. }
  466. return ret, nil
  467. // {
  468. // "description": "Retrieves information about an application for the given application ID.",
  469. // "httpMethod": "GET",
  470. // "id": "datatransfer.applications.get",
  471. // "parameterOrder": [
  472. // "applicationId"
  473. // ],
  474. // "parameters": {
  475. // "applicationId": {
  476. // "description": "ID of the application resource to be retrieved.",
  477. // "format": "int64",
  478. // "location": "path",
  479. // "required": true,
  480. // "type": "string"
  481. // }
  482. // },
  483. // "path": "applications/{applicationId}",
  484. // "response": {
  485. // "$ref": "Application"
  486. // },
  487. // "scopes": [
  488. // "https://www.googleapis.com/auth/admin.datatransfer",
  489. // "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  490. // ]
  491. // }
  492. }
  493. // method id "datatransfer.applications.list":
  494. type ApplicationsListCall struct {
  495. s *Service
  496. urlParams_ gensupport.URLParams
  497. ifNoneMatch_ string
  498. ctx_ context.Context
  499. header_ http.Header
  500. }
  501. // List: Lists the applications available for data transfer for a
  502. // customer.
  503. func (r *ApplicationsService) List() *ApplicationsListCall {
  504. c := &ApplicationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  505. return c
  506. }
  507. // CustomerId sets the optional parameter "customerId": Immutable ID of
  508. // the Google Apps account.
  509. func (c *ApplicationsListCall) CustomerId(customerId string) *ApplicationsListCall {
  510. c.urlParams_.Set("customerId", customerId)
  511. return c
  512. }
  513. // MaxResults sets the optional parameter "maxResults": Maximum number
  514. // of results to return. Default is 100.
  515. func (c *ApplicationsListCall) MaxResults(maxResults int64) *ApplicationsListCall {
  516. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  517. return c
  518. }
  519. // PageToken sets the optional parameter "pageToken": Token to specify
  520. // next page in the list.
  521. func (c *ApplicationsListCall) PageToken(pageToken string) *ApplicationsListCall {
  522. c.urlParams_.Set("pageToken", pageToken)
  523. return c
  524. }
  525. // Fields allows partial responses to be retrieved. See
  526. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  527. // for more information.
  528. func (c *ApplicationsListCall) Fields(s ...googleapi.Field) *ApplicationsListCall {
  529. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  530. return c
  531. }
  532. // IfNoneMatch sets the optional parameter which makes the operation
  533. // fail if the object's ETag matches the given value. This is useful for
  534. // getting updates only after the object has changed since the last
  535. // request. Use googleapi.IsNotModified to check whether the response
  536. // error from Do is the result of In-None-Match.
  537. func (c *ApplicationsListCall) IfNoneMatch(entityTag string) *ApplicationsListCall {
  538. c.ifNoneMatch_ = entityTag
  539. return c
  540. }
  541. // Context sets the context to be used in this call's Do method. Any
  542. // pending HTTP request will be aborted if the provided context is
  543. // canceled.
  544. func (c *ApplicationsListCall) Context(ctx context.Context) *ApplicationsListCall {
  545. c.ctx_ = ctx
  546. return c
  547. }
  548. // Header returns an http.Header that can be modified by the caller to
  549. // add HTTP headers to the request.
  550. func (c *ApplicationsListCall) Header() http.Header {
  551. if c.header_ == nil {
  552. c.header_ = make(http.Header)
  553. }
  554. return c.header_
  555. }
  556. func (c *ApplicationsListCall) doRequest(alt string) (*http.Response, error) {
  557. reqHeaders := make(http.Header)
  558. for k, v := range c.header_ {
  559. reqHeaders[k] = v
  560. }
  561. reqHeaders.Set("User-Agent", c.s.userAgent())
  562. if c.ifNoneMatch_ != "" {
  563. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  564. }
  565. var body io.Reader = nil
  566. c.urlParams_.Set("alt", alt)
  567. c.urlParams_.Set("prettyPrint", "false")
  568. urls := googleapi.ResolveRelative(c.s.BasePath, "applications")
  569. urls += "?" + c.urlParams_.Encode()
  570. req, err := http.NewRequest("GET", urls, body)
  571. if err != nil {
  572. return nil, err
  573. }
  574. req.Header = reqHeaders
  575. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  576. }
  577. // Do executes the "datatransfer.applications.list" call.
  578. // Exactly one of *ApplicationsListResponse or error will be non-nil.
  579. // Any non-2xx status code is an error. Response headers are in either
  580. // *ApplicationsListResponse.ServerResponse.Header or (if a response was
  581. // returned at all) in error.(*googleapi.Error).Header. Use
  582. // googleapi.IsNotModified to check whether the returned error was
  583. // because http.StatusNotModified was returned.
  584. func (c *ApplicationsListCall) Do(opts ...googleapi.CallOption) (*ApplicationsListResponse, error) {
  585. gensupport.SetOptions(c.urlParams_, opts...)
  586. res, err := c.doRequest("json")
  587. if res != nil && res.StatusCode == http.StatusNotModified {
  588. if res.Body != nil {
  589. res.Body.Close()
  590. }
  591. return nil, &googleapi.Error{
  592. Code: res.StatusCode,
  593. Header: res.Header,
  594. }
  595. }
  596. if err != nil {
  597. return nil, err
  598. }
  599. defer googleapi.CloseBody(res)
  600. if err := googleapi.CheckResponse(res); err != nil {
  601. return nil, err
  602. }
  603. ret := &ApplicationsListResponse{
  604. ServerResponse: googleapi.ServerResponse{
  605. Header: res.Header,
  606. HTTPStatusCode: res.StatusCode,
  607. },
  608. }
  609. target := &ret
  610. if err := gensupport.DecodeResponse(target, res); err != nil {
  611. return nil, err
  612. }
  613. return ret, nil
  614. // {
  615. // "description": "Lists the applications available for data transfer for a customer.",
  616. // "httpMethod": "GET",
  617. // "id": "datatransfer.applications.list",
  618. // "parameters": {
  619. // "customerId": {
  620. // "description": "Immutable ID of the Google Apps account.",
  621. // "location": "query",
  622. // "type": "string"
  623. // },
  624. // "maxResults": {
  625. // "description": "Maximum number of results to return. Default is 100.",
  626. // "format": "int32",
  627. // "location": "query",
  628. // "maximum": "500",
  629. // "minimum": "1",
  630. // "type": "integer"
  631. // },
  632. // "pageToken": {
  633. // "description": "Token to specify next page in the list.",
  634. // "location": "query",
  635. // "type": "string"
  636. // }
  637. // },
  638. // "path": "applications",
  639. // "response": {
  640. // "$ref": "ApplicationsListResponse"
  641. // },
  642. // "scopes": [
  643. // "https://www.googleapis.com/auth/admin.datatransfer",
  644. // "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  645. // ]
  646. // }
  647. }
  648. // Pages invokes f for each page of results.
  649. // A non-nil error returned from f will halt the iteration.
  650. // The provided context supersedes any context provided to the Context method.
  651. func (c *ApplicationsListCall) Pages(ctx context.Context, f func(*ApplicationsListResponse) error) error {
  652. c.ctx_ = ctx
  653. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  654. for {
  655. x, err := c.Do()
  656. if err != nil {
  657. return err
  658. }
  659. if err := f(x); err != nil {
  660. return err
  661. }
  662. if x.NextPageToken == "" {
  663. return nil
  664. }
  665. c.PageToken(x.NextPageToken)
  666. }
  667. }
  668. // method id "datatransfer.transfers.get":
  669. type TransfersGetCall struct {
  670. s *Service
  671. dataTransferId string
  672. urlParams_ gensupport.URLParams
  673. ifNoneMatch_ string
  674. ctx_ context.Context
  675. header_ http.Header
  676. }
  677. // Get: Retrieves a data transfer request by its resource ID.
  678. func (r *TransfersService) Get(dataTransferId string) *TransfersGetCall {
  679. c := &TransfersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  680. c.dataTransferId = dataTransferId
  681. return c
  682. }
  683. // Fields allows partial responses to be retrieved. See
  684. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  685. // for more information.
  686. func (c *TransfersGetCall) Fields(s ...googleapi.Field) *TransfersGetCall {
  687. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  688. return c
  689. }
  690. // IfNoneMatch sets the optional parameter which makes the operation
  691. // fail if the object's ETag matches the given value. This is useful for
  692. // getting updates only after the object has changed since the last
  693. // request. Use googleapi.IsNotModified to check whether the response
  694. // error from Do is the result of In-None-Match.
  695. func (c *TransfersGetCall) IfNoneMatch(entityTag string) *TransfersGetCall {
  696. c.ifNoneMatch_ = entityTag
  697. return c
  698. }
  699. // Context sets the context to be used in this call's Do method. Any
  700. // pending HTTP request will be aborted if the provided context is
  701. // canceled.
  702. func (c *TransfersGetCall) Context(ctx context.Context) *TransfersGetCall {
  703. c.ctx_ = ctx
  704. return c
  705. }
  706. // Header returns an http.Header that can be modified by the caller to
  707. // add HTTP headers to the request.
  708. func (c *TransfersGetCall) Header() http.Header {
  709. if c.header_ == nil {
  710. c.header_ = make(http.Header)
  711. }
  712. return c.header_
  713. }
  714. func (c *TransfersGetCall) doRequest(alt string) (*http.Response, error) {
  715. reqHeaders := make(http.Header)
  716. for k, v := range c.header_ {
  717. reqHeaders[k] = v
  718. }
  719. reqHeaders.Set("User-Agent", c.s.userAgent())
  720. if c.ifNoneMatch_ != "" {
  721. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  722. }
  723. var body io.Reader = nil
  724. c.urlParams_.Set("alt", alt)
  725. c.urlParams_.Set("prettyPrint", "false")
  726. urls := googleapi.ResolveRelative(c.s.BasePath, "transfers/{dataTransferId}")
  727. urls += "?" + c.urlParams_.Encode()
  728. req, err := http.NewRequest("GET", urls, body)
  729. if err != nil {
  730. return nil, err
  731. }
  732. req.Header = reqHeaders
  733. googleapi.Expand(req.URL, map[string]string{
  734. "dataTransferId": c.dataTransferId,
  735. })
  736. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  737. }
  738. // Do executes the "datatransfer.transfers.get" call.
  739. // Exactly one of *DataTransfer or error will be non-nil. Any non-2xx
  740. // status code is an error. Response headers are in either
  741. // *DataTransfer.ServerResponse.Header or (if a response was returned at
  742. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  743. // to check whether the returned error was because
  744. // http.StatusNotModified was returned.
  745. func (c *TransfersGetCall) Do(opts ...googleapi.CallOption) (*DataTransfer, error) {
  746. gensupport.SetOptions(c.urlParams_, opts...)
  747. res, err := c.doRequest("json")
  748. if res != nil && res.StatusCode == http.StatusNotModified {
  749. if res.Body != nil {
  750. res.Body.Close()
  751. }
  752. return nil, &googleapi.Error{
  753. Code: res.StatusCode,
  754. Header: res.Header,
  755. }
  756. }
  757. if err != nil {
  758. return nil, err
  759. }
  760. defer googleapi.CloseBody(res)
  761. if err := googleapi.CheckResponse(res); err != nil {
  762. return nil, err
  763. }
  764. ret := &DataTransfer{
  765. ServerResponse: googleapi.ServerResponse{
  766. Header: res.Header,
  767. HTTPStatusCode: res.StatusCode,
  768. },
  769. }
  770. target := &ret
  771. if err := gensupport.DecodeResponse(target, res); err != nil {
  772. return nil, err
  773. }
  774. return ret, nil
  775. // {
  776. // "description": "Retrieves a data transfer request by its resource ID.",
  777. // "httpMethod": "GET",
  778. // "id": "datatransfer.transfers.get",
  779. // "parameterOrder": [
  780. // "dataTransferId"
  781. // ],
  782. // "parameters": {
  783. // "dataTransferId": {
  784. // "description": "ID of the resource to be retrieved. This is returned in the response from the insert method.",
  785. // "location": "path",
  786. // "required": true,
  787. // "type": "string"
  788. // }
  789. // },
  790. // "path": "transfers/{dataTransferId}",
  791. // "response": {
  792. // "$ref": "DataTransfer"
  793. // },
  794. // "scopes": [
  795. // "https://www.googleapis.com/auth/admin.datatransfer",
  796. // "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  797. // ]
  798. // }
  799. }
  800. // method id "datatransfer.transfers.insert":
  801. type TransfersInsertCall struct {
  802. s *Service
  803. datatransfer *DataTransfer
  804. urlParams_ gensupport.URLParams
  805. ctx_ context.Context
  806. header_ http.Header
  807. }
  808. // Insert: Inserts a data transfer request.
  809. func (r *TransfersService) Insert(datatransfer *DataTransfer) *TransfersInsertCall {
  810. c := &TransfersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  811. c.datatransfer = datatransfer
  812. return c
  813. }
  814. // Fields allows partial responses to be retrieved. See
  815. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  816. // for more information.
  817. func (c *TransfersInsertCall) Fields(s ...googleapi.Field) *TransfersInsertCall {
  818. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  819. return c
  820. }
  821. // Context sets the context to be used in this call's Do method. Any
  822. // pending HTTP request will be aborted if the provided context is
  823. // canceled.
  824. func (c *TransfersInsertCall) Context(ctx context.Context) *TransfersInsertCall {
  825. c.ctx_ = ctx
  826. return c
  827. }
  828. // Header returns an http.Header that can be modified by the caller to
  829. // add HTTP headers to the request.
  830. func (c *TransfersInsertCall) Header() http.Header {
  831. if c.header_ == nil {
  832. c.header_ = make(http.Header)
  833. }
  834. return c.header_
  835. }
  836. func (c *TransfersInsertCall) doRequest(alt string) (*http.Response, error) {
  837. reqHeaders := make(http.Header)
  838. for k, v := range c.header_ {
  839. reqHeaders[k] = v
  840. }
  841. reqHeaders.Set("User-Agent", c.s.userAgent())
  842. var body io.Reader = nil
  843. body, err := googleapi.WithoutDataWrapper.JSONReader(c.datatransfer)
  844. if err != nil {
  845. return nil, err
  846. }
  847. reqHeaders.Set("Content-Type", "application/json")
  848. c.urlParams_.Set("alt", alt)
  849. c.urlParams_.Set("prettyPrint", "false")
  850. urls := googleapi.ResolveRelative(c.s.BasePath, "transfers")
  851. urls += "?" + c.urlParams_.Encode()
  852. req, err := http.NewRequest("POST", urls, body)
  853. if err != nil {
  854. return nil, err
  855. }
  856. req.Header = reqHeaders
  857. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  858. }
  859. // Do executes the "datatransfer.transfers.insert" call.
  860. // Exactly one of *DataTransfer or error will be non-nil. Any non-2xx
  861. // status code is an error. Response headers are in either
  862. // *DataTransfer.ServerResponse.Header or (if a response was returned at
  863. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  864. // to check whether the returned error was because
  865. // http.StatusNotModified was returned.
  866. func (c *TransfersInsertCall) Do(opts ...googleapi.CallOption) (*DataTransfer, error) {
  867. gensupport.SetOptions(c.urlParams_, opts...)
  868. res, err := c.doRequest("json")
  869. if res != nil && res.StatusCode == http.StatusNotModified {
  870. if res.Body != nil {
  871. res.Body.Close()
  872. }
  873. return nil, &googleapi.Error{
  874. Code: res.StatusCode,
  875. Header: res.Header,
  876. }
  877. }
  878. if err != nil {
  879. return nil, err
  880. }
  881. defer googleapi.CloseBody(res)
  882. if err := googleapi.CheckResponse(res); err != nil {
  883. return nil, err
  884. }
  885. ret := &DataTransfer{
  886. ServerResponse: googleapi.ServerResponse{
  887. Header: res.Header,
  888. HTTPStatusCode: res.StatusCode,
  889. },
  890. }
  891. target := &ret
  892. if err := gensupport.DecodeResponse(target, res); err != nil {
  893. return nil, err
  894. }
  895. return ret, nil
  896. // {
  897. // "description": "Inserts a data transfer request.",
  898. // "httpMethod": "POST",
  899. // "id": "datatransfer.transfers.insert",
  900. // "path": "transfers",
  901. // "request": {
  902. // "$ref": "DataTransfer"
  903. // },
  904. // "response": {
  905. // "$ref": "DataTransfer"
  906. // },
  907. // "scopes": [
  908. // "https://www.googleapis.com/auth/admin.datatransfer"
  909. // ]
  910. // }
  911. }
  912. // method id "datatransfer.transfers.list":
  913. type TransfersListCall struct {
  914. s *Service
  915. urlParams_ gensupport.URLParams
  916. ifNoneMatch_ string
  917. ctx_ context.Context
  918. header_ http.Header
  919. }
  920. // List: Lists the transfers for a customer by source user, destination
  921. // user, or status.
  922. func (r *TransfersService) List() *TransfersListCall {
  923. c := &TransfersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  924. return c
  925. }
  926. // CustomerId sets the optional parameter "customerId": Immutable ID of
  927. // the Google Apps account.
  928. func (c *TransfersListCall) CustomerId(customerId string) *TransfersListCall {
  929. c.urlParams_.Set("customerId", customerId)
  930. return c
  931. }
  932. // MaxResults sets the optional parameter "maxResults": Maximum number
  933. // of results to return. Default is 100.
  934. func (c *TransfersListCall) MaxResults(maxResults int64) *TransfersListCall {
  935. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  936. return c
  937. }
  938. // NewOwnerUserId sets the optional parameter "newOwnerUserId":
  939. // Destination user's profile ID.
  940. func (c *TransfersListCall) NewOwnerUserId(newOwnerUserId string) *TransfersListCall {
  941. c.urlParams_.Set("newOwnerUserId", newOwnerUserId)
  942. return c
  943. }
  944. // OldOwnerUserId sets the optional parameter "oldOwnerUserId": Source
  945. // user's profile ID.
  946. func (c *TransfersListCall) OldOwnerUserId(oldOwnerUserId string) *TransfersListCall {
  947. c.urlParams_.Set("oldOwnerUserId", oldOwnerUserId)
  948. return c
  949. }
  950. // PageToken sets the optional parameter "pageToken": Token to specify
  951. // the next page in the list.
  952. func (c *TransfersListCall) PageToken(pageToken string) *TransfersListCall {
  953. c.urlParams_.Set("pageToken", pageToken)
  954. return c
  955. }
  956. // Status sets the optional parameter "status": Status of the transfer.
  957. func (c *TransfersListCall) Status(status string) *TransfersListCall {
  958. c.urlParams_.Set("status", status)
  959. return c
  960. }
  961. // Fields allows partial responses to be retrieved. See
  962. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  963. // for more information.
  964. func (c *TransfersListCall) Fields(s ...googleapi.Field) *TransfersListCall {
  965. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  966. return c
  967. }
  968. // IfNoneMatch sets the optional parameter which makes the operation
  969. // fail if the object's ETag matches the given value. This is useful for
  970. // getting updates only after the object has changed since the last
  971. // request. Use googleapi.IsNotModified to check whether the response
  972. // error from Do is the result of In-None-Match.
  973. func (c *TransfersListCall) IfNoneMatch(entityTag string) *TransfersListCall {
  974. c.ifNoneMatch_ = entityTag
  975. return c
  976. }
  977. // Context sets the context to be used in this call's Do method. Any
  978. // pending HTTP request will be aborted if the provided context is
  979. // canceled.
  980. func (c *TransfersListCall) Context(ctx context.Context) *TransfersListCall {
  981. c.ctx_ = ctx
  982. return c
  983. }
  984. // Header returns an http.Header that can be modified by the caller to
  985. // add HTTP headers to the request.
  986. func (c *TransfersListCall) Header() http.Header {
  987. if c.header_ == nil {
  988. c.header_ = make(http.Header)
  989. }
  990. return c.header_
  991. }
  992. func (c *TransfersListCall) doRequest(alt string) (*http.Response, error) {
  993. reqHeaders := make(http.Header)
  994. for k, v := range c.header_ {
  995. reqHeaders[k] = v
  996. }
  997. reqHeaders.Set("User-Agent", c.s.userAgent())
  998. if c.ifNoneMatch_ != "" {
  999. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1000. }
  1001. var body io.Reader = nil
  1002. c.urlParams_.Set("alt", alt)
  1003. c.urlParams_.Set("prettyPrint", "false")
  1004. urls := googleapi.ResolveRelative(c.s.BasePath, "transfers")
  1005. urls += "?" + c.urlParams_.Encode()
  1006. req, err := http.NewRequest("GET", urls, body)
  1007. if err != nil {
  1008. return nil, err
  1009. }
  1010. req.Header = reqHeaders
  1011. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1012. }
  1013. // Do executes the "datatransfer.transfers.list" call.
  1014. // Exactly one of *DataTransfersListResponse or error will be non-nil.
  1015. // Any non-2xx status code is an error. Response headers are in either
  1016. // *DataTransfersListResponse.ServerResponse.Header or (if a response
  1017. // was returned at all) in error.(*googleapi.Error).Header. Use
  1018. // googleapi.IsNotModified to check whether the returned error was
  1019. // because http.StatusNotModified was returned.
  1020. func (c *TransfersListCall) Do(opts ...googleapi.CallOption) (*DataTransfersListResponse, error) {
  1021. gensupport.SetOptions(c.urlParams_, opts...)
  1022. res, err := c.doRequest("json")
  1023. if res != nil && res.StatusCode == http.StatusNotModified {
  1024. if res.Body != nil {
  1025. res.Body.Close()
  1026. }
  1027. return nil, &googleapi.Error{
  1028. Code: res.StatusCode,
  1029. Header: res.Header,
  1030. }
  1031. }
  1032. if err != nil {
  1033. return nil, err
  1034. }
  1035. defer googleapi.CloseBody(res)
  1036. if err := googleapi.CheckResponse(res); err != nil {
  1037. return nil, err
  1038. }
  1039. ret := &DataTransfersListResponse{
  1040. ServerResponse: googleapi.ServerResponse{
  1041. Header: res.Header,
  1042. HTTPStatusCode: res.StatusCode,
  1043. },
  1044. }
  1045. target := &ret
  1046. if err := gensupport.DecodeResponse(target, res); err != nil {
  1047. return nil, err
  1048. }
  1049. return ret, nil
  1050. // {
  1051. // "description": "Lists the transfers for a customer by source user, destination user, or status.",
  1052. // "httpMethod": "GET",
  1053. // "id": "datatransfer.transfers.list",
  1054. // "parameters": {
  1055. // "customerId": {
  1056. // "description": "Immutable ID of the Google Apps account.",
  1057. // "location": "query",
  1058. // "type": "string"
  1059. // },
  1060. // "maxResults": {
  1061. // "description": "Maximum number of results to return. Default is 100.",
  1062. // "format": "int32",
  1063. // "location": "query",
  1064. // "maximum": "500",
  1065. // "minimum": "1",
  1066. // "type": "integer"
  1067. // },
  1068. // "newOwnerUserId": {
  1069. // "description": "Destination user's profile ID.",
  1070. // "location": "query",
  1071. // "type": "string"
  1072. // },
  1073. // "oldOwnerUserId": {
  1074. // "description": "Source user's profile ID.",
  1075. // "location": "query",
  1076. // "type": "string"
  1077. // },
  1078. // "pageToken": {
  1079. // "description": "Token to specify the next page in the list.",
  1080. // "location": "query",
  1081. // "type": "string"
  1082. // },
  1083. // "status": {
  1084. // "description": "Status of the transfer.",
  1085. // "location": "query",
  1086. // "type": "string"
  1087. // }
  1088. // },
  1089. // "path": "transfers",
  1090. // "response": {
  1091. // "$ref": "DataTransfersListResponse"
  1092. // },
  1093. // "scopes": [
  1094. // "https://www.googleapis.com/auth/admin.datatransfer",
  1095. // "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  1096. // ]
  1097. // }
  1098. }
  1099. // Pages invokes f for each page of results.
  1100. // A non-nil error returned from f will halt the iteration.
  1101. // The provided context supersedes any context provided to the Context method.
  1102. func (c *TransfersListCall) Pages(ctx context.Context, f func(*DataTransfersListResponse) error) error {
  1103. c.ctx_ = ctx
  1104. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1105. for {
  1106. x, err := c.Do()
  1107. if err != nil {
  1108. return err
  1109. }
  1110. if err := f(x); err != nil {
  1111. return err
  1112. }
  1113. if x.NextPageToken == "" {
  1114. return nil
  1115. }
  1116. c.PageToken(x.NextPageToken)
  1117. }
  1118. }