genomics-gen.go 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. // Package genomics provides access to the Genomics API.
  2. //
  3. // Usage example:
  4. //
  5. // import "google.golang.org/api/genomics/v1alpha2"
  6. // ...
  7. // genomicsService, err := genomics.New(oauthHttpClient)
  8. package genomics // import "google.golang.org/api/genomics/v1alpha2"
  9. import (
  10. "bytes"
  11. "encoding/json"
  12. "errors"
  13. "fmt"
  14. context "golang.org/x/net/context"
  15. ctxhttp "golang.org/x/net/context/ctxhttp"
  16. gensupport "google.golang.org/api/gensupport"
  17. googleapi "google.golang.org/api/googleapi"
  18. "io"
  19. "net/http"
  20. "net/url"
  21. "strconv"
  22. "strings"
  23. )
  24. // Always reference these packages, just in case the auto-generated code
  25. // below doesn't.
  26. var _ = bytes.NewBuffer
  27. var _ = strconv.Itoa
  28. var _ = fmt.Sprintf
  29. var _ = json.NewDecoder
  30. var _ = io.Copy
  31. var _ = url.Parse
  32. var _ = gensupport.MarshalJSON
  33. var _ = googleapi.Version
  34. var _ = errors.New
  35. var _ = strings.Replace
  36. var _ = context.Canceled
  37. var _ = ctxhttp.Do
  38. const apiId = "genomics:v1alpha2"
  39. const apiName = "genomics"
  40. const apiVersion = "v1alpha2"
  41. const basePath = "https://genomics.googleapis.com/"
  42. // OAuth2 scopes used by this API.
  43. const (
  44. // View and manage your data across Google Cloud Platform services
  45. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  46. // View and manage Genomics data
  47. GenomicsScope = "https://www.googleapis.com/auth/genomics"
  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.Operations = NewOperationsService(s)
  55. return s, nil
  56. }
  57. type Service struct {
  58. client *http.Client
  59. BasePath string // API endpoint base URL
  60. UserAgent string // optional additional User-Agent fragment
  61. Operations *OperationsService
  62. }
  63. func (s *Service) userAgent() string {
  64. if s.UserAgent == "" {
  65. return googleapi.UserAgent
  66. }
  67. return googleapi.UserAgent + " " + s.UserAgent
  68. }
  69. func NewOperationsService(s *Service) *OperationsService {
  70. rs := &OperationsService{s: s}
  71. return rs
  72. }
  73. type OperationsService struct {
  74. s *Service
  75. }
  76. // CancelOperationRequest: The request message for
  77. // Operations.CancelOperation.
  78. type CancelOperationRequest struct {
  79. }
  80. // Empty: A generic empty message that you can re-use to avoid defining
  81. // duplicated empty messages in your APIs. A typical example is to use
  82. // it as the request or the response type of an API method. For
  83. // instance: service Foo { rpc Bar(google.protobuf.Empty) returns
  84. // (google.protobuf.Empty); } The JSON representation for `Empty` is
  85. // empty JSON object `{}`.
  86. type Empty struct {
  87. // ServerResponse contains the HTTP response code and headers from the
  88. // server.
  89. googleapi.ServerResponse `json:"-"`
  90. }
  91. // ImportReadGroupSetsResponse: The read group set import response.
  92. type ImportReadGroupSetsResponse struct {
  93. // ReadGroupSetIds: IDs of the read group sets that were created.
  94. ReadGroupSetIds []string `json:"readGroupSetIds,omitempty"`
  95. // ForceSendFields is a list of field names (e.g. "ReadGroupSetIds") to
  96. // unconditionally include in API requests. By default, fields with
  97. // empty values are omitted from API requests. However, any non-pointer,
  98. // non-interface field appearing in ForceSendFields will be sent to the
  99. // server regardless of whether the field is empty or not. This may be
  100. // used to include empty fields in Patch requests.
  101. ForceSendFields []string `json:"-"`
  102. }
  103. func (s *ImportReadGroupSetsResponse) MarshalJSON() ([]byte, error) {
  104. type noMethod ImportReadGroupSetsResponse
  105. raw := noMethod(*s)
  106. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  107. }
  108. // ImportVariantsResponse: The variant data import response.
  109. type ImportVariantsResponse struct {
  110. // CallSetIds: IDs of the call sets created during the import.
  111. CallSetIds []string `json:"callSetIds,omitempty"`
  112. // ForceSendFields is a list of field names (e.g. "CallSetIds") to
  113. // unconditionally include in API requests. By default, fields with
  114. // empty values are omitted from API requests. However, any non-pointer,
  115. // non-interface field appearing in ForceSendFields will be sent to the
  116. // server regardless of whether the field is empty or not. This may be
  117. // used to include empty fields in Patch requests.
  118. ForceSendFields []string `json:"-"`
  119. }
  120. func (s *ImportVariantsResponse) MarshalJSON() ([]byte, error) {
  121. type noMethod ImportVariantsResponse
  122. raw := noMethod(*s)
  123. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  124. }
  125. // ListOperationsResponse: The response message for
  126. // Operations.ListOperations.
  127. type ListOperationsResponse struct {
  128. // NextPageToken: The standard List next-page token.
  129. NextPageToken string `json:"nextPageToken,omitempty"`
  130. // Operations: A list of operations that matches the specified filter in
  131. // the request.
  132. Operations []*Operation `json:"operations,omitempty"`
  133. // ServerResponse contains the HTTP response code and headers from the
  134. // server.
  135. googleapi.ServerResponse `json:"-"`
  136. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  137. // unconditionally include in API requests. By default, fields with
  138. // empty values are omitted from API requests. However, any non-pointer,
  139. // non-interface field appearing in ForceSendFields will be sent to the
  140. // server regardless of whether the field is empty or not. This may be
  141. // used to include empty fields in Patch requests.
  142. ForceSendFields []string `json:"-"`
  143. }
  144. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  145. type noMethod ListOperationsResponse
  146. raw := noMethod(*s)
  147. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  148. }
  149. // Operation: This resource represents a long-running operation that is
  150. // the result of a network API call.
  151. type Operation struct {
  152. // Done: If the value is `false`, it means the operation is still in
  153. // progress. If true, the operation is completed, and either `error` or
  154. // `response` is available.
  155. Done bool `json:"done,omitempty"`
  156. // Error: The error result of the operation in case of failure.
  157. Error *Status `json:"error,omitempty"`
  158. // Metadata: An OperationMetadata object. This will always be returned
  159. // with the Operation.
  160. Metadata OperationMetadata `json:"metadata,omitempty"`
  161. // Name: The server-assigned name, which is only unique within the same
  162. // service that originally returns it. For example:
  163. // `operations/CJHU7Oi_ChDrveSpBRjfuL-qzoWAgEw`
  164. Name string `json:"name,omitempty"`
  165. // Response: If importing ReadGroupSets, an ImportReadGroupSetsResponse
  166. // is returned. If importing Variants, an ImportVariantsResponse is
  167. // returned. For exports, an empty response is returned.
  168. Response OperationResponse `json:"response,omitempty"`
  169. // ServerResponse contains the HTTP response code and headers from the
  170. // server.
  171. googleapi.ServerResponse `json:"-"`
  172. // ForceSendFields is a list of field names (e.g. "Done") to
  173. // unconditionally include in API requests. By default, fields with
  174. // empty values are omitted from API requests. However, any non-pointer,
  175. // non-interface field appearing in ForceSendFields will be sent to the
  176. // server regardless of whether the field is empty or not. This may be
  177. // used to include empty fields in Patch requests.
  178. ForceSendFields []string `json:"-"`
  179. }
  180. func (s *Operation) MarshalJSON() ([]byte, error) {
  181. type noMethod Operation
  182. raw := noMethod(*s)
  183. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  184. }
  185. type OperationMetadata interface{}
  186. type OperationResponse interface{}
  187. // OperationEvent: An event that occurred during an Operation.
  188. type OperationEvent struct {
  189. // Description: Required description of event.
  190. Description string `json:"description,omitempty"`
  191. // ForceSendFields is a list of field names (e.g. "Description") to
  192. // unconditionally include in API requests. By default, fields with
  193. // empty values are omitted from API requests. However, any non-pointer,
  194. // non-interface field appearing in ForceSendFields will be sent to the
  195. // server regardless of whether the field is empty or not. This may be
  196. // used to include empty fields in Patch requests.
  197. ForceSendFields []string `json:"-"`
  198. }
  199. func (s *OperationEvent) MarshalJSON() ([]byte, error) {
  200. type noMethod OperationEvent
  201. raw := noMethod(*s)
  202. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  203. }
  204. // OperationMetadata1: Metadata describing an Operation.
  205. type OperationMetadata1 struct {
  206. // CreateTime: The time at which the job was submitted to the Genomics
  207. // service.
  208. CreateTime string `json:"createTime,omitempty"`
  209. // Events: Optional event messages that were generated during the job's
  210. // execution. This also contains any warnings that were generated during
  211. // import or export.
  212. Events []*OperationEvent `json:"events,omitempty"`
  213. // ProjectId: The Google Cloud Project in which the job is scoped.
  214. ProjectId string `json:"projectId,omitempty"`
  215. // Request: The original request that started the operation. Note that
  216. // this will be in current version of the API. If the operation was
  217. // started with v1beta2 API and a GetOperation is performed on v1 API, a
  218. // v1 request will be returned.
  219. Request OperationMetadataRequest `json:"request,omitempty"`
  220. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  221. // unconditionally include in API requests. By default, fields with
  222. // empty values are omitted from API requests. However, any non-pointer,
  223. // non-interface field appearing in ForceSendFields will be sent to the
  224. // server regardless of whether the field is empty or not. This may be
  225. // used to include empty fields in Patch requests.
  226. ForceSendFields []string `json:"-"`
  227. }
  228. func (s *OperationMetadata1) MarshalJSON() ([]byte, error) {
  229. type noMethod OperationMetadata1
  230. raw := noMethod(*s)
  231. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  232. }
  233. type OperationMetadataRequest interface{}
  234. // Status: The `Status` type defines a logical error model that is
  235. // suitable for different programming environments, including REST APIs
  236. // and RPC APIs. It is used by [gRPC](https://github.com/grpc). The
  237. // error model is designed to be: - Simple to use and understand for
  238. // most users - Flexible enough to meet unexpected needs # Overview The
  239. // `Status` message contains three pieces of data: error code, error
  240. // message, and error details. The error code should be an enum value of
  241. // google.rpc.Code, but it may accept additional error codes if needed.
  242. // The error message should be a developer-facing English message that
  243. // helps developers *understand* and *resolve* the error. If a localized
  244. // user-facing error message is needed, put the localized message in the
  245. // error details or localize it in the client. The optional error
  246. // details may contain arbitrary information about the error. There is a
  247. // predefined set of error detail types in the package `google.rpc`
  248. // which can be used for common error conditions. # Language mapping The
  249. // `Status` message is the logical representation of the error model,
  250. // but it is not necessarily the actual wire format. When the `Status`
  251. // message is exposed in different client libraries and different wire
  252. // protocols, it can be mapped differently. For example, it will likely
  253. // be mapped to some exceptions in Java, but more likely mapped to some
  254. // error codes in C. # Other uses The error model and the `Status`
  255. // message can be used in a variety of environments, either with or
  256. // without APIs, to provide a consistent developer experience across
  257. // different environments. Example uses of this error model include: -
  258. // Partial errors. If a service needs to return partial errors to the
  259. // client, it may embed the `Status` in the normal response to indicate
  260. // the partial errors. - Workflow errors. A typical workflow has
  261. // multiple steps. Each step may have a `Status` message for error
  262. // reporting purpose. - Batch operations. If a client uses batch request
  263. // and batch response, the `Status` message should be used directly
  264. // inside batch response, one for each error sub-response. -
  265. // Asynchronous operations. If an API call embeds asynchronous operation
  266. // results in its response, the status of those operations should be
  267. // represented directly using the `Status` message. - Logging. If some
  268. // API errors are stored in logs, the message `Status` could be used
  269. // directly after any stripping needed for security/privacy reasons.
  270. type Status struct {
  271. // Code: The status code, which should be an enum value of
  272. // google.rpc.Code.
  273. Code int64 `json:"code,omitempty"`
  274. // Details: A list of messages that carry the error details. There will
  275. // be a common set of message types for APIs to use.
  276. Details []StatusDetails `json:"details,omitempty"`
  277. // Message: A developer-facing error message, which should be in
  278. // English. Any user-facing error message should be localized and sent
  279. // in the google.rpc.Status.details field, or localized by the client.
  280. Message string `json:"message,omitempty"`
  281. // ForceSendFields is a list of field names (e.g. "Code") to
  282. // unconditionally include in API requests. By default, fields with
  283. // empty values are omitted from API requests. However, any non-pointer,
  284. // non-interface field appearing in ForceSendFields will be sent to the
  285. // server regardless of whether the field is empty or not. This may be
  286. // used to include empty fields in Patch requests.
  287. ForceSendFields []string `json:"-"`
  288. }
  289. func (s *Status) MarshalJSON() ([]byte, error) {
  290. type noMethod Status
  291. raw := noMethod(*s)
  292. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  293. }
  294. type StatusDetails interface{}
  295. // method id "genomics.operations.cancel":
  296. type OperationsCancelCall struct {
  297. s *Service
  298. name string
  299. canceloperationrequest *CancelOperationRequest
  300. urlParams_ gensupport.URLParams
  301. ctx_ context.Context
  302. }
  303. // Cancel: Starts asynchronous cancellation on a long-running operation.
  304. // The server makes a best effort to cancel the operation, but success
  305. // is not guaranteed. Clients may use Operations.GetOperation or
  306. // Operations.ListOperations to check whether the cancellation succeeded
  307. // or the operation completed despite cancellation.
  308. func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall {
  309. c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  310. c.name = name
  311. c.canceloperationrequest = canceloperationrequest
  312. return c
  313. }
  314. // Fields allows partial responses to be retrieved. See
  315. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  316. // for more information.
  317. func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall {
  318. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  319. return c
  320. }
  321. // Context sets the context to be used in this call's Do method. Any
  322. // pending HTTP request will be aborted if the provided context is
  323. // canceled.
  324. func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall {
  325. c.ctx_ = ctx
  326. return c
  327. }
  328. func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  329. var body io.Reader = nil
  330. body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
  331. if err != nil {
  332. return nil, err
  333. }
  334. ctype := "application/json"
  335. c.urlParams_.Set("alt", alt)
  336. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}:cancel")
  337. urls += "?" + c.urlParams_.Encode()
  338. req, _ := http.NewRequest("POST", urls, body)
  339. googleapi.Expand(req.URL, map[string]string{
  340. "name": c.name,
  341. })
  342. req.Header.Set("Content-Type", ctype)
  343. req.Header.Set("User-Agent", c.s.userAgent())
  344. if c.ctx_ != nil {
  345. return ctxhttp.Do(c.ctx_, c.s.client, req)
  346. }
  347. return c.s.client.Do(req)
  348. }
  349. // Do executes the "genomics.operations.cancel" call.
  350. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  351. // code is an error. Response headers are in either
  352. // *Empty.ServerResponse.Header or (if a response was returned at all)
  353. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  354. // check whether the returned error was because http.StatusNotModified
  355. // was returned.
  356. func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  357. gensupport.SetOptions(c.urlParams_, opts...)
  358. res, err := c.doRequest("json")
  359. if res != nil && res.StatusCode == http.StatusNotModified {
  360. if res.Body != nil {
  361. res.Body.Close()
  362. }
  363. return nil, &googleapi.Error{
  364. Code: res.StatusCode,
  365. Header: res.Header,
  366. }
  367. }
  368. if err != nil {
  369. return nil, err
  370. }
  371. defer googleapi.CloseBody(res)
  372. if err := googleapi.CheckResponse(res); err != nil {
  373. return nil, err
  374. }
  375. ret := &Empty{
  376. ServerResponse: googleapi.ServerResponse{
  377. Header: res.Header,
  378. HTTPStatusCode: res.StatusCode,
  379. },
  380. }
  381. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  382. return nil, err
  383. }
  384. return ret, nil
  385. // {
  386. // "description": "Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients may use Operations.GetOperation or Operations.ListOperations to check whether the cancellation succeeded or the operation completed despite cancellation.",
  387. // "httpMethod": "POST",
  388. // "id": "genomics.operations.cancel",
  389. // "parameterOrder": [
  390. // "name"
  391. // ],
  392. // "parameters": {
  393. // "name": {
  394. // "description": "The name of the operation resource to be cancelled.",
  395. // "location": "path",
  396. // "pattern": "^operations/.*$",
  397. // "required": true,
  398. // "type": "string"
  399. // }
  400. // },
  401. // "path": "v1alpha2/{+name}:cancel",
  402. // "request": {
  403. // "$ref": "CancelOperationRequest"
  404. // },
  405. // "response": {
  406. // "$ref": "Empty"
  407. // },
  408. // "scopes": [
  409. // "https://www.googleapis.com/auth/cloud-platform",
  410. // "https://www.googleapis.com/auth/genomics"
  411. // ]
  412. // }
  413. }
  414. // method id "genomics.operations.get":
  415. type OperationsGetCall struct {
  416. s *Service
  417. name string
  418. urlParams_ gensupport.URLParams
  419. ifNoneMatch_ string
  420. ctx_ context.Context
  421. }
  422. // Get: Gets the latest state of a long-running operation. Clients can
  423. // use this method to poll the operation result at intervals as
  424. // recommended by the API service.
  425. func (r *OperationsService) Get(name string) *OperationsGetCall {
  426. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  427. c.name = name
  428. return c
  429. }
  430. // Fields allows partial responses to be retrieved. See
  431. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  432. // for more information.
  433. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  434. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  435. return c
  436. }
  437. // IfNoneMatch sets the optional parameter which makes the operation
  438. // fail if the object's ETag matches the given value. This is useful for
  439. // getting updates only after the object has changed since the last
  440. // request. Use googleapi.IsNotModified to check whether the response
  441. // error from Do is the result of In-None-Match.
  442. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  443. c.ifNoneMatch_ = entityTag
  444. return c
  445. }
  446. // Context sets the context to be used in this call's Do method. Any
  447. // pending HTTP request will be aborted if the provided context is
  448. // canceled.
  449. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  450. c.ctx_ = ctx
  451. return c
  452. }
  453. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  454. var body io.Reader = nil
  455. c.urlParams_.Set("alt", alt)
  456. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}")
  457. urls += "?" + c.urlParams_.Encode()
  458. req, _ := http.NewRequest("GET", urls, body)
  459. googleapi.Expand(req.URL, map[string]string{
  460. "name": c.name,
  461. })
  462. req.Header.Set("User-Agent", c.s.userAgent())
  463. if c.ifNoneMatch_ != "" {
  464. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  465. }
  466. if c.ctx_ != nil {
  467. return ctxhttp.Do(c.ctx_, c.s.client, req)
  468. }
  469. return c.s.client.Do(req)
  470. }
  471. // Do executes the "genomics.operations.get" call.
  472. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  473. // status code is an error. Response headers are in either
  474. // *Operation.ServerResponse.Header or (if a response was returned at
  475. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  476. // to check whether the returned error was because
  477. // http.StatusNotModified was returned.
  478. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  479. gensupport.SetOptions(c.urlParams_, opts...)
  480. res, err := c.doRequest("json")
  481. if res != nil && res.StatusCode == http.StatusNotModified {
  482. if res.Body != nil {
  483. res.Body.Close()
  484. }
  485. return nil, &googleapi.Error{
  486. Code: res.StatusCode,
  487. Header: res.Header,
  488. }
  489. }
  490. if err != nil {
  491. return nil, err
  492. }
  493. defer googleapi.CloseBody(res)
  494. if err := googleapi.CheckResponse(res); err != nil {
  495. return nil, err
  496. }
  497. ret := &Operation{
  498. ServerResponse: googleapi.ServerResponse{
  499. Header: res.Header,
  500. HTTPStatusCode: res.StatusCode,
  501. },
  502. }
  503. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  504. return nil, err
  505. }
  506. return ret, nil
  507. // {
  508. // "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.",
  509. // "httpMethod": "GET",
  510. // "id": "genomics.operations.get",
  511. // "parameterOrder": [
  512. // "name"
  513. // ],
  514. // "parameters": {
  515. // "name": {
  516. // "description": "The name of the operation resource.",
  517. // "location": "path",
  518. // "pattern": "^operations/.*$",
  519. // "required": true,
  520. // "type": "string"
  521. // }
  522. // },
  523. // "path": "v1alpha2/{+name}",
  524. // "response": {
  525. // "$ref": "Operation"
  526. // },
  527. // "scopes": [
  528. // "https://www.googleapis.com/auth/cloud-platform",
  529. // "https://www.googleapis.com/auth/genomics"
  530. // ]
  531. // }
  532. }
  533. // method id "genomics.operations.list":
  534. type OperationsListCall struct {
  535. s *Service
  536. name string
  537. urlParams_ gensupport.URLParams
  538. ifNoneMatch_ string
  539. ctx_ context.Context
  540. }
  541. // List: Lists operations that match the specified filter in the
  542. // request.
  543. func (r *OperationsService) List(name string) *OperationsListCall {
  544. c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  545. c.name = name
  546. return c
  547. }
  548. // Filter sets the optional parameter "filter": A string for filtering
  549. // Operations. The following filter fields are supported: * projectId:
  550. // Required. Corresponds to OperationMetadata.projectId. * createTime:
  551. // The time this job was created, in seconds from the
  552. // [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `>=` and/or
  553. // `= 1432140000` * `projectId = my-project AND createTime >= 1432140000
  554. // AND createTime <= 1432150000 AND status = RUNNING`
  555. func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
  556. c.urlParams_.Set("filter", filter)
  557. return c
  558. }
  559. // PageSize sets the optional parameter "pageSize": The maximum number
  560. // of results to return. If unspecified, defaults to 256. The maximum
  561. // value is 2048.
  562. func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
  563. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  564. return c
  565. }
  566. // PageToken sets the optional parameter "pageToken": The standard list
  567. // page token.
  568. func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
  569. c.urlParams_.Set("pageToken", pageToken)
  570. return c
  571. }
  572. // Fields allows partial responses to be retrieved. See
  573. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  574. // for more information.
  575. func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
  576. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  577. return c
  578. }
  579. // IfNoneMatch sets the optional parameter which makes the operation
  580. // fail if the object's ETag matches the given value. This is useful for
  581. // getting updates only after the object has changed since the last
  582. // request. Use googleapi.IsNotModified to check whether the response
  583. // error from Do is the result of In-None-Match.
  584. func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
  585. c.ifNoneMatch_ = entityTag
  586. return c
  587. }
  588. // Context sets the context to be used in this call's Do method. Any
  589. // pending HTTP request will be aborted if the provided context is
  590. // canceled.
  591. func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
  592. c.ctx_ = ctx
  593. return c
  594. }
  595. func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
  596. var body io.Reader = nil
  597. c.urlParams_.Set("alt", alt)
  598. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha2/{+name}")
  599. urls += "?" + c.urlParams_.Encode()
  600. req, _ := http.NewRequest("GET", urls, body)
  601. googleapi.Expand(req.URL, map[string]string{
  602. "name": c.name,
  603. })
  604. req.Header.Set("User-Agent", c.s.userAgent())
  605. if c.ifNoneMatch_ != "" {
  606. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  607. }
  608. if c.ctx_ != nil {
  609. return ctxhttp.Do(c.ctx_, c.s.client, req)
  610. }
  611. return c.s.client.Do(req)
  612. }
  613. // Do executes the "genomics.operations.list" call.
  614. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  615. // non-2xx status code is an error. Response headers are in either
  616. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  617. // returned at all) in error.(*googleapi.Error).Header. Use
  618. // googleapi.IsNotModified to check whether the returned error was
  619. // because http.StatusNotModified was returned.
  620. func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  621. gensupport.SetOptions(c.urlParams_, opts...)
  622. res, err := c.doRequest("json")
  623. if res != nil && res.StatusCode == http.StatusNotModified {
  624. if res.Body != nil {
  625. res.Body.Close()
  626. }
  627. return nil, &googleapi.Error{
  628. Code: res.StatusCode,
  629. Header: res.Header,
  630. }
  631. }
  632. if err != nil {
  633. return nil, err
  634. }
  635. defer googleapi.CloseBody(res)
  636. if err := googleapi.CheckResponse(res); err != nil {
  637. return nil, err
  638. }
  639. ret := &ListOperationsResponse{
  640. ServerResponse: googleapi.ServerResponse{
  641. Header: res.Header,
  642. HTTPStatusCode: res.StatusCode,
  643. },
  644. }
  645. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  646. return nil, err
  647. }
  648. return ret, nil
  649. // {
  650. // "description": "Lists operations that match the specified filter in the request.",
  651. // "httpMethod": "GET",
  652. // "id": "genomics.operations.list",
  653. // "parameterOrder": [
  654. // "name"
  655. // ],
  656. // "parameters": {
  657. // "filter": {
  658. // "description": "A string for filtering Operations. The following filter fields are supported: * projectId: Required. Corresponds to OperationMetadata.projectId. * createTime: The time this job was created, in seconds from the [epoch](http://en.wikipedia.org/wiki/Unix_time). Can use `\u003e=` and/or `= 1432140000` * `projectId = my-project AND createTime \u003e= 1432140000 AND createTime \u003c= 1432150000 AND status = RUNNING`",
  659. // "location": "query",
  660. // "type": "string"
  661. // },
  662. // "name": {
  663. // "description": "The name of the operation collection.",
  664. // "location": "path",
  665. // "pattern": "^operations$",
  666. // "required": true,
  667. // "type": "string"
  668. // },
  669. // "pageSize": {
  670. // "description": "The maximum number of results to return. If unspecified, defaults to 256. The maximum value is 2048.",
  671. // "format": "int32",
  672. // "location": "query",
  673. // "type": "integer"
  674. // },
  675. // "pageToken": {
  676. // "description": "The standard list page token.",
  677. // "location": "query",
  678. // "type": "string"
  679. // }
  680. // },
  681. // "path": "v1alpha2/{+name}",
  682. // "response": {
  683. // "$ref": "ListOperationsResponse"
  684. // },
  685. // "scopes": [
  686. // "https://www.googleapis.com/auth/cloud-platform",
  687. // "https://www.googleapis.com/auth/genomics"
  688. // ]
  689. // }
  690. }
  691. // Pages invokes f for each page of results.
  692. // A non-nil error returned from f will halt the iteration.
  693. // The provided context supersedes any context provided to the Context method.
  694. func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  695. c.ctx_ = ctx
  696. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  697. for {
  698. x, err := c.Do()
  699. if err != nil {
  700. return err
  701. }
  702. if err := f(x); err != nil {
  703. return err
  704. }
  705. if x.NextPageToken == "" {
  706. return nil
  707. }
  708. c.PageToken(x.NextPageToken)
  709. }
  710. }