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.
 
 
 

3165 lines
111 KiB

  1. // Package storagetransfer provides access to the Storage Transfer API.
  2. //
  3. // See https://cloud.google.com/storage/transfer
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/storagetransfer/v1"
  8. // ...
  9. // storagetransferService, err := storagetransfer.New(oauthHttpClient)
  10. package storagetransfer // import "google.golang.org/api/storagetransfer/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "storagetransfer:v1"
  41. const apiName = "storagetransfer"
  42. const apiVersion = "v1"
  43. const basePath = "https://storagetransfer.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. )
  49. func New(client *http.Client) (*Service, error) {
  50. if client == nil {
  51. return nil, errors.New("client is nil")
  52. }
  53. s := &Service{client: client, BasePath: basePath}
  54. s.GoogleServiceAccounts = NewGoogleServiceAccountsService(s)
  55. s.TransferJobs = NewTransferJobsService(s)
  56. s.TransferOperations = NewTransferOperationsService(s)
  57. return s, nil
  58. }
  59. type Service struct {
  60. client *http.Client
  61. BasePath string // API endpoint base URL
  62. UserAgent string // optional additional User-Agent fragment
  63. GoogleServiceAccounts *GoogleServiceAccountsService
  64. TransferJobs *TransferJobsService
  65. TransferOperations *TransferOperationsService
  66. }
  67. func (s *Service) userAgent() string {
  68. if s.UserAgent == "" {
  69. return googleapi.UserAgent
  70. }
  71. return googleapi.UserAgent + " " + s.UserAgent
  72. }
  73. func NewGoogleServiceAccountsService(s *Service) *GoogleServiceAccountsService {
  74. rs := &GoogleServiceAccountsService{s: s}
  75. return rs
  76. }
  77. type GoogleServiceAccountsService struct {
  78. s *Service
  79. }
  80. func NewTransferJobsService(s *Service) *TransferJobsService {
  81. rs := &TransferJobsService{s: s}
  82. return rs
  83. }
  84. type TransferJobsService struct {
  85. s *Service
  86. }
  87. func NewTransferOperationsService(s *Service) *TransferOperationsService {
  88. rs := &TransferOperationsService{s: s}
  89. return rs
  90. }
  91. type TransferOperationsService struct {
  92. s *Service
  93. }
  94. // AwsAccessKey: AWS access key (see
  95. // [AWS Security
  96. // Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security
  97. // -credentials.html)).
  98. type AwsAccessKey struct {
  99. // AccessKeyId: AWS access key ID.
  100. // Required.
  101. AccessKeyId string `json:"accessKeyId,omitempty"`
  102. // SecretAccessKey: AWS secret access key. This field is not returned in
  103. // RPC responses.
  104. // Required.
  105. SecretAccessKey string `json:"secretAccessKey,omitempty"`
  106. // ForceSendFields is a list of field names (e.g. "AccessKeyId") to
  107. // unconditionally include in API requests. By default, fields with
  108. // empty values are omitted from API requests. However, any non-pointer,
  109. // non-interface field appearing in ForceSendFields will be sent to the
  110. // server regardless of whether the field is empty or not. This may be
  111. // used to include empty fields in Patch requests.
  112. ForceSendFields []string `json:"-"`
  113. // NullFields is a list of field names (e.g. "AccessKeyId") to include
  114. // in API requests with the JSON null value. By default, fields with
  115. // empty values are omitted from API requests. However, any field with
  116. // an empty value appearing in NullFields will be sent to the server as
  117. // null. It is an error if a field in this list has a non-empty value.
  118. // This may be used to include null fields in Patch requests.
  119. NullFields []string `json:"-"`
  120. }
  121. func (s *AwsAccessKey) MarshalJSON() ([]byte, error) {
  122. type NoMethod AwsAccessKey
  123. raw := NoMethod(*s)
  124. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  125. }
  126. // AwsS3Data: An AwsS3Data resource can be a data source, but not a data
  127. // sink.
  128. // In an AwsS3Data resource, an object's name is the S3 object's key
  129. // name.
  130. type AwsS3Data struct {
  131. // AwsAccessKey: AWS access key used to sign the API requests to the AWS
  132. // S3 bucket.
  133. // Permissions on the bucket must be granted to the access ID of the
  134. // AWS access key.
  135. // Required.
  136. AwsAccessKey *AwsAccessKey `json:"awsAccessKey,omitempty"`
  137. // BucketName: S3 Bucket name (see
  138. // [Creating a
  139. // bucket](http://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-g
  140. // et-location-example.html)).
  141. // Required.
  142. BucketName string `json:"bucketName,omitempty"`
  143. // ForceSendFields is a list of field names (e.g. "AwsAccessKey") to
  144. // unconditionally include in API requests. By default, fields with
  145. // empty values are omitted from API requests. However, any non-pointer,
  146. // non-interface field appearing in ForceSendFields will be sent to the
  147. // server regardless of whether the field is empty or not. This may be
  148. // used to include empty fields in Patch requests.
  149. ForceSendFields []string `json:"-"`
  150. // NullFields is a list of field names (e.g. "AwsAccessKey") to include
  151. // in API requests with the JSON null value. By default, fields with
  152. // empty values are omitted from API requests. However, any field with
  153. // an empty value appearing in NullFields will be sent to the server as
  154. // null. It is an error if a field in this list has a non-empty value.
  155. // This may be used to include null fields in Patch requests.
  156. NullFields []string `json:"-"`
  157. }
  158. func (s *AwsS3Data) MarshalJSON() ([]byte, error) {
  159. type NoMethod AwsS3Data
  160. raw := NoMethod(*s)
  161. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  162. }
  163. // Date: Represents a whole calendar date, e.g. date of birth. The time
  164. // of day and
  165. // time zone are either specified elsewhere or are not significant. The
  166. // date
  167. // is relative to the Proleptic Gregorian Calendar. The day may be 0
  168. // to
  169. // represent a year and month where the day is not significant, e.g.
  170. // credit card
  171. // expiration date. The year may be 0 to represent a month and day
  172. // independent
  173. // of year, e.g. anniversary date. Related types are
  174. // google.type.TimeOfDay
  175. // and `google.protobuf.Timestamp`.
  176. type Date struct {
  177. // Day: Day of month. Must be from 1 to 31 and valid for the year and
  178. // month, or 0
  179. // if specifying a year/month where the day is not significant.
  180. Day int64 `json:"day,omitempty"`
  181. // Month: Month of year. Must be from 1 to 12, or 0 if specifying a date
  182. // without a
  183. // month.
  184. Month int64 `json:"month,omitempty"`
  185. // Year: Year of date. Must be from 1 to 9999, or 0 if specifying a date
  186. // without
  187. // a year.
  188. Year int64 `json:"year,omitempty"`
  189. // ForceSendFields is a list of field names (e.g. "Day") to
  190. // unconditionally include in API requests. By default, fields with
  191. // empty values are omitted from API requests. However, any non-pointer,
  192. // non-interface field appearing in ForceSendFields will be sent to the
  193. // server regardless of whether the field is empty or not. This may be
  194. // used to include empty fields in Patch requests.
  195. ForceSendFields []string `json:"-"`
  196. // NullFields is a list of field names (e.g. "Day") to include in API
  197. // requests with the JSON null value. By default, fields with empty
  198. // values are omitted from API requests. However, any field with an
  199. // empty value appearing in NullFields will be sent to the server as
  200. // null. It is an error if a field in this list has a non-empty value.
  201. // This may be used to include null fields in Patch requests.
  202. NullFields []string `json:"-"`
  203. }
  204. func (s *Date) MarshalJSON() ([]byte, error) {
  205. type NoMethod Date
  206. raw := NoMethod(*s)
  207. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  208. }
  209. // Empty: A generic empty message that you can re-use to avoid defining
  210. // duplicated
  211. // empty messages in your APIs. A typical example is to use it as the
  212. // request
  213. // or the response type of an API method. For instance:
  214. //
  215. // service Foo {
  216. // rpc Bar(google.protobuf.Empty) returns
  217. // (google.protobuf.Empty);
  218. // }
  219. //
  220. // The JSON representation for `Empty` is empty JSON object `{}`.
  221. type Empty struct {
  222. // ServerResponse contains the HTTP response code and headers from the
  223. // server.
  224. googleapi.ServerResponse `json:"-"`
  225. }
  226. // ErrorLogEntry: An entry describing an error that has occurred.
  227. type ErrorLogEntry struct {
  228. // ErrorDetails: A list of messages that carry the error details.
  229. ErrorDetails []string `json:"errorDetails,omitempty"`
  230. // Url: A URL that refers to the target (a data source, a data sink,
  231. // or an object) with which the error is associated.
  232. // Required.
  233. Url string `json:"url,omitempty"`
  234. // ForceSendFields is a list of field names (e.g. "ErrorDetails") to
  235. // unconditionally include in API requests. By default, fields with
  236. // empty values are omitted from API requests. However, any non-pointer,
  237. // non-interface field appearing in ForceSendFields will be sent to the
  238. // server regardless of whether the field is empty or not. This may be
  239. // used to include empty fields in Patch requests.
  240. ForceSendFields []string `json:"-"`
  241. // NullFields is a list of field names (e.g. "ErrorDetails") to include
  242. // in API requests with the JSON null value. By default, fields with
  243. // empty values are omitted from API requests. However, any field with
  244. // an empty value appearing in NullFields will be sent to the server as
  245. // null. It is an error if a field in this list has a non-empty value.
  246. // This may be used to include null fields in Patch requests.
  247. NullFields []string `json:"-"`
  248. }
  249. func (s *ErrorLogEntry) MarshalJSON() ([]byte, error) {
  250. type NoMethod ErrorLogEntry
  251. raw := NoMethod(*s)
  252. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  253. }
  254. // ErrorSummary: A summary of errors by error code, plus a count and
  255. // sample error log
  256. // entries.
  257. type ErrorSummary struct {
  258. // ErrorCode: Required.
  259. //
  260. // Possible values:
  261. // "OK" - Not an error; returned on success
  262. //
  263. // HTTP Mapping: 200 OK
  264. // "CANCELLED" - The operation was cancelled, typically by the
  265. // caller.
  266. //
  267. // HTTP Mapping: 499 Client Closed Request
  268. // "UNKNOWN" - Unknown error. For example, this error may be returned
  269. // when
  270. // a `Status` value received from another address space belongs to
  271. // an error space that is not known in this address space. Also
  272. // errors raised by APIs that do not return enough error information
  273. // may be converted to this error.
  274. //
  275. // HTTP Mapping: 500 Internal Server Error
  276. // "INVALID_ARGUMENT" - The client specified an invalid argument.
  277. // Note that this differs
  278. // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates
  279. // arguments
  280. // that are problematic regardless of the state of the system
  281. // (e.g., a malformed file name).
  282. //
  283. // HTTP Mapping: 400 Bad Request
  284. // "DEADLINE_EXCEEDED" - The deadline expired before the operation
  285. // could complete. For operations
  286. // that change the state of the system, this error may be returned
  287. // even if the operation has completed successfully. For example,
  288. // a
  289. // successful response from a server could have been delayed long
  290. // enough for the deadline to expire.
  291. //
  292. // HTTP Mapping: 504 Gateway Timeout
  293. // "NOT_FOUND" - Some requested entity (e.g., file or directory) was
  294. // not found.
  295. //
  296. // Note to server developers: if a request is denied for an entire
  297. // class
  298. // of users, such as gradual feature rollout or undocumented
  299. // whitelist,
  300. // `NOT_FOUND` may be used. If a request is denied for some users
  301. // within
  302. // a class of users, such as user-based access control,
  303. // `PERMISSION_DENIED`
  304. // must be used.
  305. //
  306. // HTTP Mapping: 404 Not Found
  307. // "ALREADY_EXISTS" - The entity that a client attempted to create
  308. // (e.g., file or directory)
  309. // already exists.
  310. //
  311. // HTTP Mapping: 409 Conflict
  312. // "PERMISSION_DENIED" - The caller does not have permission to
  313. // execute the specified
  314. // operation. `PERMISSION_DENIED` must not be used for rejections
  315. // caused by exhausting some resource (use `RESOURCE_EXHAUSTED`
  316. // instead for those errors). `PERMISSION_DENIED` must not be
  317. // used if the caller can not be identified (use
  318. // `UNAUTHENTICATED`
  319. // instead for those errors). This error code does not imply the
  320. // request is valid or the requested entity exists or satisfies
  321. // other pre-conditions.
  322. //
  323. // HTTP Mapping: 403 Forbidden
  324. // "UNAUTHENTICATED" - The request does not have valid authentication
  325. // credentials for the
  326. // operation.
  327. //
  328. // HTTP Mapping: 401 Unauthorized
  329. // "RESOURCE_EXHAUSTED" - Some resource has been exhausted, perhaps a
  330. // per-user quota, or
  331. // perhaps the entire file system is out of space.
  332. //
  333. // HTTP Mapping: 429 Too Many Requests
  334. // "FAILED_PRECONDITION" - The operation was rejected because the
  335. // system is not in a state
  336. // required for the operation's execution. For example, the
  337. // directory
  338. // to be deleted is non-empty, an rmdir operation is applied to
  339. // a non-directory, etc.
  340. //
  341. // Service implementors can use the following guidelines to
  342. // decide
  343. // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`:
  344. // (a) Use `UNAVAILABLE` if the client can retry just the failing
  345. // call.
  346. // (b) Use `ABORTED` if the client should retry at a higher level
  347. // (e.g., when a client-specified test-and-set fails, indicating
  348. // the
  349. // client should restart a read-modify-write sequence).
  350. // (c) Use `FAILED_PRECONDITION` if the client should not retry until
  351. // the system state has been explicitly fixed. E.g., if an
  352. // "rmdir"
  353. // fails because the directory is non-empty, `FAILED_PRECONDITION`
  354. // should be returned since the client should not retry unless
  355. // the files are deleted from the directory.
  356. //
  357. // HTTP Mapping: 400 Bad Request
  358. // "ABORTED" - The operation was aborted, typically due to a
  359. // concurrency issue such as
  360. // a sequencer check failure or transaction abort.
  361. //
  362. // See the guidelines above for deciding between
  363. // `FAILED_PRECONDITION`,
  364. // `ABORTED`, and `UNAVAILABLE`.
  365. //
  366. // HTTP Mapping: 409 Conflict
  367. // "OUT_OF_RANGE" - The operation was attempted past the valid range.
  368. // E.g., seeking or
  369. // reading past end-of-file.
  370. //
  371. // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may
  372. // be fixed if the system state changes. For example, a 32-bit
  373. // file
  374. // system will generate `INVALID_ARGUMENT` if asked to read at an
  375. // offset that is not in the range [0,2^32-1], but it will
  376. // generate
  377. // `OUT_OF_RANGE` if asked to read from an offset past the current
  378. // file size.
  379. //
  380. // There is a fair bit of overlap between `FAILED_PRECONDITION`
  381. // and
  382. // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more
  383. // specific
  384. // error) when it applies so that callers who are iterating through
  385. // a space can easily look for an `OUT_OF_RANGE` error to detect
  386. // when
  387. // they are done.
  388. //
  389. // HTTP Mapping: 400 Bad Request
  390. // "UNIMPLEMENTED" - The operation is not implemented or is not
  391. // supported/enabled in this
  392. // service.
  393. //
  394. // HTTP Mapping: 501 Not Implemented
  395. // "INTERNAL" - Internal errors. This means that some invariants
  396. // expected by the
  397. // underlying system have been broken. This error code is reserved
  398. // for serious errors.
  399. //
  400. // HTTP Mapping: 500 Internal Server Error
  401. // "UNAVAILABLE" - The service is currently unavailable. This is most
  402. // likely a
  403. // transient condition, which can be corrected by retrying with
  404. // a backoff.
  405. //
  406. // See the guidelines above for deciding between
  407. // `FAILED_PRECONDITION`,
  408. // `ABORTED`, and `UNAVAILABLE`.
  409. //
  410. // HTTP Mapping: 503 Service Unavailable
  411. // "DATA_LOSS" - Unrecoverable data loss or corruption.
  412. //
  413. // HTTP Mapping: 500 Internal Server Error
  414. ErrorCode string `json:"errorCode,omitempty"`
  415. // ErrorCount: Count of this type of error.
  416. // Required.
  417. ErrorCount int64 `json:"errorCount,omitempty,string"`
  418. // ErrorLogEntries: Error samples.
  419. ErrorLogEntries []*ErrorLogEntry `json:"errorLogEntries,omitempty"`
  420. // ForceSendFields is a list of field names (e.g. "ErrorCode") to
  421. // unconditionally include in API requests. By default, fields with
  422. // empty values are omitted from API requests. However, any non-pointer,
  423. // non-interface field appearing in ForceSendFields will be sent to the
  424. // server regardless of whether the field is empty or not. This may be
  425. // used to include empty fields in Patch requests.
  426. ForceSendFields []string `json:"-"`
  427. // NullFields is a list of field names (e.g. "ErrorCode") to include in
  428. // API requests with the JSON null value. By default, fields with empty
  429. // values are omitted from API requests. However, any field with an
  430. // empty value appearing in NullFields will be sent to the server as
  431. // null. It is an error if a field in this list has a non-empty value.
  432. // This may be used to include null fields in Patch requests.
  433. NullFields []string `json:"-"`
  434. }
  435. func (s *ErrorSummary) MarshalJSON() ([]byte, error) {
  436. type NoMethod ErrorSummary
  437. raw := NoMethod(*s)
  438. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  439. }
  440. // GcsData: In a GcsData resource, an object's name is the Google Cloud
  441. // Storage object's
  442. // name and its `lastModificationTime` refers to the object's updated
  443. // time,
  444. // which changes when the content or the metadata of the object is
  445. // updated.
  446. type GcsData struct {
  447. // BucketName: Google Cloud Storage bucket name (see
  448. // [Bucket
  449. // Name
  450. // Requirements](https://cloud.google.com/storage/docs/naming#requir
  451. // ements)).
  452. // Required.
  453. BucketName string `json:"bucketName,omitempty"`
  454. // ForceSendFields is a list of field names (e.g. "BucketName") to
  455. // unconditionally include in API requests. By default, fields with
  456. // empty values are omitted from API requests. However, any non-pointer,
  457. // non-interface field appearing in ForceSendFields will be sent to the
  458. // server regardless of whether the field is empty or not. This may be
  459. // used to include empty fields in Patch requests.
  460. ForceSendFields []string `json:"-"`
  461. // NullFields is a list of field names (e.g. "BucketName") to include in
  462. // API requests with the JSON null value. By default, fields with empty
  463. // values are omitted from API requests. However, any field with an
  464. // empty value appearing in NullFields will be sent to the server as
  465. // null. It is an error if a field in this list has a non-empty value.
  466. // This may be used to include null fields in Patch requests.
  467. NullFields []string `json:"-"`
  468. }
  469. func (s *GcsData) MarshalJSON() ([]byte, error) {
  470. type NoMethod GcsData
  471. raw := NoMethod(*s)
  472. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  473. }
  474. // GoogleServiceAccount: Google service account
  475. type GoogleServiceAccount struct {
  476. // AccountEmail: Required.
  477. AccountEmail string `json:"accountEmail,omitempty"`
  478. // ServerResponse contains the HTTP response code and headers from the
  479. // server.
  480. googleapi.ServerResponse `json:"-"`
  481. // ForceSendFields is a list of field names (e.g. "AccountEmail") to
  482. // unconditionally include in API requests. By default, fields with
  483. // empty values are omitted from API requests. However, any non-pointer,
  484. // non-interface field appearing in ForceSendFields will be sent to the
  485. // server regardless of whether the field is empty or not. This may be
  486. // used to include empty fields in Patch requests.
  487. ForceSendFields []string `json:"-"`
  488. // NullFields is a list of field names (e.g. "AccountEmail") to include
  489. // in API requests with the JSON null value. By default, fields with
  490. // empty values are omitted from API requests. However, any field with
  491. // an empty value appearing in NullFields will be sent to the server as
  492. // null. It is an error if a field in this list has a non-empty value.
  493. // This may be used to include null fields in Patch requests.
  494. NullFields []string `json:"-"`
  495. }
  496. func (s *GoogleServiceAccount) MarshalJSON() ([]byte, error) {
  497. type NoMethod GoogleServiceAccount
  498. raw := NoMethod(*s)
  499. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  500. }
  501. // HttpData: An HttpData resource specifies a list of objects on the web
  502. // to be transferred
  503. // over HTTP. The information of the objects to be transferred is
  504. // contained in
  505. // a file referenced by a URL. The first line in the file must
  506. // be
  507. // "TsvHttpData-1.0", which specifies the format of the file.
  508. // Subsequent lines
  509. // specify the information of the list of objects, one object per list
  510. // entry.
  511. // Each entry has the following tab-delimited fields:
  512. //
  513. // * HTTP URL - The location of the object.
  514. //
  515. // * Length - The size of the object in bytes.
  516. //
  517. // * MD5 - The base64-encoded MD5 hash of the object.
  518. //
  519. // For an example of a valid TSV file, see
  520. // [Transferring data
  521. // from
  522. // URLs](https://cloud.google.com/storage/transfer/create-url-list).
  523. //
  524. //
  525. // When transferring data based on a URL list, keep the following in
  526. // mind:
  527. //
  528. // * When an object located at `http(s)://hostname:port/<URL-path>`
  529. // is
  530. // transferred to a data sink, the name of the object at the data sink
  531. // is
  532. // `<hostname>/<URL-path>`.
  533. //
  534. // * If the specified size of an object does not match the actual size
  535. // of the
  536. // object fetched, the object will not be transferred.
  537. //
  538. // * If the specified MD5 does not match the MD5 computed from the
  539. // transferred
  540. // bytes, the object transfer will fail. For more information,
  541. // see
  542. // [Generating MD5
  543. // hashes](https://cloud.google.com/storage/transfer/#md5)
  544. //
  545. // * Ensure that each URL you specify is publicly accessible.
  546. // For
  547. // example, in Google Cloud Storage you can
  548. // [share an object
  549. // publicly]
  550. // (https://cloud.google.com/storage/docs/cloud-console#_sharin
  551. // gdata) and get
  552. // a link to it.
  553. //
  554. // * Storage Transfer Service obeys `robots.txt` rules and requires the
  555. // source
  556. // HTTP server to support `Range` requests and to return a
  557. // `Content-Length`
  558. // header in each response.
  559. //
  560. // * [ObjectConditions](#ObjectConditions) have no effect when filtering
  561. // objects
  562. // to transfer.
  563. type HttpData struct {
  564. // ListUrl: The URL that points to the file that stores the object list
  565. // entries.
  566. // This file must allow public access. Currently, only URLs with HTTP
  567. // and
  568. // HTTPS schemes are supported.
  569. // Required.
  570. ListUrl string `json:"listUrl,omitempty"`
  571. // ForceSendFields is a list of field names (e.g. "ListUrl") to
  572. // unconditionally include in API requests. By default, fields with
  573. // empty values are omitted from API requests. However, any non-pointer,
  574. // non-interface field appearing in ForceSendFields will be sent to the
  575. // server regardless of whether the field is empty or not. This may be
  576. // used to include empty fields in Patch requests.
  577. ForceSendFields []string `json:"-"`
  578. // NullFields is a list of field names (e.g. "ListUrl") to include in
  579. // API requests with the JSON null value. By default, fields with empty
  580. // values are omitted from API requests. However, any field with an
  581. // empty value appearing in NullFields will be sent to the server as
  582. // null. It is an error if a field in this list has a non-empty value.
  583. // This may be used to include null fields in Patch requests.
  584. NullFields []string `json:"-"`
  585. }
  586. func (s *HttpData) MarshalJSON() ([]byte, error) {
  587. type NoMethod HttpData
  588. raw := NoMethod(*s)
  589. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  590. }
  591. // ListOperationsResponse: The response message for
  592. // Operations.ListOperations.
  593. type ListOperationsResponse struct {
  594. // NextPageToken: The standard List next-page token.
  595. NextPageToken string `json:"nextPageToken,omitempty"`
  596. // Operations: A list of operations that matches the specified filter in
  597. // the request.
  598. Operations []*Operation `json:"operations,omitempty"`
  599. // ServerResponse contains the HTTP response code and headers from the
  600. // server.
  601. googleapi.ServerResponse `json:"-"`
  602. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  603. // unconditionally include in API requests. By default, fields with
  604. // empty values are omitted from API requests. However, any non-pointer,
  605. // non-interface field appearing in ForceSendFields will be sent to the
  606. // server regardless of whether the field is empty or not. This may be
  607. // used to include empty fields in Patch requests.
  608. ForceSendFields []string `json:"-"`
  609. // NullFields is a list of field names (e.g. "NextPageToken") to include
  610. // in API requests with the JSON null value. By default, fields with
  611. // empty values are omitted from API requests. However, any field with
  612. // an empty value appearing in NullFields will be sent to the server as
  613. // null. It is an error if a field in this list has a non-empty value.
  614. // This may be used to include null fields in Patch requests.
  615. NullFields []string `json:"-"`
  616. }
  617. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  618. type NoMethod ListOperationsResponse
  619. raw := NoMethod(*s)
  620. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  621. }
  622. // ListTransferJobsResponse: Response from ListTransferJobs.
  623. type ListTransferJobsResponse struct {
  624. // NextPageToken: The list next page token.
  625. NextPageToken string `json:"nextPageToken,omitempty"`
  626. // TransferJobs: A list of transfer jobs.
  627. TransferJobs []*TransferJob `json:"transferJobs,omitempty"`
  628. // ServerResponse contains the HTTP response code and headers from the
  629. // server.
  630. googleapi.ServerResponse `json:"-"`
  631. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  632. // unconditionally include in API requests. By default, fields with
  633. // empty values are omitted from API requests. However, any non-pointer,
  634. // non-interface field appearing in ForceSendFields will be sent to the
  635. // server regardless of whether the field is empty or not. This may be
  636. // used to include empty fields in Patch requests.
  637. ForceSendFields []string `json:"-"`
  638. // NullFields is a list of field names (e.g. "NextPageToken") to include
  639. // in API requests with the JSON null value. By default, fields with
  640. // empty values are omitted from API requests. However, any field with
  641. // an empty value appearing in NullFields will be sent to the server as
  642. // null. It is an error if a field in this list has a non-empty value.
  643. // This may be used to include null fields in Patch requests.
  644. NullFields []string `json:"-"`
  645. }
  646. func (s *ListTransferJobsResponse) MarshalJSON() ([]byte, error) {
  647. type NoMethod ListTransferJobsResponse
  648. raw := NoMethod(*s)
  649. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  650. }
  651. // ObjectConditions: Conditions that determine which objects will be
  652. // transferred.
  653. type ObjectConditions struct {
  654. // ExcludePrefixes: `excludePrefixes` must follow the requirements
  655. // described for
  656. // `includePrefixes`.
  657. //
  658. // The max size of `excludePrefixes` is 1000.
  659. ExcludePrefixes []string `json:"excludePrefixes,omitempty"`
  660. // IncludePrefixes: If `includePrefixes` is specified, objects that
  661. // satisfy the object
  662. // conditions must have names that start with one of the
  663. // `includePrefixes`
  664. // and that do not start with any of the `excludePrefixes`. If
  665. // `includePrefixes`
  666. // is not specified, all objects except those that have names starting
  667. // with
  668. // one of the `excludePrefixes` must satisfy the object
  669. // conditions.
  670. //
  671. // Requirements:
  672. //
  673. // * Each include-prefix and exclude-prefix can contain any sequence
  674. // of
  675. // Unicode characters, of max length 1024 bytes when UTF8-encoded,
  676. // and
  677. // must not contain Carriage Return or Line Feed characters.
  678. // Wildcard
  679. // matching and regular expression matching are not supported.
  680. //
  681. // * Each include-prefix and exclude-prefix must omit the leading
  682. // slash.
  683. // For example, to include the `requests.gz` object in a transfer
  684. // from
  685. // `s3://my-aws-bucket/logs/y=2015/requests.gz`, specify the
  686. // include
  687. // prefix as `logs/y=2015/requests.gz`.
  688. //
  689. // * None of the include-prefix or the exclude-prefix values can be
  690. // empty,
  691. // if specified.
  692. //
  693. // * Each include-prefix must include a distinct portion of the
  694. // object
  695. // namespace, i.e., no include-prefix may be a prefix of another
  696. // include-prefix.
  697. //
  698. // * Each exclude-prefix must exclude a distinct portion of the
  699. // object
  700. // namespace, i.e., no exclude-prefix may be a prefix of another
  701. // exclude-prefix.
  702. //
  703. // * If `includePrefixes` is specified, then each exclude-prefix must
  704. // start
  705. // with the value of a path explicitly included by
  706. // `includePrefixes`.
  707. //
  708. // The max size of `includePrefixes` is 1000.
  709. IncludePrefixes []string `json:"includePrefixes,omitempty"`
  710. // MaxTimeElapsedSinceLastModification:
  711. // `maxTimeElapsedSinceLastModification` is the complement
  712. // to
  713. // `minTimeElapsedSinceLastModification`.
  714. MaxTimeElapsedSinceLastModification string `json:"maxTimeElapsedSinceLastModification,omitempty"`
  715. // MinTimeElapsedSinceLastModification: If unspecified,
  716. // `minTimeElapsedSinceLastModification` takes a zero value
  717. // and `maxTimeElapsedSinceLastModification` takes the maximum
  718. // possible
  719. // value of Duration. Objects that satisfy the object conditions
  720. // must either have a `lastModificationTime` greater or equal to
  721. // `NOW` - `maxTimeElapsedSinceLastModification` and less than
  722. // `NOW` - `minTimeElapsedSinceLastModification`, or not have
  723. // a
  724. // `lastModificationTime`.
  725. MinTimeElapsedSinceLastModification string `json:"minTimeElapsedSinceLastModification,omitempty"`
  726. // ForceSendFields is a list of field names (e.g. "ExcludePrefixes") to
  727. // unconditionally include in API requests. By default, fields with
  728. // empty values are omitted from API requests. However, any non-pointer,
  729. // non-interface field appearing in ForceSendFields will be sent to the
  730. // server regardless of whether the field is empty or not. This may be
  731. // used to include empty fields in Patch requests.
  732. ForceSendFields []string `json:"-"`
  733. // NullFields is a list of field names (e.g. "ExcludePrefixes") to
  734. // include in API requests with the JSON null value. By default, fields
  735. // with empty values are omitted from API requests. However, any field
  736. // with an empty value appearing in NullFields will be sent to the
  737. // server as null. It is an error if a field in this list has a
  738. // non-empty value. This may be used to include null fields in Patch
  739. // requests.
  740. NullFields []string `json:"-"`
  741. }
  742. func (s *ObjectConditions) MarshalJSON() ([]byte, error) {
  743. type NoMethod ObjectConditions
  744. raw := NoMethod(*s)
  745. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  746. }
  747. // Operation: This resource represents a long-running operation that is
  748. // the result of a
  749. // network API call.
  750. type Operation struct {
  751. // Done: If the value is `false`, it means the operation is still in
  752. // progress.
  753. // If `true`, the operation is completed, and either `error` or
  754. // `response` is
  755. // available.
  756. Done bool `json:"done,omitempty"`
  757. // Error: The error result of the operation in case of failure or
  758. // cancellation.
  759. Error *Status `json:"error,omitempty"`
  760. // Metadata: Represents the transfer operation object.
  761. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  762. // Name: The server-assigned name, which is only unique within the same
  763. // service that originally returns it. If you use the default HTTP
  764. // mapping, the `name` should have the format of
  765. // `transferOperations/some/unique/name`.
  766. Name string `json:"name,omitempty"`
  767. // Response: The normal response of the operation in case of success.
  768. // If the original
  769. // method returns no data on success, such as `Delete`, the response
  770. // is
  771. // `google.protobuf.Empty`. If the original method is
  772. // standard
  773. // `Get`/`Create`/`Update`, the response should be the resource. For
  774. // other
  775. // methods, the response should have the type `XxxResponse`, where
  776. // `Xxx`
  777. // is the original method name. For example, if the original method
  778. // name
  779. // is `TakeSnapshot()`, the inferred response type
  780. // is
  781. // `TakeSnapshotResponse`.
  782. Response googleapi.RawMessage `json:"response,omitempty"`
  783. // ServerResponse contains the HTTP response code and headers from the
  784. // server.
  785. googleapi.ServerResponse `json:"-"`
  786. // ForceSendFields is a list of field names (e.g. "Done") to
  787. // unconditionally include in API requests. By default, fields with
  788. // empty values are omitted from API requests. However, any non-pointer,
  789. // non-interface field appearing in ForceSendFields will be sent to the
  790. // server regardless of whether the field is empty or not. This may be
  791. // used to include empty fields in Patch requests.
  792. ForceSendFields []string `json:"-"`
  793. // NullFields is a list of field names (e.g. "Done") to include in API
  794. // requests with the JSON null value. By default, fields with empty
  795. // values are omitted from API requests. However, any field with an
  796. // empty value appearing in NullFields will be sent to the server as
  797. // null. It is an error if a field in this list has a non-empty value.
  798. // This may be used to include null fields in Patch requests.
  799. NullFields []string `json:"-"`
  800. }
  801. func (s *Operation) MarshalJSON() ([]byte, error) {
  802. type NoMethod Operation
  803. raw := NoMethod(*s)
  804. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  805. }
  806. // PauseTransferOperationRequest: Request passed to
  807. // PauseTransferOperation.
  808. type PauseTransferOperationRequest struct {
  809. }
  810. // ResumeTransferOperationRequest: Request passed to
  811. // ResumeTransferOperation.
  812. type ResumeTransferOperationRequest struct {
  813. }
  814. // Schedule: Transfers can be scheduled to recur or to run just once.
  815. type Schedule struct {
  816. // ScheduleEndDate: The last day the recurring transfer will be run. If
  817. // `scheduleEndDate`
  818. // is the same as `scheduleStartDate`, the transfer will be executed
  819. // only
  820. // once.
  821. ScheduleEndDate *Date `json:"scheduleEndDate,omitempty"`
  822. // ScheduleStartDate: The first day the recurring transfer is scheduled
  823. // to run. If
  824. // `scheduleStartDate` is in the past, the transfer will run for the
  825. // first
  826. // time on the following day.
  827. // Required.
  828. ScheduleStartDate *Date `json:"scheduleStartDate,omitempty"`
  829. // StartTimeOfDay: The time in UTC at which the transfer will be
  830. // scheduled to start in a day.
  831. // Transfers may start later than this time. If not specified, recurring
  832. // and
  833. // one-time transfers that are scheduled to run today will run
  834. // immediately;
  835. // recurring transfers that are scheduled to run on a future date will
  836. // start
  837. // at approximately midnight UTC on that date. Note that when
  838. // configuring a
  839. // transfer with the Cloud Platform Console, the transfer's start time
  840. // in a
  841. // day is specified in your local timezone.
  842. StartTimeOfDay *TimeOfDay `json:"startTimeOfDay,omitempty"`
  843. // ForceSendFields is a list of field names (e.g. "ScheduleEndDate") to
  844. // unconditionally include in API requests. By default, fields with
  845. // empty values are omitted from API requests. However, any non-pointer,
  846. // non-interface field appearing in ForceSendFields will be sent to the
  847. // server regardless of whether the field is empty or not. This may be
  848. // used to include empty fields in Patch requests.
  849. ForceSendFields []string `json:"-"`
  850. // NullFields is a list of field names (e.g. "ScheduleEndDate") to
  851. // include in API requests with the JSON null value. By default, fields
  852. // with empty values are omitted from API requests. However, any field
  853. // with an empty value appearing in NullFields will be sent to the
  854. // server as null. It is an error if a field in this list has a
  855. // non-empty value. This may be used to include null fields in Patch
  856. // requests.
  857. NullFields []string `json:"-"`
  858. }
  859. func (s *Schedule) MarshalJSON() ([]byte, error) {
  860. type NoMethod Schedule
  861. raw := NoMethod(*s)
  862. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  863. }
  864. // Status: The `Status` type defines a logical error model that is
  865. // suitable for different
  866. // programming environments, including REST APIs and RPC APIs. It is
  867. // used by
  868. // [gRPC](https://github.com/grpc). The error model is designed to
  869. // be:
  870. //
  871. // - Simple to use and understand for most users
  872. // - Flexible enough to meet unexpected needs
  873. //
  874. // # Overview
  875. //
  876. // The `Status` message contains three pieces of data: error code, error
  877. // message,
  878. // and error details. The error code should be an enum value
  879. // of
  880. // google.rpc.Code, but it may accept additional error codes if needed.
  881. // The
  882. // error message should be a developer-facing English message that
  883. // helps
  884. // developers *understand* and *resolve* the error. If a localized
  885. // user-facing
  886. // error message is needed, put the localized message in the error
  887. // details or
  888. // localize it in the client. The optional error details may contain
  889. // arbitrary
  890. // information about the error. There is a predefined set of error
  891. // detail types
  892. // in the package `google.rpc` that can be used for common error
  893. // conditions.
  894. //
  895. // # Language mapping
  896. //
  897. // The `Status` message is the logical representation of the error
  898. // model, but it
  899. // is not necessarily the actual wire format. When the `Status` message
  900. // is
  901. // exposed in different client libraries and different wire protocols,
  902. // it can be
  903. // mapped differently. For example, it will likely be mapped to some
  904. // exceptions
  905. // in Java, but more likely mapped to some error codes in C.
  906. //
  907. // # Other uses
  908. //
  909. // The error model and the `Status` message can be used in a variety
  910. // of
  911. // environments, either with or without APIs, to provide a
  912. // consistent developer experience across different
  913. // environments.
  914. //
  915. // Example uses of this error model include:
  916. //
  917. // - Partial errors. If a service needs to return partial errors to the
  918. // client,
  919. // it may embed the `Status` in the normal response to indicate the
  920. // partial
  921. // errors.
  922. //
  923. // - Workflow errors. A typical workflow has multiple steps. Each step
  924. // may
  925. // have a `Status` message for error reporting.
  926. //
  927. // - Batch operations. If a client uses batch request and batch
  928. // response, the
  929. // `Status` message should be used directly inside batch response,
  930. // one for
  931. // each error sub-response.
  932. //
  933. // - Asynchronous operations. If an API call embeds asynchronous
  934. // operation
  935. // results in its response, the status of those operations should
  936. // be
  937. // represented directly using the `Status` message.
  938. //
  939. // - Logging. If some API errors are stored in logs, the message
  940. // `Status` could
  941. // be used directly after any stripping needed for security/privacy
  942. // reasons.
  943. type Status struct {
  944. // Code: The status code, which should be an enum value of
  945. // google.rpc.Code.
  946. Code int64 `json:"code,omitempty"`
  947. // Details: A list of messages that carry the error details. There is a
  948. // common set of
  949. // message types for APIs to use.
  950. Details []googleapi.RawMessage `json:"details,omitempty"`
  951. // Message: A developer-facing error message, which should be in
  952. // English. Any
  953. // user-facing error message should be localized and sent in
  954. // the
  955. // google.rpc.Status.details field, or localized by the client.
  956. Message string `json:"message,omitempty"`
  957. // ForceSendFields is a list of field names (e.g. "Code") to
  958. // unconditionally include in API requests. By default, fields with
  959. // empty values are omitted from API requests. However, any non-pointer,
  960. // non-interface field appearing in ForceSendFields will be sent to the
  961. // server regardless of whether the field is empty or not. This may be
  962. // used to include empty fields in Patch requests.
  963. ForceSendFields []string `json:"-"`
  964. // NullFields is a list of field names (e.g. "Code") to include in API
  965. // requests with the JSON null value. By default, fields with empty
  966. // values are omitted from API requests. However, any field with an
  967. // empty value appearing in NullFields will be sent to the server as
  968. // null. It is an error if a field in this list has a non-empty value.
  969. // This may be used to include null fields in Patch requests.
  970. NullFields []string `json:"-"`
  971. }
  972. func (s *Status) MarshalJSON() ([]byte, error) {
  973. type NoMethod Status
  974. raw := NoMethod(*s)
  975. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  976. }
  977. // TimeOfDay: Represents a time of day. The date and time zone are
  978. // either not significant
  979. // or are specified elsewhere. An API may choose to allow leap seconds.
  980. // Related
  981. // types are google.type.Date and `google.protobuf.Timestamp`.
  982. type TimeOfDay struct {
  983. // Hours: Hours of day in 24 hour format. Should be from 0 to 23. An API
  984. // may choose
  985. // to allow the value "24:00:00" for scenarios like business closing
  986. // time.
  987. Hours int64 `json:"hours,omitempty"`
  988. // Minutes: Minutes of hour of day. Must be from 0 to 59.
  989. Minutes int64 `json:"minutes,omitempty"`
  990. // Nanos: Fractions of seconds in nanoseconds. Must be from 0 to
  991. // 999,999,999.
  992. Nanos int64 `json:"nanos,omitempty"`
  993. // Seconds: Seconds of minutes of the time. Must normally be from 0 to
  994. // 59. An API may
  995. // allow the value 60 if it allows leap-seconds.
  996. Seconds int64 `json:"seconds,omitempty"`
  997. // ForceSendFields is a list of field names (e.g. "Hours") to
  998. // unconditionally include in API requests. By default, fields with
  999. // empty values are omitted from API requests. However, any non-pointer,
  1000. // non-interface field appearing in ForceSendFields will be sent to the
  1001. // server regardless of whether the field is empty or not. This may be
  1002. // used to include empty fields in Patch requests.
  1003. ForceSendFields []string `json:"-"`
  1004. // NullFields is a list of field names (e.g. "Hours") to include in API
  1005. // requests with the JSON null value. By default, fields with empty
  1006. // values are omitted from API requests. However, any field with an
  1007. // empty value appearing in NullFields will be sent to the server as
  1008. // null. It is an error if a field in this list has a non-empty value.
  1009. // This may be used to include null fields in Patch requests.
  1010. NullFields []string `json:"-"`
  1011. }
  1012. func (s *TimeOfDay) MarshalJSON() ([]byte, error) {
  1013. type NoMethod TimeOfDay
  1014. raw := NoMethod(*s)
  1015. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1016. }
  1017. // TransferCounters: A collection of counters that report the progress
  1018. // of a transfer operation.
  1019. type TransferCounters struct {
  1020. // BytesCopiedToSink: Bytes that are copied to the data sink.
  1021. BytesCopiedToSink int64 `json:"bytesCopiedToSink,omitempty,string"`
  1022. // BytesDeletedFromSink: Bytes that are deleted from the data sink.
  1023. BytesDeletedFromSink int64 `json:"bytesDeletedFromSink,omitempty,string"`
  1024. // BytesDeletedFromSource: Bytes that are deleted from the data source.
  1025. BytesDeletedFromSource int64 `json:"bytesDeletedFromSource,omitempty,string"`
  1026. // BytesFailedToDeleteFromSink: Bytes that failed to be deleted from the
  1027. // data sink.
  1028. BytesFailedToDeleteFromSink int64 `json:"bytesFailedToDeleteFromSink,omitempty,string"`
  1029. // BytesFoundFromSource: Bytes found in the data source that are
  1030. // scheduled to be transferred,
  1031. // excluding any that are filtered based on object conditions or skipped
  1032. // due
  1033. // to sync.
  1034. BytesFoundFromSource int64 `json:"bytesFoundFromSource,omitempty,string"`
  1035. // BytesFoundOnlyFromSink: Bytes found only in the data sink that are
  1036. // scheduled to be deleted.
  1037. BytesFoundOnlyFromSink int64 `json:"bytesFoundOnlyFromSink,omitempty,string"`
  1038. // BytesFromSourceFailed: Bytes in the data source that failed to be
  1039. // transferred or that failed to
  1040. // be deleted after being transferred.
  1041. BytesFromSourceFailed int64 `json:"bytesFromSourceFailed,omitempty,string"`
  1042. // BytesFromSourceSkippedBySync: Bytes in the data source that are not
  1043. // transferred because they already
  1044. // exist in the data sink.
  1045. BytesFromSourceSkippedBySync int64 `json:"bytesFromSourceSkippedBySync,omitempty,string"`
  1046. // ObjectsCopiedToSink: Objects that are copied to the data sink.
  1047. ObjectsCopiedToSink int64 `json:"objectsCopiedToSink,omitempty,string"`
  1048. // ObjectsDeletedFromSink: Objects that are deleted from the data sink.
  1049. ObjectsDeletedFromSink int64 `json:"objectsDeletedFromSink,omitempty,string"`
  1050. // ObjectsDeletedFromSource: Objects that are deleted from the data
  1051. // source.
  1052. ObjectsDeletedFromSource int64 `json:"objectsDeletedFromSource,omitempty,string"`
  1053. // ObjectsFailedToDeleteFromSink: Objects that failed to be deleted from
  1054. // the data sink.
  1055. ObjectsFailedToDeleteFromSink int64 `json:"objectsFailedToDeleteFromSink,omitempty,string"`
  1056. // ObjectsFoundFromSource: Objects found in the data source that are
  1057. // scheduled to be transferred,
  1058. // excluding any that are filtered based on object conditions or skipped
  1059. // due
  1060. // to sync.
  1061. ObjectsFoundFromSource int64 `json:"objectsFoundFromSource,omitempty,string"`
  1062. // ObjectsFoundOnlyFromSink: Objects found only in the data sink that
  1063. // are scheduled to be deleted.
  1064. ObjectsFoundOnlyFromSink int64 `json:"objectsFoundOnlyFromSink,omitempty,string"`
  1065. // ObjectsFromSourceFailed: Objects in the data source that failed to be
  1066. // transferred or that failed
  1067. // to be deleted after being transferred.
  1068. ObjectsFromSourceFailed int64 `json:"objectsFromSourceFailed,omitempty,string"`
  1069. // ObjectsFromSourceSkippedBySync: Objects in the data source that are
  1070. // not transferred because they already
  1071. // exist in the data sink.
  1072. ObjectsFromSourceSkippedBySync int64 `json:"objectsFromSourceSkippedBySync,omitempty,string"`
  1073. // ForceSendFields is a list of field names (e.g. "BytesCopiedToSink")
  1074. // to unconditionally include in API requests. By default, fields with
  1075. // empty values are omitted from API requests. However, any non-pointer,
  1076. // non-interface field appearing in ForceSendFields will be sent to the
  1077. // server regardless of whether the field is empty or not. This may be
  1078. // used to include empty fields in Patch requests.
  1079. ForceSendFields []string `json:"-"`
  1080. // NullFields is a list of field names (e.g. "BytesCopiedToSink") to
  1081. // include in API requests with the JSON null value. By default, fields
  1082. // with empty values are omitted from API requests. However, any field
  1083. // with an empty value appearing in NullFields will be sent to the
  1084. // server as null. It is an error if a field in this list has a
  1085. // non-empty value. This may be used to include null fields in Patch
  1086. // requests.
  1087. NullFields []string `json:"-"`
  1088. }
  1089. func (s *TransferCounters) MarshalJSON() ([]byte, error) {
  1090. type NoMethod TransferCounters
  1091. raw := NoMethod(*s)
  1092. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1093. }
  1094. // TransferJob: This resource represents the configuration of a transfer
  1095. // job that runs
  1096. // periodically.
  1097. type TransferJob struct {
  1098. // CreationTime: This field cannot be changed by user requests.
  1099. CreationTime string `json:"creationTime,omitempty"`
  1100. // DeletionTime: This field cannot be changed by user requests.
  1101. DeletionTime string `json:"deletionTime,omitempty"`
  1102. // Description: A description provided by the user for the job. Its max
  1103. // length is 1024
  1104. // bytes when Unicode-encoded.
  1105. Description string `json:"description,omitempty"`
  1106. // LastModificationTime: This field cannot be changed by user requests.
  1107. LastModificationTime string `json:"lastModificationTime,omitempty"`
  1108. // Name: A globally unique name assigned by Storage Transfer Service
  1109. // when the
  1110. // job is created. This field should be left empty in requests to create
  1111. // a new
  1112. // transfer job; otherwise, the requests result in an
  1113. // `INVALID_ARGUMENT`
  1114. // error.
  1115. Name string `json:"name,omitempty"`
  1116. // ProjectId: The ID of the Google Cloud Platform Console project that
  1117. // owns the job.
  1118. ProjectId string `json:"projectId,omitempty"`
  1119. // Schedule: Schedule specification.
  1120. Schedule *Schedule `json:"schedule,omitempty"`
  1121. // Status: Status of the job. This value MUST be specified
  1122. // for
  1123. // `CreateTransferJobRequests`.
  1124. //
  1125. // NOTE: The effect of the new job status takes place during a
  1126. // subsequent job
  1127. // run. For example, if you change the job status from `ENABLED`
  1128. // to
  1129. // `DISABLED`, and an operation spawned by the transfer is running, the
  1130. // status
  1131. // change would not affect the current operation.
  1132. //
  1133. // Possible values:
  1134. // "STATUS_UNSPECIFIED" - Zero is an illegal value.
  1135. // "ENABLED" - New transfers will be performed based on the schedule.
  1136. // "DISABLED" - New transfers will not be scheduled.
  1137. // "DELETED" - This is a soft delete state. After a transfer job is
  1138. // set to this
  1139. // state, the job and all the transfer executions are subject to
  1140. // garbage collection. Transfer jobs become eligible for garbage
  1141. // collection
  1142. // 30 days after their status is set to `DELETED`.
  1143. Status string `json:"status,omitempty"`
  1144. // TransferSpec: Transfer specification.
  1145. TransferSpec *TransferSpec `json:"transferSpec,omitempty"`
  1146. // ServerResponse contains the HTTP response code and headers from the
  1147. // server.
  1148. googleapi.ServerResponse `json:"-"`
  1149. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1150. // unconditionally include in API requests. By default, fields with
  1151. // empty values are omitted from API requests. However, any non-pointer,
  1152. // non-interface field appearing in ForceSendFields will be sent to the
  1153. // server regardless of whether the field is empty or not. This may be
  1154. // used to include empty fields in Patch requests.
  1155. ForceSendFields []string `json:"-"`
  1156. // NullFields is a list of field names (e.g. "CreationTime") to include
  1157. // in API requests with the JSON null value. By default, fields with
  1158. // empty values are omitted from API requests. However, any field with
  1159. // an empty value appearing in NullFields will be sent to the server as
  1160. // null. It is an error if a field in this list has a non-empty value.
  1161. // This may be used to include null fields in Patch requests.
  1162. NullFields []string `json:"-"`
  1163. }
  1164. func (s *TransferJob) MarshalJSON() ([]byte, error) {
  1165. type NoMethod TransferJob
  1166. raw := NoMethod(*s)
  1167. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1168. }
  1169. // TransferOperation: A description of the execution of a transfer.
  1170. type TransferOperation struct {
  1171. // Counters: Information about the progress of the transfer operation.
  1172. Counters *TransferCounters `json:"counters,omitempty"`
  1173. // EndTime: End time of this transfer execution.
  1174. EndTime string `json:"endTime,omitempty"`
  1175. // ErrorBreakdowns: Summarizes errors encountered with sample error log
  1176. // entries.
  1177. ErrorBreakdowns []*ErrorSummary `json:"errorBreakdowns,omitempty"`
  1178. // Name: A globally unique ID assigned by the system.
  1179. Name string `json:"name,omitempty"`
  1180. // ProjectId: The ID of the Google Cloud Platform Console project that
  1181. // owns the operation.
  1182. // Required.
  1183. ProjectId string `json:"projectId,omitempty"`
  1184. // StartTime: Start time of this transfer execution.
  1185. StartTime string `json:"startTime,omitempty"`
  1186. // Status: Status of the transfer operation.
  1187. //
  1188. // Possible values:
  1189. // "STATUS_UNSPECIFIED" - Zero is an illegal value.
  1190. // "IN_PROGRESS" - In progress.
  1191. // "PAUSED" - Paused.
  1192. // "SUCCESS" - Completed successfully.
  1193. // "FAILED" - Terminated due to an unrecoverable failure.
  1194. // "ABORTED" - Aborted by the user.
  1195. Status string `json:"status,omitempty"`
  1196. // TransferJobName: The name of the transfer job that triggers this
  1197. // transfer operation.
  1198. TransferJobName string `json:"transferJobName,omitempty"`
  1199. // TransferSpec: Transfer specification.
  1200. // Required.
  1201. TransferSpec *TransferSpec `json:"transferSpec,omitempty"`
  1202. // ForceSendFields is a list of field names (e.g. "Counters") to
  1203. // unconditionally include in API requests. By default, fields with
  1204. // empty values are omitted from API requests. However, any non-pointer,
  1205. // non-interface field appearing in ForceSendFields will be sent to the
  1206. // server regardless of whether the field is empty or not. This may be
  1207. // used to include empty fields in Patch requests.
  1208. ForceSendFields []string `json:"-"`
  1209. // NullFields is a list of field names (e.g. "Counters") to include in
  1210. // API requests with the JSON null value. By default, fields with empty
  1211. // values are omitted from API requests. However, any field with an
  1212. // empty value appearing in NullFields will be sent to the server as
  1213. // null. It is an error if a field in this list has a non-empty value.
  1214. // This may be used to include null fields in Patch requests.
  1215. NullFields []string `json:"-"`
  1216. }
  1217. func (s *TransferOperation) MarshalJSON() ([]byte, error) {
  1218. type NoMethod TransferOperation
  1219. raw := NoMethod(*s)
  1220. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1221. }
  1222. // TransferOptions: TransferOptions uses three boolean parameters to
  1223. // define the actions
  1224. // to be performed on objects in a transfer.
  1225. type TransferOptions struct {
  1226. // DeleteObjectsFromSourceAfterTransfer: Whether objects should be
  1227. // deleted from the source after they are
  1228. // transferred to the sink. Note that this option
  1229. // and
  1230. // `deleteObjectsUniqueInSink` are mutually exclusive.
  1231. DeleteObjectsFromSourceAfterTransfer bool `json:"deleteObjectsFromSourceAfterTransfer,omitempty"`
  1232. // DeleteObjectsUniqueInSink: Whether objects that exist only in the
  1233. // sink should be deleted. Note that
  1234. // this option and `deleteObjectsFromSourceAfterTransfer` are
  1235. // mutually
  1236. // exclusive.
  1237. DeleteObjectsUniqueInSink bool `json:"deleteObjectsUniqueInSink,omitempty"`
  1238. // OverwriteObjectsAlreadyExistingInSink: Whether overwriting objects
  1239. // that already exist in the sink is allowed.
  1240. OverwriteObjectsAlreadyExistingInSink bool `json:"overwriteObjectsAlreadyExistingInSink,omitempty"`
  1241. // ForceSendFields is a list of field names (e.g.
  1242. // "DeleteObjectsFromSourceAfterTransfer") to unconditionally include in
  1243. // API requests. By default, fields with empty values are omitted from
  1244. // API requests. However, any non-pointer, non-interface field appearing
  1245. // in ForceSendFields will be sent to the server regardless of whether
  1246. // the field is empty or not. This may be used to include empty fields
  1247. // in Patch requests.
  1248. ForceSendFields []string `json:"-"`
  1249. // NullFields is a list of field names (e.g.
  1250. // "DeleteObjectsFromSourceAfterTransfer") to include in API requests
  1251. // with the JSON null value. By default, fields with empty values are
  1252. // omitted from API requests. However, any field with an empty value
  1253. // appearing in NullFields will be sent to the server as null. It is an
  1254. // error if a field in this list has a non-empty value. This may be used
  1255. // to include null fields in Patch requests.
  1256. NullFields []string `json:"-"`
  1257. }
  1258. func (s *TransferOptions) MarshalJSON() ([]byte, error) {
  1259. type NoMethod TransferOptions
  1260. raw := NoMethod(*s)
  1261. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1262. }
  1263. // TransferSpec: Configuration for running a transfer.
  1264. type TransferSpec struct {
  1265. // AwsS3DataSource: An AWS S3 data source.
  1266. AwsS3DataSource *AwsS3Data `json:"awsS3DataSource,omitempty"`
  1267. // GcsDataSink: A Google Cloud Storage data sink.
  1268. GcsDataSink *GcsData `json:"gcsDataSink,omitempty"`
  1269. // GcsDataSource: A Google Cloud Storage data source.
  1270. GcsDataSource *GcsData `json:"gcsDataSource,omitempty"`
  1271. // HttpDataSource: An HTTP URL data source.
  1272. HttpDataSource *HttpData `json:"httpDataSource,omitempty"`
  1273. // ObjectConditions: Only objects that satisfy these object conditions
  1274. // are included in the set
  1275. // of data source and data sink objects. Object conditions based
  1276. // on
  1277. // objects' `lastModificationTime` do not exclude objects in a data
  1278. // sink.
  1279. ObjectConditions *ObjectConditions `json:"objectConditions,omitempty"`
  1280. // TransferOptions: If the option `deleteObjectsUniqueInSink` is `true`,
  1281. // object conditions
  1282. // based on objects' `lastModificationTime` are ignored and do not
  1283. // exclude
  1284. // objects in a data source or a data sink.
  1285. TransferOptions *TransferOptions `json:"transferOptions,omitempty"`
  1286. // ForceSendFields is a list of field names (e.g. "AwsS3DataSource") to
  1287. // unconditionally include in API requests. By default, fields with
  1288. // empty values are omitted from API requests. However, any non-pointer,
  1289. // non-interface field appearing in ForceSendFields will be sent to the
  1290. // server regardless of whether the field is empty or not. This may be
  1291. // used to include empty fields in Patch requests.
  1292. ForceSendFields []string `json:"-"`
  1293. // NullFields is a list of field names (e.g. "AwsS3DataSource") to
  1294. // include in API requests with the JSON null value. By default, fields
  1295. // with empty values are omitted from API requests. However, any field
  1296. // with an empty value appearing in NullFields will be sent to the
  1297. // server as null. It is an error if a field in this list has a
  1298. // non-empty value. This may be used to include null fields in Patch
  1299. // requests.
  1300. NullFields []string `json:"-"`
  1301. }
  1302. func (s *TransferSpec) MarshalJSON() ([]byte, error) {
  1303. type NoMethod TransferSpec
  1304. raw := NoMethod(*s)
  1305. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1306. }
  1307. // UpdateTransferJobRequest: Request passed to UpdateTransferJob.
  1308. type UpdateTransferJobRequest struct {
  1309. // ProjectId: The ID of the Google Cloud Platform Console project that
  1310. // owns the job.
  1311. // Required.
  1312. ProjectId string `json:"projectId,omitempty"`
  1313. // TransferJob: The job to update. `transferJob` is expected to specify
  1314. // only three fields:
  1315. // `description`, `transferSpec`, and `status`. An
  1316. // UpdateTransferJobRequest
  1317. // that specifies other fields will be rejected with an
  1318. // error
  1319. // `INVALID_ARGUMENT`.
  1320. // Required.
  1321. TransferJob *TransferJob `json:"transferJob,omitempty"`
  1322. // UpdateTransferJobFieldMask: The field mask of the fields in
  1323. // `transferJob` that are to be updated in
  1324. // this request. Fields in `transferJob` that can be updated
  1325. // are:
  1326. // `description`, `transferSpec`, and `status`. To update the
  1327. // `transferSpec`
  1328. // of the job, a complete transfer specification has to be provided.
  1329. // An
  1330. // incomplete specification which misses any required fields will be
  1331. // rejected
  1332. // with the error `INVALID_ARGUMENT`.
  1333. UpdateTransferJobFieldMask string `json:"updateTransferJobFieldMask,omitempty"`
  1334. // ForceSendFields is a list of field names (e.g. "ProjectId") to
  1335. // unconditionally include in API requests. By default, fields with
  1336. // empty values are omitted from API requests. However, any non-pointer,
  1337. // non-interface field appearing in ForceSendFields will be sent to the
  1338. // server regardless of whether the field is empty or not. This may be
  1339. // used to include empty fields in Patch requests.
  1340. ForceSendFields []string `json:"-"`
  1341. // NullFields is a list of field names (e.g. "ProjectId") to include in
  1342. // API requests with the JSON null value. By default, fields with empty
  1343. // values are omitted from API requests. However, any field with an
  1344. // empty value appearing in NullFields will be sent to the server as
  1345. // null. It is an error if a field in this list has a non-empty value.
  1346. // This may be used to include null fields in Patch requests.
  1347. NullFields []string `json:"-"`
  1348. }
  1349. func (s *UpdateTransferJobRequest) MarshalJSON() ([]byte, error) {
  1350. type NoMethod UpdateTransferJobRequest
  1351. raw := NoMethod(*s)
  1352. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1353. }
  1354. // method id "storagetransfer.googleServiceAccounts.get":
  1355. type GoogleServiceAccountsGetCall struct {
  1356. s *Service
  1357. projectId string
  1358. urlParams_ gensupport.URLParams
  1359. ifNoneMatch_ string
  1360. ctx_ context.Context
  1361. header_ http.Header
  1362. }
  1363. // Get: Returns the Google service account that is used by Storage
  1364. // Transfer
  1365. // Service to access buckets in the project where transfers
  1366. // run or in other projects. Each Google service account is
  1367. // associated
  1368. // with one Google Cloud Platform Console project. Users
  1369. // should add this service account to the Google Cloud Storage
  1370. // bucket
  1371. // ACLs to grant access to Storage Transfer Service. This
  1372. // service
  1373. // account is created and owned by Storage Transfer Service and can
  1374. // only be used by Storage Transfer Service.
  1375. func (r *GoogleServiceAccountsService) Get(projectId string) *GoogleServiceAccountsGetCall {
  1376. c := &GoogleServiceAccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1377. c.projectId = projectId
  1378. return c
  1379. }
  1380. // Fields allows partial responses to be retrieved. See
  1381. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1382. // for more information.
  1383. func (c *GoogleServiceAccountsGetCall) Fields(s ...googleapi.Field) *GoogleServiceAccountsGetCall {
  1384. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1385. return c
  1386. }
  1387. // IfNoneMatch sets the optional parameter which makes the operation
  1388. // fail if the object's ETag matches the given value. This is useful for
  1389. // getting updates only after the object has changed since the last
  1390. // request. Use googleapi.IsNotModified to check whether the response
  1391. // error from Do is the result of In-None-Match.
  1392. func (c *GoogleServiceAccountsGetCall) IfNoneMatch(entityTag string) *GoogleServiceAccountsGetCall {
  1393. c.ifNoneMatch_ = entityTag
  1394. return c
  1395. }
  1396. // Context sets the context to be used in this call's Do method. Any
  1397. // pending HTTP request will be aborted if the provided context is
  1398. // canceled.
  1399. func (c *GoogleServiceAccountsGetCall) Context(ctx context.Context) *GoogleServiceAccountsGetCall {
  1400. c.ctx_ = ctx
  1401. return c
  1402. }
  1403. // Header returns an http.Header that can be modified by the caller to
  1404. // add HTTP headers to the request.
  1405. func (c *GoogleServiceAccountsGetCall) Header() http.Header {
  1406. if c.header_ == nil {
  1407. c.header_ = make(http.Header)
  1408. }
  1409. return c.header_
  1410. }
  1411. func (c *GoogleServiceAccountsGetCall) doRequest(alt string) (*http.Response, error) {
  1412. reqHeaders := make(http.Header)
  1413. for k, v := range c.header_ {
  1414. reqHeaders[k] = v
  1415. }
  1416. reqHeaders.Set("User-Agent", c.s.userAgent())
  1417. if c.ifNoneMatch_ != "" {
  1418. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1419. }
  1420. var body io.Reader = nil
  1421. c.urlParams_.Set("alt", alt)
  1422. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/googleServiceAccounts/{projectId}")
  1423. urls += "?" + c.urlParams_.Encode()
  1424. req, _ := http.NewRequest("GET", urls, body)
  1425. req.Header = reqHeaders
  1426. googleapi.Expand(req.URL, map[string]string{
  1427. "projectId": c.projectId,
  1428. })
  1429. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1430. }
  1431. // Do executes the "storagetransfer.googleServiceAccounts.get" call.
  1432. // Exactly one of *GoogleServiceAccount or error will be non-nil. Any
  1433. // non-2xx status code is an error. Response headers are in either
  1434. // *GoogleServiceAccount.ServerResponse.Header or (if a response was
  1435. // returned at all) in error.(*googleapi.Error).Header. Use
  1436. // googleapi.IsNotModified to check whether the returned error was
  1437. // because http.StatusNotModified was returned.
  1438. func (c *GoogleServiceAccountsGetCall) Do(opts ...googleapi.CallOption) (*GoogleServiceAccount, error) {
  1439. gensupport.SetOptions(c.urlParams_, opts...)
  1440. res, err := c.doRequest("json")
  1441. if res != nil && res.StatusCode == http.StatusNotModified {
  1442. if res.Body != nil {
  1443. res.Body.Close()
  1444. }
  1445. return nil, &googleapi.Error{
  1446. Code: res.StatusCode,
  1447. Header: res.Header,
  1448. }
  1449. }
  1450. if err != nil {
  1451. return nil, err
  1452. }
  1453. defer googleapi.CloseBody(res)
  1454. if err := googleapi.CheckResponse(res); err != nil {
  1455. return nil, err
  1456. }
  1457. ret := &GoogleServiceAccount{
  1458. ServerResponse: googleapi.ServerResponse{
  1459. Header: res.Header,
  1460. HTTPStatusCode: res.StatusCode,
  1461. },
  1462. }
  1463. target := &ret
  1464. if err := gensupport.DecodeResponse(target, res); err != nil {
  1465. return nil, err
  1466. }
  1467. return ret, nil
  1468. // {
  1469. // "description": "Returns the Google service account that is used by Storage Transfer\nService to access buckets in the project where transfers\nrun or in other projects. Each Google service account is associated\nwith one Google Cloud Platform Console project. Users\nshould add this service account to the Google Cloud Storage bucket\nACLs to grant access to Storage Transfer Service. This service\naccount is created and owned by Storage Transfer Service and can\nonly be used by Storage Transfer Service.",
  1470. // "flatPath": "v1/googleServiceAccounts/{projectId}",
  1471. // "httpMethod": "GET",
  1472. // "id": "storagetransfer.googleServiceAccounts.get",
  1473. // "parameterOrder": [
  1474. // "projectId"
  1475. // ],
  1476. // "parameters": {
  1477. // "projectId": {
  1478. // "description": "The ID of the Google Cloud Platform Console project that the Google service\naccount is associated with.\nRequired.",
  1479. // "location": "path",
  1480. // "required": true,
  1481. // "type": "string"
  1482. // }
  1483. // },
  1484. // "path": "v1/googleServiceAccounts/{projectId}",
  1485. // "response": {
  1486. // "$ref": "GoogleServiceAccount"
  1487. // },
  1488. // "scopes": [
  1489. // "https://www.googleapis.com/auth/cloud-platform"
  1490. // ]
  1491. // }
  1492. }
  1493. // method id "storagetransfer.transferJobs.create":
  1494. type TransferJobsCreateCall struct {
  1495. s *Service
  1496. transferjob *TransferJob
  1497. urlParams_ gensupport.URLParams
  1498. ctx_ context.Context
  1499. header_ http.Header
  1500. }
  1501. // Create: Creates a transfer job that runs periodically.
  1502. func (r *TransferJobsService) Create(transferjob *TransferJob) *TransferJobsCreateCall {
  1503. c := &TransferJobsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1504. c.transferjob = transferjob
  1505. return c
  1506. }
  1507. // Fields allows partial responses to be retrieved. See
  1508. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1509. // for more information.
  1510. func (c *TransferJobsCreateCall) Fields(s ...googleapi.Field) *TransferJobsCreateCall {
  1511. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1512. return c
  1513. }
  1514. // Context sets the context to be used in this call's Do method. Any
  1515. // pending HTTP request will be aborted if the provided context is
  1516. // canceled.
  1517. func (c *TransferJobsCreateCall) Context(ctx context.Context) *TransferJobsCreateCall {
  1518. c.ctx_ = ctx
  1519. return c
  1520. }
  1521. // Header returns an http.Header that can be modified by the caller to
  1522. // add HTTP headers to the request.
  1523. func (c *TransferJobsCreateCall) Header() http.Header {
  1524. if c.header_ == nil {
  1525. c.header_ = make(http.Header)
  1526. }
  1527. return c.header_
  1528. }
  1529. func (c *TransferJobsCreateCall) doRequest(alt string) (*http.Response, error) {
  1530. reqHeaders := make(http.Header)
  1531. for k, v := range c.header_ {
  1532. reqHeaders[k] = v
  1533. }
  1534. reqHeaders.Set("User-Agent", c.s.userAgent())
  1535. var body io.Reader = nil
  1536. body, err := googleapi.WithoutDataWrapper.JSONReader(c.transferjob)
  1537. if err != nil {
  1538. return nil, err
  1539. }
  1540. reqHeaders.Set("Content-Type", "application/json")
  1541. c.urlParams_.Set("alt", alt)
  1542. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/transferJobs")
  1543. urls += "?" + c.urlParams_.Encode()
  1544. req, _ := http.NewRequest("POST", urls, body)
  1545. req.Header = reqHeaders
  1546. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1547. }
  1548. // Do executes the "storagetransfer.transferJobs.create" call.
  1549. // Exactly one of *TransferJob or error will be non-nil. Any non-2xx
  1550. // status code is an error. Response headers are in either
  1551. // *TransferJob.ServerResponse.Header or (if a response was returned at
  1552. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1553. // to check whether the returned error was because
  1554. // http.StatusNotModified was returned.
  1555. func (c *TransferJobsCreateCall) Do(opts ...googleapi.CallOption) (*TransferJob, error) {
  1556. gensupport.SetOptions(c.urlParams_, opts...)
  1557. res, err := c.doRequest("json")
  1558. if res != nil && res.StatusCode == http.StatusNotModified {
  1559. if res.Body != nil {
  1560. res.Body.Close()
  1561. }
  1562. return nil, &googleapi.Error{
  1563. Code: res.StatusCode,
  1564. Header: res.Header,
  1565. }
  1566. }
  1567. if err != nil {
  1568. return nil, err
  1569. }
  1570. defer googleapi.CloseBody(res)
  1571. if err := googleapi.CheckResponse(res); err != nil {
  1572. return nil, err
  1573. }
  1574. ret := &TransferJob{
  1575. ServerResponse: googleapi.ServerResponse{
  1576. Header: res.Header,
  1577. HTTPStatusCode: res.StatusCode,
  1578. },
  1579. }
  1580. target := &ret
  1581. if err := gensupport.DecodeResponse(target, res); err != nil {
  1582. return nil, err
  1583. }
  1584. return ret, nil
  1585. // {
  1586. // "description": "Creates a transfer job that runs periodically.",
  1587. // "flatPath": "v1/transferJobs",
  1588. // "httpMethod": "POST",
  1589. // "id": "storagetransfer.transferJobs.create",
  1590. // "parameterOrder": [],
  1591. // "parameters": {},
  1592. // "path": "v1/transferJobs",
  1593. // "request": {
  1594. // "$ref": "TransferJob"
  1595. // },
  1596. // "response": {
  1597. // "$ref": "TransferJob"
  1598. // },
  1599. // "scopes": [
  1600. // "https://www.googleapis.com/auth/cloud-platform"
  1601. // ]
  1602. // }
  1603. }
  1604. // method id "storagetransfer.transferJobs.get":
  1605. type TransferJobsGetCall struct {
  1606. s *Service
  1607. jobName string
  1608. urlParams_ gensupport.URLParams
  1609. ifNoneMatch_ string
  1610. ctx_ context.Context
  1611. header_ http.Header
  1612. }
  1613. // Get: Gets a transfer job.
  1614. func (r *TransferJobsService) Get(jobName string) *TransferJobsGetCall {
  1615. c := &TransferJobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1616. c.jobName = jobName
  1617. return c
  1618. }
  1619. // ProjectId sets the optional parameter "projectId": The ID of the
  1620. // Google Cloud Platform Console project that owns the job.
  1621. // Required.
  1622. func (c *TransferJobsGetCall) ProjectId(projectId string) *TransferJobsGetCall {
  1623. c.urlParams_.Set("projectId", projectId)
  1624. return c
  1625. }
  1626. // Fields allows partial responses to be retrieved. See
  1627. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1628. // for more information.
  1629. func (c *TransferJobsGetCall) Fields(s ...googleapi.Field) *TransferJobsGetCall {
  1630. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1631. return c
  1632. }
  1633. // IfNoneMatch sets the optional parameter which makes the operation
  1634. // fail if the object's ETag matches the given value. This is useful for
  1635. // getting updates only after the object has changed since the last
  1636. // request. Use googleapi.IsNotModified to check whether the response
  1637. // error from Do is the result of In-None-Match.
  1638. func (c *TransferJobsGetCall) IfNoneMatch(entityTag string) *TransferJobsGetCall {
  1639. c.ifNoneMatch_ = entityTag
  1640. return c
  1641. }
  1642. // Context sets the context to be used in this call's Do method. Any
  1643. // pending HTTP request will be aborted if the provided context is
  1644. // canceled.
  1645. func (c *TransferJobsGetCall) Context(ctx context.Context) *TransferJobsGetCall {
  1646. c.ctx_ = ctx
  1647. return c
  1648. }
  1649. // Header returns an http.Header that can be modified by the caller to
  1650. // add HTTP headers to the request.
  1651. func (c *TransferJobsGetCall) Header() http.Header {
  1652. if c.header_ == nil {
  1653. c.header_ = make(http.Header)
  1654. }
  1655. return c.header_
  1656. }
  1657. func (c *TransferJobsGetCall) doRequest(alt string) (*http.Response, error) {
  1658. reqHeaders := make(http.Header)
  1659. for k, v := range c.header_ {
  1660. reqHeaders[k] = v
  1661. }
  1662. reqHeaders.Set("User-Agent", c.s.userAgent())
  1663. if c.ifNoneMatch_ != "" {
  1664. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1665. }
  1666. var body io.Reader = nil
  1667. c.urlParams_.Set("alt", alt)
  1668. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+jobName}")
  1669. urls += "?" + c.urlParams_.Encode()
  1670. req, _ := http.NewRequest("GET", urls, body)
  1671. req.Header = reqHeaders
  1672. googleapi.Expand(req.URL, map[string]string{
  1673. "jobName": c.jobName,
  1674. })
  1675. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1676. }
  1677. // Do executes the "storagetransfer.transferJobs.get" call.
  1678. // Exactly one of *TransferJob or error will be non-nil. Any non-2xx
  1679. // status code is an error. Response headers are in either
  1680. // *TransferJob.ServerResponse.Header or (if a response was returned at
  1681. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1682. // to check whether the returned error was because
  1683. // http.StatusNotModified was returned.
  1684. func (c *TransferJobsGetCall) Do(opts ...googleapi.CallOption) (*TransferJob, error) {
  1685. gensupport.SetOptions(c.urlParams_, opts...)
  1686. res, err := c.doRequest("json")
  1687. if res != nil && res.StatusCode == http.StatusNotModified {
  1688. if res.Body != nil {
  1689. res.Body.Close()
  1690. }
  1691. return nil, &googleapi.Error{
  1692. Code: res.StatusCode,
  1693. Header: res.Header,
  1694. }
  1695. }
  1696. if err != nil {
  1697. return nil, err
  1698. }
  1699. defer googleapi.CloseBody(res)
  1700. if err := googleapi.CheckResponse(res); err != nil {
  1701. return nil, err
  1702. }
  1703. ret := &TransferJob{
  1704. ServerResponse: googleapi.ServerResponse{
  1705. Header: res.Header,
  1706. HTTPStatusCode: res.StatusCode,
  1707. },
  1708. }
  1709. target := &ret
  1710. if err := gensupport.DecodeResponse(target, res); err != nil {
  1711. return nil, err
  1712. }
  1713. return ret, nil
  1714. // {
  1715. // "description": "Gets a transfer job.",
  1716. // "flatPath": "v1/transferJobs/{transferJobsId}",
  1717. // "httpMethod": "GET",
  1718. // "id": "storagetransfer.transferJobs.get",
  1719. // "parameterOrder": [
  1720. // "jobName"
  1721. // ],
  1722. // "parameters": {
  1723. // "jobName": {
  1724. // "description": "The job to get.\nRequired.",
  1725. // "location": "path",
  1726. // "pattern": "^transferJobs/.+$",
  1727. // "required": true,
  1728. // "type": "string"
  1729. // },
  1730. // "projectId": {
  1731. // "description": "The ID of the Google Cloud Platform Console project that owns the job.\nRequired.",
  1732. // "location": "query",
  1733. // "type": "string"
  1734. // }
  1735. // },
  1736. // "path": "v1/{+jobName}",
  1737. // "response": {
  1738. // "$ref": "TransferJob"
  1739. // },
  1740. // "scopes": [
  1741. // "https://www.googleapis.com/auth/cloud-platform"
  1742. // ]
  1743. // }
  1744. }
  1745. // method id "storagetransfer.transferJobs.list":
  1746. type TransferJobsListCall struct {
  1747. s *Service
  1748. urlParams_ gensupport.URLParams
  1749. ifNoneMatch_ string
  1750. ctx_ context.Context
  1751. header_ http.Header
  1752. }
  1753. // List: Lists transfer jobs.
  1754. func (r *TransferJobsService) List() *TransferJobsListCall {
  1755. c := &TransferJobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1756. return c
  1757. }
  1758. // Filter sets the optional parameter "filter": A list of query
  1759. // parameters specified as JSON text in the form
  1760. // of
  1761. // {"project_id":"my_project_id",
  1762. // "job_names":["jobid1","jobid2",...],
  1763. //
  1764. // "job_statuses":["status1","status2",...]}.
  1765. // Since `job_names` and `job_statuses` support multiple values, their
  1766. // values
  1767. // must be specified with array notation. `project_id` is required.
  1768. // `job_names`
  1769. // and `job_statuses` are optional. The valid values for `job_statuses`
  1770. // are
  1771. // case-insensitive: `ENABLED`, `DISABLED`, and `DELETED`.
  1772. func (c *TransferJobsListCall) Filter(filter string) *TransferJobsListCall {
  1773. c.urlParams_.Set("filter", filter)
  1774. return c
  1775. }
  1776. // PageSize sets the optional parameter "pageSize": The list page size.
  1777. // The max allowed value is 256.
  1778. func (c *TransferJobsListCall) PageSize(pageSize int64) *TransferJobsListCall {
  1779. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1780. return c
  1781. }
  1782. // PageToken sets the optional parameter "pageToken": The list page
  1783. // token.
  1784. func (c *TransferJobsListCall) PageToken(pageToken string) *TransferJobsListCall {
  1785. c.urlParams_.Set("pageToken", pageToken)
  1786. return c
  1787. }
  1788. // Fields allows partial responses to be retrieved. See
  1789. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1790. // for more information.
  1791. func (c *TransferJobsListCall) Fields(s ...googleapi.Field) *TransferJobsListCall {
  1792. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1793. return c
  1794. }
  1795. // IfNoneMatch sets the optional parameter which makes the operation
  1796. // fail if the object's ETag matches the given value. This is useful for
  1797. // getting updates only after the object has changed since the last
  1798. // request. Use googleapi.IsNotModified to check whether the response
  1799. // error from Do is the result of In-None-Match.
  1800. func (c *TransferJobsListCall) IfNoneMatch(entityTag string) *TransferJobsListCall {
  1801. c.ifNoneMatch_ = entityTag
  1802. return c
  1803. }
  1804. // Context sets the context to be used in this call's Do method. Any
  1805. // pending HTTP request will be aborted if the provided context is
  1806. // canceled.
  1807. func (c *TransferJobsListCall) Context(ctx context.Context) *TransferJobsListCall {
  1808. c.ctx_ = ctx
  1809. return c
  1810. }
  1811. // Header returns an http.Header that can be modified by the caller to
  1812. // add HTTP headers to the request.
  1813. func (c *TransferJobsListCall) Header() http.Header {
  1814. if c.header_ == nil {
  1815. c.header_ = make(http.Header)
  1816. }
  1817. return c.header_
  1818. }
  1819. func (c *TransferJobsListCall) doRequest(alt string) (*http.Response, error) {
  1820. reqHeaders := make(http.Header)
  1821. for k, v := range c.header_ {
  1822. reqHeaders[k] = v
  1823. }
  1824. reqHeaders.Set("User-Agent", c.s.userAgent())
  1825. if c.ifNoneMatch_ != "" {
  1826. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1827. }
  1828. var body io.Reader = nil
  1829. c.urlParams_.Set("alt", alt)
  1830. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/transferJobs")
  1831. urls += "?" + c.urlParams_.Encode()
  1832. req, _ := http.NewRequest("GET", urls, body)
  1833. req.Header = reqHeaders
  1834. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1835. }
  1836. // Do executes the "storagetransfer.transferJobs.list" call.
  1837. // Exactly one of *ListTransferJobsResponse or error will be non-nil.
  1838. // Any non-2xx status code is an error. Response headers are in either
  1839. // *ListTransferJobsResponse.ServerResponse.Header or (if a response was
  1840. // returned at all) in error.(*googleapi.Error).Header. Use
  1841. // googleapi.IsNotModified to check whether the returned error was
  1842. // because http.StatusNotModified was returned.
  1843. func (c *TransferJobsListCall) Do(opts ...googleapi.CallOption) (*ListTransferJobsResponse, error) {
  1844. gensupport.SetOptions(c.urlParams_, opts...)
  1845. res, err := c.doRequest("json")
  1846. if res != nil && res.StatusCode == http.StatusNotModified {
  1847. if res.Body != nil {
  1848. res.Body.Close()
  1849. }
  1850. return nil, &googleapi.Error{
  1851. Code: res.StatusCode,
  1852. Header: res.Header,
  1853. }
  1854. }
  1855. if err != nil {
  1856. return nil, err
  1857. }
  1858. defer googleapi.CloseBody(res)
  1859. if err := googleapi.CheckResponse(res); err != nil {
  1860. return nil, err
  1861. }
  1862. ret := &ListTransferJobsResponse{
  1863. ServerResponse: googleapi.ServerResponse{
  1864. Header: res.Header,
  1865. HTTPStatusCode: res.StatusCode,
  1866. },
  1867. }
  1868. target := &ret
  1869. if err := gensupport.DecodeResponse(target, res); err != nil {
  1870. return nil, err
  1871. }
  1872. return ret, nil
  1873. // {
  1874. // "description": "Lists transfer jobs.",
  1875. // "flatPath": "v1/transferJobs",
  1876. // "httpMethod": "GET",
  1877. // "id": "storagetransfer.transferJobs.list",
  1878. // "parameterOrder": [],
  1879. // "parameters": {
  1880. // "filter": {
  1881. // "description": "A list of query parameters specified as JSON text in the form of\n{\"project_id\":\"my_project_id\",\n\"job_names\":[\"jobid1\",\"jobid2\",...],\n\"job_statuses\":[\"status1\",\"status2\",...]}.\nSince `job_names` and `job_statuses` support multiple values, their values\nmust be specified with array notation. `project_id` is required. `job_names`\nand `job_statuses` are optional. The valid values for `job_statuses` are\ncase-insensitive: `ENABLED`, `DISABLED`, and `DELETED`.",
  1882. // "location": "query",
  1883. // "type": "string"
  1884. // },
  1885. // "pageSize": {
  1886. // "description": "The list page size. The max allowed value is 256.",
  1887. // "format": "int32",
  1888. // "location": "query",
  1889. // "type": "integer"
  1890. // },
  1891. // "pageToken": {
  1892. // "description": "The list page token.",
  1893. // "location": "query",
  1894. // "type": "string"
  1895. // }
  1896. // },
  1897. // "path": "v1/transferJobs",
  1898. // "response": {
  1899. // "$ref": "ListTransferJobsResponse"
  1900. // },
  1901. // "scopes": [
  1902. // "https://www.googleapis.com/auth/cloud-platform"
  1903. // ]
  1904. // }
  1905. }
  1906. // Pages invokes f for each page of results.
  1907. // A non-nil error returned from f will halt the iteration.
  1908. // The provided context supersedes any context provided to the Context method.
  1909. func (c *TransferJobsListCall) Pages(ctx context.Context, f func(*ListTransferJobsResponse) error) error {
  1910. c.ctx_ = ctx
  1911. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1912. for {
  1913. x, err := c.Do()
  1914. if err != nil {
  1915. return err
  1916. }
  1917. if err := f(x); err != nil {
  1918. return err
  1919. }
  1920. if x.NextPageToken == "" {
  1921. return nil
  1922. }
  1923. c.PageToken(x.NextPageToken)
  1924. }
  1925. }
  1926. // method id "storagetransfer.transferJobs.patch":
  1927. type TransferJobsPatchCall struct {
  1928. s *Service
  1929. jobName string
  1930. updatetransferjobrequest *UpdateTransferJobRequest
  1931. urlParams_ gensupport.URLParams
  1932. ctx_ context.Context
  1933. header_ http.Header
  1934. }
  1935. // Patch: Updates a transfer job. Updating a job's transfer spec does
  1936. // not affect
  1937. // transfer operations that are running already. Updating the
  1938. // scheduling
  1939. // of a job is not allowed.
  1940. func (r *TransferJobsService) Patch(jobName string, updatetransferjobrequest *UpdateTransferJobRequest) *TransferJobsPatchCall {
  1941. c := &TransferJobsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1942. c.jobName = jobName
  1943. c.updatetransferjobrequest = updatetransferjobrequest
  1944. return c
  1945. }
  1946. // Fields allows partial responses to be retrieved. See
  1947. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1948. // for more information.
  1949. func (c *TransferJobsPatchCall) Fields(s ...googleapi.Field) *TransferJobsPatchCall {
  1950. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1951. return c
  1952. }
  1953. // Context sets the context to be used in this call's Do method. Any
  1954. // pending HTTP request will be aborted if the provided context is
  1955. // canceled.
  1956. func (c *TransferJobsPatchCall) Context(ctx context.Context) *TransferJobsPatchCall {
  1957. c.ctx_ = ctx
  1958. return c
  1959. }
  1960. // Header returns an http.Header that can be modified by the caller to
  1961. // add HTTP headers to the request.
  1962. func (c *TransferJobsPatchCall) Header() http.Header {
  1963. if c.header_ == nil {
  1964. c.header_ = make(http.Header)
  1965. }
  1966. return c.header_
  1967. }
  1968. func (c *TransferJobsPatchCall) doRequest(alt string) (*http.Response, error) {
  1969. reqHeaders := make(http.Header)
  1970. for k, v := range c.header_ {
  1971. reqHeaders[k] = v
  1972. }
  1973. reqHeaders.Set("User-Agent", c.s.userAgent())
  1974. var body io.Reader = nil
  1975. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatetransferjobrequest)
  1976. if err != nil {
  1977. return nil, err
  1978. }
  1979. reqHeaders.Set("Content-Type", "application/json")
  1980. c.urlParams_.Set("alt", alt)
  1981. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+jobName}")
  1982. urls += "?" + c.urlParams_.Encode()
  1983. req, _ := http.NewRequest("PATCH", urls, body)
  1984. req.Header = reqHeaders
  1985. googleapi.Expand(req.URL, map[string]string{
  1986. "jobName": c.jobName,
  1987. })
  1988. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1989. }
  1990. // Do executes the "storagetransfer.transferJobs.patch" call.
  1991. // Exactly one of *TransferJob or error will be non-nil. Any non-2xx
  1992. // status code is an error. Response headers are in either
  1993. // *TransferJob.ServerResponse.Header or (if a response was returned at
  1994. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1995. // to check whether the returned error was because
  1996. // http.StatusNotModified was returned.
  1997. func (c *TransferJobsPatchCall) Do(opts ...googleapi.CallOption) (*TransferJob, 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 := &TransferJob{
  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": "Updates a transfer job. Updating a job's transfer spec does not affect\ntransfer operations that are running already. Updating the scheduling\nof a job is not allowed.",
  2029. // "flatPath": "v1/transferJobs/{transferJobsId}",
  2030. // "httpMethod": "PATCH",
  2031. // "id": "storagetransfer.transferJobs.patch",
  2032. // "parameterOrder": [
  2033. // "jobName"
  2034. // ],
  2035. // "parameters": {
  2036. // "jobName": {
  2037. // "description": "The name of job to update.\nRequired.",
  2038. // "location": "path",
  2039. // "pattern": "^transferJobs/.+$",
  2040. // "required": true,
  2041. // "type": "string"
  2042. // }
  2043. // },
  2044. // "path": "v1/{+jobName}",
  2045. // "request": {
  2046. // "$ref": "UpdateTransferJobRequest"
  2047. // },
  2048. // "response": {
  2049. // "$ref": "TransferJob"
  2050. // },
  2051. // "scopes": [
  2052. // "https://www.googleapis.com/auth/cloud-platform"
  2053. // ]
  2054. // }
  2055. }
  2056. // method id "storagetransfer.transferOperations.cancel":
  2057. type TransferOperationsCancelCall struct {
  2058. s *Service
  2059. name string
  2060. urlParams_ gensupport.URLParams
  2061. ctx_ context.Context
  2062. header_ http.Header
  2063. }
  2064. // Cancel: Cancels a transfer. Use the get method to check whether the
  2065. // cancellation succeeded or whether the operation completed despite
  2066. // cancellation.
  2067. func (r *TransferOperationsService) Cancel(name string) *TransferOperationsCancelCall {
  2068. c := &TransferOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2069. c.name = name
  2070. return c
  2071. }
  2072. // Fields allows partial responses to be retrieved. See
  2073. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2074. // for more information.
  2075. func (c *TransferOperationsCancelCall) Fields(s ...googleapi.Field) *TransferOperationsCancelCall {
  2076. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2077. return c
  2078. }
  2079. // Context sets the context to be used in this call's Do method. Any
  2080. // pending HTTP request will be aborted if the provided context is
  2081. // canceled.
  2082. func (c *TransferOperationsCancelCall) Context(ctx context.Context) *TransferOperationsCancelCall {
  2083. c.ctx_ = ctx
  2084. return c
  2085. }
  2086. // Header returns an http.Header that can be modified by the caller to
  2087. // add HTTP headers to the request.
  2088. func (c *TransferOperationsCancelCall) Header() http.Header {
  2089. if c.header_ == nil {
  2090. c.header_ = make(http.Header)
  2091. }
  2092. return c.header_
  2093. }
  2094. func (c *TransferOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  2095. reqHeaders := make(http.Header)
  2096. for k, v := range c.header_ {
  2097. reqHeaders[k] = v
  2098. }
  2099. reqHeaders.Set("User-Agent", c.s.userAgent())
  2100. var body io.Reader = nil
  2101. c.urlParams_.Set("alt", alt)
  2102. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  2103. urls += "?" + c.urlParams_.Encode()
  2104. req, _ := http.NewRequest("POST", urls, body)
  2105. req.Header = reqHeaders
  2106. googleapi.Expand(req.URL, map[string]string{
  2107. "name": c.name,
  2108. })
  2109. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2110. }
  2111. // Do executes the "storagetransfer.transferOperations.cancel" call.
  2112. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2113. // code is an error. Response headers are in either
  2114. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2115. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2116. // check whether the returned error was because http.StatusNotModified
  2117. // was returned.
  2118. func (c *TransferOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2119. gensupport.SetOptions(c.urlParams_, opts...)
  2120. res, err := c.doRequest("json")
  2121. if res != nil && res.StatusCode == http.StatusNotModified {
  2122. if res.Body != nil {
  2123. res.Body.Close()
  2124. }
  2125. return nil, &googleapi.Error{
  2126. Code: res.StatusCode,
  2127. Header: res.Header,
  2128. }
  2129. }
  2130. if err != nil {
  2131. return nil, err
  2132. }
  2133. defer googleapi.CloseBody(res)
  2134. if err := googleapi.CheckResponse(res); err != nil {
  2135. return nil, err
  2136. }
  2137. ret := &Empty{
  2138. ServerResponse: googleapi.ServerResponse{
  2139. Header: res.Header,
  2140. HTTPStatusCode: res.StatusCode,
  2141. },
  2142. }
  2143. target := &ret
  2144. if err := gensupport.DecodeResponse(target, res); err != nil {
  2145. return nil, err
  2146. }
  2147. return ret, nil
  2148. // {
  2149. // "description": "Cancels a transfer. Use the get method to check whether the cancellation succeeded or whether the operation completed despite cancellation.",
  2150. // "flatPath": "v1/transferOperations/{transferOperationsId}:cancel",
  2151. // "httpMethod": "POST",
  2152. // "id": "storagetransfer.transferOperations.cancel",
  2153. // "parameterOrder": [
  2154. // "name"
  2155. // ],
  2156. // "parameters": {
  2157. // "name": {
  2158. // "description": "The name of the operation resource to be cancelled.",
  2159. // "location": "path",
  2160. // "pattern": "^transferOperations/.+$",
  2161. // "required": true,
  2162. // "type": "string"
  2163. // }
  2164. // },
  2165. // "path": "v1/{+name}:cancel",
  2166. // "response": {
  2167. // "$ref": "Empty"
  2168. // },
  2169. // "scopes": [
  2170. // "https://www.googleapis.com/auth/cloud-platform"
  2171. // ]
  2172. // }
  2173. }
  2174. // method id "storagetransfer.transferOperations.delete":
  2175. type TransferOperationsDeleteCall struct {
  2176. s *Service
  2177. name string
  2178. urlParams_ gensupport.URLParams
  2179. ctx_ context.Context
  2180. header_ http.Header
  2181. }
  2182. // Delete: This method is not supported and the server returns
  2183. // `UNIMPLEMENTED`.
  2184. func (r *TransferOperationsService) Delete(name string) *TransferOperationsDeleteCall {
  2185. c := &TransferOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2186. c.name = name
  2187. return c
  2188. }
  2189. // Fields allows partial responses to be retrieved. See
  2190. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2191. // for more information.
  2192. func (c *TransferOperationsDeleteCall) Fields(s ...googleapi.Field) *TransferOperationsDeleteCall {
  2193. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2194. return c
  2195. }
  2196. // Context sets the context to be used in this call's Do method. Any
  2197. // pending HTTP request will be aborted if the provided context is
  2198. // canceled.
  2199. func (c *TransferOperationsDeleteCall) Context(ctx context.Context) *TransferOperationsDeleteCall {
  2200. c.ctx_ = ctx
  2201. return c
  2202. }
  2203. // Header returns an http.Header that can be modified by the caller to
  2204. // add HTTP headers to the request.
  2205. func (c *TransferOperationsDeleteCall) Header() http.Header {
  2206. if c.header_ == nil {
  2207. c.header_ = make(http.Header)
  2208. }
  2209. return c.header_
  2210. }
  2211. func (c *TransferOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2212. reqHeaders := make(http.Header)
  2213. for k, v := range c.header_ {
  2214. reqHeaders[k] = v
  2215. }
  2216. reqHeaders.Set("User-Agent", c.s.userAgent())
  2217. var body io.Reader = nil
  2218. c.urlParams_.Set("alt", alt)
  2219. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2220. urls += "?" + c.urlParams_.Encode()
  2221. req, _ := http.NewRequest("DELETE", urls, body)
  2222. req.Header = reqHeaders
  2223. googleapi.Expand(req.URL, map[string]string{
  2224. "name": c.name,
  2225. })
  2226. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2227. }
  2228. // Do executes the "storagetransfer.transferOperations.delete" call.
  2229. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2230. // code is an error. Response headers are in either
  2231. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2232. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2233. // check whether the returned error was because http.StatusNotModified
  2234. // was returned.
  2235. func (c *TransferOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2236. gensupport.SetOptions(c.urlParams_, opts...)
  2237. res, err := c.doRequest("json")
  2238. if res != nil && res.StatusCode == http.StatusNotModified {
  2239. if res.Body != nil {
  2240. res.Body.Close()
  2241. }
  2242. return nil, &googleapi.Error{
  2243. Code: res.StatusCode,
  2244. Header: res.Header,
  2245. }
  2246. }
  2247. if err != nil {
  2248. return nil, err
  2249. }
  2250. defer googleapi.CloseBody(res)
  2251. if err := googleapi.CheckResponse(res); err != nil {
  2252. return nil, err
  2253. }
  2254. ret := &Empty{
  2255. ServerResponse: googleapi.ServerResponse{
  2256. Header: res.Header,
  2257. HTTPStatusCode: res.StatusCode,
  2258. },
  2259. }
  2260. target := &ret
  2261. if err := gensupport.DecodeResponse(target, res); err != nil {
  2262. return nil, err
  2263. }
  2264. return ret, nil
  2265. // {
  2266. // "description": "This method is not supported and the server returns `UNIMPLEMENTED`.",
  2267. // "flatPath": "v1/transferOperations/{transferOperationsId}",
  2268. // "httpMethod": "DELETE",
  2269. // "id": "storagetransfer.transferOperations.delete",
  2270. // "parameterOrder": [
  2271. // "name"
  2272. // ],
  2273. // "parameters": {
  2274. // "name": {
  2275. // "description": "The name of the operation resource to be deleted.",
  2276. // "location": "path",
  2277. // "pattern": "^transferOperations/.+$",
  2278. // "required": true,
  2279. // "type": "string"
  2280. // }
  2281. // },
  2282. // "path": "v1/{+name}",
  2283. // "response": {
  2284. // "$ref": "Empty"
  2285. // },
  2286. // "scopes": [
  2287. // "https://www.googleapis.com/auth/cloud-platform"
  2288. // ]
  2289. // }
  2290. }
  2291. // method id "storagetransfer.transferOperations.get":
  2292. type TransferOperationsGetCall struct {
  2293. s *Service
  2294. name string
  2295. urlParams_ gensupport.URLParams
  2296. ifNoneMatch_ string
  2297. ctx_ context.Context
  2298. header_ http.Header
  2299. }
  2300. // Get: Gets the latest state of a long-running operation. Clients can
  2301. // use this
  2302. // method to poll the operation result at intervals as recommended by
  2303. // the API
  2304. // service.
  2305. func (r *TransferOperationsService) Get(name string) *TransferOperationsGetCall {
  2306. c := &TransferOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2307. c.name = name
  2308. return c
  2309. }
  2310. // Fields allows partial responses to be retrieved. See
  2311. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2312. // for more information.
  2313. func (c *TransferOperationsGetCall) Fields(s ...googleapi.Field) *TransferOperationsGetCall {
  2314. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2315. return c
  2316. }
  2317. // IfNoneMatch sets the optional parameter which makes the operation
  2318. // fail if the object's ETag matches the given value. This is useful for
  2319. // getting updates only after the object has changed since the last
  2320. // request. Use googleapi.IsNotModified to check whether the response
  2321. // error from Do is the result of In-None-Match.
  2322. func (c *TransferOperationsGetCall) IfNoneMatch(entityTag string) *TransferOperationsGetCall {
  2323. c.ifNoneMatch_ = entityTag
  2324. return c
  2325. }
  2326. // Context sets the context to be used in this call's Do method. Any
  2327. // pending HTTP request will be aborted if the provided context is
  2328. // canceled.
  2329. func (c *TransferOperationsGetCall) Context(ctx context.Context) *TransferOperationsGetCall {
  2330. c.ctx_ = ctx
  2331. return c
  2332. }
  2333. // Header returns an http.Header that can be modified by the caller to
  2334. // add HTTP headers to the request.
  2335. func (c *TransferOperationsGetCall) Header() http.Header {
  2336. if c.header_ == nil {
  2337. c.header_ = make(http.Header)
  2338. }
  2339. return c.header_
  2340. }
  2341. func (c *TransferOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  2342. reqHeaders := make(http.Header)
  2343. for k, v := range c.header_ {
  2344. reqHeaders[k] = v
  2345. }
  2346. reqHeaders.Set("User-Agent", c.s.userAgent())
  2347. if c.ifNoneMatch_ != "" {
  2348. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2349. }
  2350. var body io.Reader = nil
  2351. c.urlParams_.Set("alt", alt)
  2352. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2353. urls += "?" + c.urlParams_.Encode()
  2354. req, _ := http.NewRequest("GET", urls, body)
  2355. req.Header = reqHeaders
  2356. googleapi.Expand(req.URL, map[string]string{
  2357. "name": c.name,
  2358. })
  2359. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2360. }
  2361. // Do executes the "storagetransfer.transferOperations.get" call.
  2362. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2363. // status code is an error. Response headers are in either
  2364. // *Operation.ServerResponse.Header or (if a response was returned at
  2365. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2366. // to check whether the returned error was because
  2367. // http.StatusNotModified was returned.
  2368. func (c *TransferOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2369. gensupport.SetOptions(c.urlParams_, opts...)
  2370. res, err := c.doRequest("json")
  2371. if res != nil && res.StatusCode == http.StatusNotModified {
  2372. if res.Body != nil {
  2373. res.Body.Close()
  2374. }
  2375. return nil, &googleapi.Error{
  2376. Code: res.StatusCode,
  2377. Header: res.Header,
  2378. }
  2379. }
  2380. if err != nil {
  2381. return nil, err
  2382. }
  2383. defer googleapi.CloseBody(res)
  2384. if err := googleapi.CheckResponse(res); err != nil {
  2385. return nil, err
  2386. }
  2387. ret := &Operation{
  2388. ServerResponse: googleapi.ServerResponse{
  2389. Header: res.Header,
  2390. HTTPStatusCode: res.StatusCode,
  2391. },
  2392. }
  2393. target := &ret
  2394. if err := gensupport.DecodeResponse(target, res); err != nil {
  2395. return nil, err
  2396. }
  2397. return ret, nil
  2398. // {
  2399. // "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.",
  2400. // "flatPath": "v1/transferOperations/{transferOperationsId}",
  2401. // "httpMethod": "GET",
  2402. // "id": "storagetransfer.transferOperations.get",
  2403. // "parameterOrder": [
  2404. // "name"
  2405. // ],
  2406. // "parameters": {
  2407. // "name": {
  2408. // "description": "The name of the operation resource.",
  2409. // "location": "path",
  2410. // "pattern": "^transferOperations/.+$",
  2411. // "required": true,
  2412. // "type": "string"
  2413. // }
  2414. // },
  2415. // "path": "v1/{+name}",
  2416. // "response": {
  2417. // "$ref": "Operation"
  2418. // },
  2419. // "scopes": [
  2420. // "https://www.googleapis.com/auth/cloud-platform"
  2421. // ]
  2422. // }
  2423. }
  2424. // method id "storagetransfer.transferOperations.list":
  2425. type TransferOperationsListCall struct {
  2426. s *Service
  2427. name string
  2428. urlParams_ gensupport.URLParams
  2429. ifNoneMatch_ string
  2430. ctx_ context.Context
  2431. header_ http.Header
  2432. }
  2433. // List: Lists operations that match the specified filter in the
  2434. // request. If the
  2435. // server doesn't support this method, it returns
  2436. // `UNIMPLEMENTED`.
  2437. //
  2438. // NOTE: the `name` binding allows API services to override the
  2439. // binding
  2440. // to use different resource name schemes, such as `users/*/operations`.
  2441. // To
  2442. // override the binding, API services can add a binding such
  2443. // as
  2444. // "/v1/{name=users/*}/operations" to their service configuration.
  2445. // For backwards compatibility, the default name includes the
  2446. // operations
  2447. // collection id, however overriding users must ensure the name
  2448. // binding
  2449. // is the parent resource, without the operations collection id.
  2450. func (r *TransferOperationsService) List(name string) *TransferOperationsListCall {
  2451. c := &TransferOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2452. c.name = name
  2453. return c
  2454. }
  2455. // Filter sets the optional parameter "filter": A list of query
  2456. // parameters specified as JSON text in the form of {\"project_id\" :
  2457. // \"my_project_id\", \"job_names\" : [\"jobid1\", \"jobid2\",...],
  2458. // \"operation_names\" : [\"opid1\", \"opid2\",...],
  2459. // \"transfer_statuses\":[\"status1\", \"status2\",...]}. Since
  2460. // `job_names`, `operation_names`, and `transfer_statuses` support
  2461. // multiple values, they must be specified with array notation.
  2462. // `job_names`, `operation_names`, and `transfer_statuses` are optional.
  2463. func (c *TransferOperationsListCall) Filter(filter string) *TransferOperationsListCall {
  2464. c.urlParams_.Set("filter", filter)
  2465. return c
  2466. }
  2467. // PageSize sets the optional parameter "pageSize": The list page size.
  2468. // The max allowed value is 256.
  2469. func (c *TransferOperationsListCall) PageSize(pageSize int64) *TransferOperationsListCall {
  2470. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2471. return c
  2472. }
  2473. // PageToken sets the optional parameter "pageToken": The list page
  2474. // token.
  2475. func (c *TransferOperationsListCall) PageToken(pageToken string) *TransferOperationsListCall {
  2476. c.urlParams_.Set("pageToken", pageToken)
  2477. return c
  2478. }
  2479. // Fields allows partial responses to be retrieved. See
  2480. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2481. // for more information.
  2482. func (c *TransferOperationsListCall) Fields(s ...googleapi.Field) *TransferOperationsListCall {
  2483. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2484. return c
  2485. }
  2486. // IfNoneMatch sets the optional parameter which makes the operation
  2487. // fail if the object's ETag matches the given value. This is useful for
  2488. // getting updates only after the object has changed since the last
  2489. // request. Use googleapi.IsNotModified to check whether the response
  2490. // error from Do is the result of In-None-Match.
  2491. func (c *TransferOperationsListCall) IfNoneMatch(entityTag string) *TransferOperationsListCall {
  2492. c.ifNoneMatch_ = entityTag
  2493. return c
  2494. }
  2495. // Context sets the context to be used in this call's Do method. Any
  2496. // pending HTTP request will be aborted if the provided context is
  2497. // canceled.
  2498. func (c *TransferOperationsListCall) Context(ctx context.Context) *TransferOperationsListCall {
  2499. c.ctx_ = ctx
  2500. return c
  2501. }
  2502. // Header returns an http.Header that can be modified by the caller to
  2503. // add HTTP headers to the request.
  2504. func (c *TransferOperationsListCall) Header() http.Header {
  2505. if c.header_ == nil {
  2506. c.header_ = make(http.Header)
  2507. }
  2508. return c.header_
  2509. }
  2510. func (c *TransferOperationsListCall) doRequest(alt string) (*http.Response, error) {
  2511. reqHeaders := make(http.Header)
  2512. for k, v := range c.header_ {
  2513. reqHeaders[k] = v
  2514. }
  2515. reqHeaders.Set("User-Agent", c.s.userAgent())
  2516. if c.ifNoneMatch_ != "" {
  2517. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2518. }
  2519. var body io.Reader = nil
  2520. c.urlParams_.Set("alt", alt)
  2521. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2522. urls += "?" + c.urlParams_.Encode()
  2523. req, _ := http.NewRequest("GET", urls, body)
  2524. req.Header = reqHeaders
  2525. googleapi.Expand(req.URL, map[string]string{
  2526. "name": c.name,
  2527. })
  2528. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2529. }
  2530. // Do executes the "storagetransfer.transferOperations.list" call.
  2531. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  2532. // non-2xx status code is an error. Response headers are in either
  2533. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  2534. // returned at all) in error.(*googleapi.Error).Header. Use
  2535. // googleapi.IsNotModified to check whether the returned error was
  2536. // because http.StatusNotModified was returned.
  2537. func (c *TransferOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  2538. gensupport.SetOptions(c.urlParams_, opts...)
  2539. res, err := c.doRequest("json")
  2540. if res != nil && res.StatusCode == http.StatusNotModified {
  2541. if res.Body != nil {
  2542. res.Body.Close()
  2543. }
  2544. return nil, &googleapi.Error{
  2545. Code: res.StatusCode,
  2546. Header: res.Header,
  2547. }
  2548. }
  2549. if err != nil {
  2550. return nil, err
  2551. }
  2552. defer googleapi.CloseBody(res)
  2553. if err := googleapi.CheckResponse(res); err != nil {
  2554. return nil, err
  2555. }
  2556. ret := &ListOperationsResponse{
  2557. ServerResponse: googleapi.ServerResponse{
  2558. Header: res.Header,
  2559. HTTPStatusCode: res.StatusCode,
  2560. },
  2561. }
  2562. target := &ret
  2563. if err := gensupport.DecodeResponse(target, res); err != nil {
  2564. return nil, err
  2565. }
  2566. return ret, nil
  2567. // {
  2568. // "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.",
  2569. // "flatPath": "v1/transferOperations",
  2570. // "httpMethod": "GET",
  2571. // "id": "storagetransfer.transferOperations.list",
  2572. // "parameterOrder": [
  2573. // "name"
  2574. // ],
  2575. // "parameters": {
  2576. // "filter": {
  2577. // "description": "A list of query parameters specified as JSON text in the form of {\\\"project_id\\\" : \\\"my_project_id\\\", \\\"job_names\\\" : [\\\"jobid1\\\", \\\"jobid2\\\",...], \\\"operation_names\\\" : [\\\"opid1\\\", \\\"opid2\\\",...], \\\"transfer_statuses\\\":[\\\"status1\\\", \\\"status2\\\",...]}. Since `job_names`, `operation_names`, and `transfer_statuses` support multiple values, they must be specified with array notation. `job_names`, `operation_names`, and `transfer_statuses` are optional.",
  2578. // "location": "query",
  2579. // "type": "string"
  2580. // },
  2581. // "name": {
  2582. // "description": "The value `transferOperations`.",
  2583. // "location": "path",
  2584. // "pattern": "^transferOperations$",
  2585. // "required": true,
  2586. // "type": "string"
  2587. // },
  2588. // "pageSize": {
  2589. // "description": "The list page size. The max allowed value is 256.",
  2590. // "format": "int32",
  2591. // "location": "query",
  2592. // "type": "integer"
  2593. // },
  2594. // "pageToken": {
  2595. // "description": "The list page token.",
  2596. // "location": "query",
  2597. // "type": "string"
  2598. // }
  2599. // },
  2600. // "path": "v1/{+name}",
  2601. // "response": {
  2602. // "$ref": "ListOperationsResponse"
  2603. // },
  2604. // "scopes": [
  2605. // "https://www.googleapis.com/auth/cloud-platform"
  2606. // ]
  2607. // }
  2608. }
  2609. // Pages invokes f for each page of results.
  2610. // A non-nil error returned from f will halt the iteration.
  2611. // The provided context supersedes any context provided to the Context method.
  2612. func (c *TransferOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  2613. c.ctx_ = ctx
  2614. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2615. for {
  2616. x, err := c.Do()
  2617. if err != nil {
  2618. return err
  2619. }
  2620. if err := f(x); err != nil {
  2621. return err
  2622. }
  2623. if x.NextPageToken == "" {
  2624. return nil
  2625. }
  2626. c.PageToken(x.NextPageToken)
  2627. }
  2628. }
  2629. // method id "storagetransfer.transferOperations.pause":
  2630. type TransferOperationsPauseCall struct {
  2631. s *Service
  2632. name string
  2633. pausetransferoperationrequest *PauseTransferOperationRequest
  2634. urlParams_ gensupport.URLParams
  2635. ctx_ context.Context
  2636. header_ http.Header
  2637. }
  2638. // Pause: Pauses a transfer operation.
  2639. func (r *TransferOperationsService) Pause(name string, pausetransferoperationrequest *PauseTransferOperationRequest) *TransferOperationsPauseCall {
  2640. c := &TransferOperationsPauseCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2641. c.name = name
  2642. c.pausetransferoperationrequest = pausetransferoperationrequest
  2643. return c
  2644. }
  2645. // Fields allows partial responses to be retrieved. See
  2646. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2647. // for more information.
  2648. func (c *TransferOperationsPauseCall) Fields(s ...googleapi.Field) *TransferOperationsPauseCall {
  2649. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2650. return c
  2651. }
  2652. // Context sets the context to be used in this call's Do method. Any
  2653. // pending HTTP request will be aborted if the provided context is
  2654. // canceled.
  2655. func (c *TransferOperationsPauseCall) Context(ctx context.Context) *TransferOperationsPauseCall {
  2656. c.ctx_ = ctx
  2657. return c
  2658. }
  2659. // Header returns an http.Header that can be modified by the caller to
  2660. // add HTTP headers to the request.
  2661. func (c *TransferOperationsPauseCall) Header() http.Header {
  2662. if c.header_ == nil {
  2663. c.header_ = make(http.Header)
  2664. }
  2665. return c.header_
  2666. }
  2667. func (c *TransferOperationsPauseCall) doRequest(alt string) (*http.Response, error) {
  2668. reqHeaders := make(http.Header)
  2669. for k, v := range c.header_ {
  2670. reqHeaders[k] = v
  2671. }
  2672. reqHeaders.Set("User-Agent", c.s.userAgent())
  2673. var body io.Reader = nil
  2674. body, err := googleapi.WithoutDataWrapper.JSONReader(c.pausetransferoperationrequest)
  2675. if err != nil {
  2676. return nil, err
  2677. }
  2678. reqHeaders.Set("Content-Type", "application/json")
  2679. c.urlParams_.Set("alt", alt)
  2680. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:pause")
  2681. urls += "?" + c.urlParams_.Encode()
  2682. req, _ := http.NewRequest("POST", urls, body)
  2683. req.Header = reqHeaders
  2684. googleapi.Expand(req.URL, map[string]string{
  2685. "name": c.name,
  2686. })
  2687. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2688. }
  2689. // Do executes the "storagetransfer.transferOperations.pause" call.
  2690. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2691. // code is an error. Response headers are in either
  2692. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2693. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2694. // check whether the returned error was because http.StatusNotModified
  2695. // was returned.
  2696. func (c *TransferOperationsPauseCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2697. gensupport.SetOptions(c.urlParams_, opts...)
  2698. res, err := c.doRequest("json")
  2699. if res != nil && res.StatusCode == http.StatusNotModified {
  2700. if res.Body != nil {
  2701. res.Body.Close()
  2702. }
  2703. return nil, &googleapi.Error{
  2704. Code: res.StatusCode,
  2705. Header: res.Header,
  2706. }
  2707. }
  2708. if err != nil {
  2709. return nil, err
  2710. }
  2711. defer googleapi.CloseBody(res)
  2712. if err := googleapi.CheckResponse(res); err != nil {
  2713. return nil, err
  2714. }
  2715. ret := &Empty{
  2716. ServerResponse: googleapi.ServerResponse{
  2717. Header: res.Header,
  2718. HTTPStatusCode: res.StatusCode,
  2719. },
  2720. }
  2721. target := &ret
  2722. if err := gensupport.DecodeResponse(target, res); err != nil {
  2723. return nil, err
  2724. }
  2725. return ret, nil
  2726. // {
  2727. // "description": "Pauses a transfer operation.",
  2728. // "flatPath": "v1/transferOperations/{transferOperationsId}:pause",
  2729. // "httpMethod": "POST",
  2730. // "id": "storagetransfer.transferOperations.pause",
  2731. // "parameterOrder": [
  2732. // "name"
  2733. // ],
  2734. // "parameters": {
  2735. // "name": {
  2736. // "description": "The name of the transfer operation.\nRequired.",
  2737. // "location": "path",
  2738. // "pattern": "^transferOperations/.+$",
  2739. // "required": true,
  2740. // "type": "string"
  2741. // }
  2742. // },
  2743. // "path": "v1/{+name}:pause",
  2744. // "request": {
  2745. // "$ref": "PauseTransferOperationRequest"
  2746. // },
  2747. // "response": {
  2748. // "$ref": "Empty"
  2749. // },
  2750. // "scopes": [
  2751. // "https://www.googleapis.com/auth/cloud-platform"
  2752. // ]
  2753. // }
  2754. }
  2755. // method id "storagetransfer.transferOperations.resume":
  2756. type TransferOperationsResumeCall struct {
  2757. s *Service
  2758. name string
  2759. resumetransferoperationrequest *ResumeTransferOperationRequest
  2760. urlParams_ gensupport.URLParams
  2761. ctx_ context.Context
  2762. header_ http.Header
  2763. }
  2764. // Resume: Resumes a transfer operation that is paused.
  2765. func (r *TransferOperationsService) Resume(name string, resumetransferoperationrequest *ResumeTransferOperationRequest) *TransferOperationsResumeCall {
  2766. c := &TransferOperationsResumeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2767. c.name = name
  2768. c.resumetransferoperationrequest = resumetransferoperationrequest
  2769. return c
  2770. }
  2771. // Fields allows partial responses to be retrieved. See
  2772. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2773. // for more information.
  2774. func (c *TransferOperationsResumeCall) Fields(s ...googleapi.Field) *TransferOperationsResumeCall {
  2775. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2776. return c
  2777. }
  2778. // Context sets the context to be used in this call's Do method. Any
  2779. // pending HTTP request will be aborted if the provided context is
  2780. // canceled.
  2781. func (c *TransferOperationsResumeCall) Context(ctx context.Context) *TransferOperationsResumeCall {
  2782. c.ctx_ = ctx
  2783. return c
  2784. }
  2785. // Header returns an http.Header that can be modified by the caller to
  2786. // add HTTP headers to the request.
  2787. func (c *TransferOperationsResumeCall) Header() http.Header {
  2788. if c.header_ == nil {
  2789. c.header_ = make(http.Header)
  2790. }
  2791. return c.header_
  2792. }
  2793. func (c *TransferOperationsResumeCall) doRequest(alt string) (*http.Response, error) {
  2794. reqHeaders := make(http.Header)
  2795. for k, v := range c.header_ {
  2796. reqHeaders[k] = v
  2797. }
  2798. reqHeaders.Set("User-Agent", c.s.userAgent())
  2799. var body io.Reader = nil
  2800. body, err := googleapi.WithoutDataWrapper.JSONReader(c.resumetransferoperationrequest)
  2801. if err != nil {
  2802. return nil, err
  2803. }
  2804. reqHeaders.Set("Content-Type", "application/json")
  2805. c.urlParams_.Set("alt", alt)
  2806. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:resume")
  2807. urls += "?" + c.urlParams_.Encode()
  2808. req, _ := http.NewRequest("POST", urls, body)
  2809. req.Header = reqHeaders
  2810. googleapi.Expand(req.URL, map[string]string{
  2811. "name": c.name,
  2812. })
  2813. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2814. }
  2815. // Do executes the "storagetransfer.transferOperations.resume" call.
  2816. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2817. // code is an error. Response headers are in either
  2818. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2819. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2820. // check whether the returned error was because http.StatusNotModified
  2821. // was returned.
  2822. func (c *TransferOperationsResumeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2823. gensupport.SetOptions(c.urlParams_, opts...)
  2824. res, err := c.doRequest("json")
  2825. if res != nil && res.StatusCode == http.StatusNotModified {
  2826. if res.Body != nil {
  2827. res.Body.Close()
  2828. }
  2829. return nil, &googleapi.Error{
  2830. Code: res.StatusCode,
  2831. Header: res.Header,
  2832. }
  2833. }
  2834. if err != nil {
  2835. return nil, err
  2836. }
  2837. defer googleapi.CloseBody(res)
  2838. if err := googleapi.CheckResponse(res); err != nil {
  2839. return nil, err
  2840. }
  2841. ret := &Empty{
  2842. ServerResponse: googleapi.ServerResponse{
  2843. Header: res.Header,
  2844. HTTPStatusCode: res.StatusCode,
  2845. },
  2846. }
  2847. target := &ret
  2848. if err := gensupport.DecodeResponse(target, res); err != nil {
  2849. return nil, err
  2850. }
  2851. return ret, nil
  2852. // {
  2853. // "description": "Resumes a transfer operation that is paused.",
  2854. // "flatPath": "v1/transferOperations/{transferOperationsId}:resume",
  2855. // "httpMethod": "POST",
  2856. // "id": "storagetransfer.transferOperations.resume",
  2857. // "parameterOrder": [
  2858. // "name"
  2859. // ],
  2860. // "parameters": {
  2861. // "name": {
  2862. // "description": "The name of the transfer operation.\nRequired.",
  2863. // "location": "path",
  2864. // "pattern": "^transferOperations/.+$",
  2865. // "required": true,
  2866. // "type": "string"
  2867. // }
  2868. // },
  2869. // "path": "v1/{+name}:resume",
  2870. // "request": {
  2871. // "$ref": "ResumeTransferOperationRequest"
  2872. // },
  2873. // "response": {
  2874. // "$ref": "Empty"
  2875. // },
  2876. // "scopes": [
  2877. // "https://www.googleapis.com/auth/cloud-platform"
  2878. // ]
  2879. // }
  2880. }