Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

838 řádky
28 KiB

  1. // Package runtimeconfig provides access to the Cloud Runtime Configuration API.
  2. //
  3. // See https://cloud.google.com/deployment-manager/runtime-configurator/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/runtimeconfig/v1"
  8. // ...
  9. // runtimeconfigService, err := runtimeconfig.New(oauthHttpClient)
  10. package runtimeconfig // import "google.golang.org/api/runtimeconfig/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 = "runtimeconfig:v1"
  41. const apiName = "runtimeconfig"
  42. const apiVersion = "v1"
  43. const basePath = "https://runtimeconfig.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. // Manage your Google Cloud Platform services' runtime configuration
  49. CloudruntimeconfigScope = "https://www.googleapis.com/auth/cloudruntimeconfig"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.Operations = NewOperationsService(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. Operations *OperationsService
  64. }
  65. func (s *Service) userAgent() string {
  66. if s.UserAgent == "" {
  67. return googleapi.UserAgent
  68. }
  69. return googleapi.UserAgent + " " + s.UserAgent
  70. }
  71. func NewOperationsService(s *Service) *OperationsService {
  72. rs := &OperationsService{s: s}
  73. return rs
  74. }
  75. type OperationsService struct {
  76. s *Service
  77. }
  78. // CancelOperationRequest: The request message for
  79. // Operations.CancelOperation.
  80. type CancelOperationRequest struct {
  81. }
  82. // Empty: A generic empty message that you can re-use to avoid defining
  83. // duplicated
  84. // empty messages in your APIs. A typical example is to use it as the
  85. // request
  86. // or the response type of an API method. For instance:
  87. //
  88. // service Foo {
  89. // rpc Bar(google.protobuf.Empty) returns
  90. // (google.protobuf.Empty);
  91. // }
  92. //
  93. // The JSON representation for `Empty` is empty JSON object `{}`.
  94. type Empty struct {
  95. // ServerResponse contains the HTTP response code and headers from the
  96. // server.
  97. googleapi.ServerResponse `json:"-"`
  98. }
  99. // ListOperationsResponse: The response message for
  100. // Operations.ListOperations.
  101. type ListOperationsResponse struct {
  102. // NextPageToken: The standard List next-page token.
  103. NextPageToken string `json:"nextPageToken,omitempty"`
  104. // Operations: A list of operations that matches the specified filter in
  105. // the request.
  106. Operations []*Operation `json:"operations,omitempty"`
  107. // ServerResponse contains the HTTP response code and headers from the
  108. // server.
  109. googleapi.ServerResponse `json:"-"`
  110. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  111. // unconditionally include in API requests. By default, fields with
  112. // empty values are omitted from API requests. However, any non-pointer,
  113. // non-interface field appearing in ForceSendFields will be sent to the
  114. // server regardless of whether the field is empty or not. This may be
  115. // used to include empty fields in Patch requests.
  116. ForceSendFields []string `json:"-"`
  117. // NullFields is a list of field names (e.g. "NextPageToken") to include
  118. // in API requests with the JSON null value. By default, fields with
  119. // empty values are omitted from API requests. However, any field with
  120. // an empty value appearing in NullFields will be sent to the server as
  121. // null. It is an error if a field in this list has a non-empty value.
  122. // This may be used to include null fields in Patch requests.
  123. NullFields []string `json:"-"`
  124. }
  125. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  126. type NoMethod ListOperationsResponse
  127. raw := NoMethod(*s)
  128. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  129. }
  130. // Operation: This resource represents a long-running operation that is
  131. // the result of a
  132. // network API call.
  133. type Operation struct {
  134. // Done: If the value is `false`, it means the operation is still in
  135. // progress.
  136. // If `true`, the operation is completed, and either `error` or
  137. // `response` is
  138. // available.
  139. Done bool `json:"done,omitempty"`
  140. // Error: The error result of the operation in case of failure or
  141. // cancellation.
  142. Error *Status `json:"error,omitempty"`
  143. // Metadata: Service-specific metadata associated with the operation.
  144. // It typically
  145. // contains progress information and common metadata such as create
  146. // time.
  147. // Some services might not provide such metadata. Any method that
  148. // returns a
  149. // long-running operation should document the metadata type, if any.
  150. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  151. // Name: The server-assigned name, which is only unique within the same
  152. // service that
  153. // originally returns it. If you use the default HTTP mapping,
  154. // the
  155. // `name` should have the format of `operations/some/unique/name`.
  156. Name string `json:"name,omitempty"`
  157. // Response: The normal response of the operation in case of success.
  158. // If the original
  159. // method returns no data on success, such as `Delete`, the response
  160. // is
  161. // `google.protobuf.Empty`. If the original method is
  162. // standard
  163. // `Get`/`Create`/`Update`, the response should be the resource. For
  164. // other
  165. // methods, the response should have the type `XxxResponse`, where
  166. // `Xxx`
  167. // is the original method name. For example, if the original method
  168. // name
  169. // is `TakeSnapshot()`, the inferred response type
  170. // is
  171. // `TakeSnapshotResponse`.
  172. Response googleapi.RawMessage `json:"response,omitempty"`
  173. // ForceSendFields is a list of field names (e.g. "Done") to
  174. // unconditionally include in API requests. By default, fields with
  175. // empty values are omitted from API requests. However, any non-pointer,
  176. // non-interface field appearing in ForceSendFields will be sent to the
  177. // server regardless of whether the field is empty or not. This may be
  178. // used to include empty fields in Patch requests.
  179. ForceSendFields []string `json:"-"`
  180. // NullFields is a list of field names (e.g. "Done") to include in API
  181. // requests with the JSON null value. By default, fields with empty
  182. // values are omitted from API requests. However, any field with an
  183. // empty value appearing in NullFields will be sent to the server as
  184. // null. It is an error if a field in this list has a non-empty value.
  185. // This may be used to include null fields in Patch requests.
  186. NullFields []string `json:"-"`
  187. }
  188. func (s *Operation) MarshalJSON() ([]byte, error) {
  189. type NoMethod Operation
  190. raw := NoMethod(*s)
  191. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  192. }
  193. // Status: The `Status` type defines a logical error model that is
  194. // suitable for different
  195. // programming environments, including REST APIs and RPC APIs. It is
  196. // used by
  197. // [gRPC](https://github.com/grpc). The error model is designed to
  198. // be:
  199. //
  200. // - Simple to use and understand for most users
  201. // - Flexible enough to meet unexpected needs
  202. //
  203. // # Overview
  204. //
  205. // The `Status` message contains three pieces of data: error code, error
  206. // message,
  207. // and error details. The error code should be an enum value
  208. // of
  209. // google.rpc.Code, but it may accept additional error codes if needed.
  210. // The
  211. // error message should be a developer-facing English message that
  212. // helps
  213. // developers *understand* and *resolve* the error. If a localized
  214. // user-facing
  215. // error message is needed, put the localized message in the error
  216. // details or
  217. // localize it in the client. The optional error details may contain
  218. // arbitrary
  219. // information about the error. There is a predefined set of error
  220. // detail types
  221. // in the package `google.rpc` that can be used for common error
  222. // conditions.
  223. //
  224. // # Language mapping
  225. //
  226. // The `Status` message is the logical representation of the error
  227. // model, but it
  228. // is not necessarily the actual wire format. When the `Status` message
  229. // is
  230. // exposed in different client libraries and different wire protocols,
  231. // it can be
  232. // mapped differently. For example, it will likely be mapped to some
  233. // exceptions
  234. // in Java, but more likely mapped to some error codes in C.
  235. //
  236. // # Other uses
  237. //
  238. // The error model and the `Status` message can be used in a variety
  239. // of
  240. // environments, either with or without APIs, to provide a
  241. // consistent developer experience across different
  242. // environments.
  243. //
  244. // Example uses of this error model include:
  245. //
  246. // - Partial errors. If a service needs to return partial errors to the
  247. // client,
  248. // it may embed the `Status` in the normal response to indicate the
  249. // partial
  250. // errors.
  251. //
  252. // - Workflow errors. A typical workflow has multiple steps. Each step
  253. // may
  254. // have a `Status` message for error reporting.
  255. //
  256. // - Batch operations. If a client uses batch request and batch
  257. // response, the
  258. // `Status` message should be used directly inside batch response,
  259. // one for
  260. // each error sub-response.
  261. //
  262. // - Asynchronous operations. If an API call embeds asynchronous
  263. // operation
  264. // results in its response, the status of those operations should
  265. // be
  266. // represented directly using the `Status` message.
  267. //
  268. // - Logging. If some API errors are stored in logs, the message
  269. // `Status` could
  270. // be used directly after any stripping needed for security/privacy
  271. // reasons.
  272. type Status struct {
  273. // Code: The status code, which should be an enum value of
  274. // google.rpc.Code.
  275. Code int64 `json:"code,omitempty"`
  276. // Details: A list of messages that carry the error details. There is a
  277. // common set of
  278. // message types for APIs to use.
  279. Details []googleapi.RawMessage `json:"details,omitempty"`
  280. // Message: A developer-facing error message, which should be in
  281. // English. Any
  282. // user-facing error message should be localized and sent in
  283. // the
  284. // google.rpc.Status.details field, or localized by the client.
  285. Message string `json:"message,omitempty"`
  286. // ForceSendFields is a list of field names (e.g. "Code") to
  287. // unconditionally include in API requests. By default, fields with
  288. // empty values are omitted from API requests. However, any non-pointer,
  289. // non-interface field appearing in ForceSendFields will be sent to the
  290. // server regardless of whether the field is empty or not. This may be
  291. // used to include empty fields in Patch requests.
  292. ForceSendFields []string `json:"-"`
  293. // NullFields is a list of field names (e.g. "Code") to include in API
  294. // requests with the JSON null value. By default, fields with empty
  295. // values are omitted from API requests. However, any field with an
  296. // empty value appearing in NullFields will be sent to the server as
  297. // null. It is an error if a field in this list has a non-empty value.
  298. // This may be used to include null fields in Patch requests.
  299. NullFields []string `json:"-"`
  300. }
  301. func (s *Status) MarshalJSON() ([]byte, error) {
  302. type NoMethod Status
  303. raw := NoMethod(*s)
  304. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  305. }
  306. // method id "runtimeconfig.operations.cancel":
  307. type OperationsCancelCall struct {
  308. s *Service
  309. name string
  310. canceloperationrequest *CancelOperationRequest
  311. urlParams_ gensupport.URLParams
  312. ctx_ context.Context
  313. header_ http.Header
  314. }
  315. // Cancel: Starts asynchronous cancellation on a long-running operation.
  316. // The server
  317. // makes a best effort to cancel the operation, but success is
  318. // not
  319. // guaranteed. If the server doesn't support this method, it
  320. // returns
  321. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  322. // use
  323. // Operations.GetOperation or
  324. // other methods to check whether the cancellation succeeded or whether
  325. // the
  326. // operation completed despite cancellation. On successful
  327. // cancellation,
  328. // the operation is not deleted; instead, it becomes an operation
  329. // with
  330. // an Operation.error value with a google.rpc.Status.code of
  331. // 1,
  332. // corresponding to `Code.CANCELLED`.
  333. func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall {
  334. c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  335. c.name = name
  336. c.canceloperationrequest = canceloperationrequest
  337. return c
  338. }
  339. // Fields allows partial responses to be retrieved. See
  340. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  341. // for more information.
  342. func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall {
  343. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  344. return c
  345. }
  346. // Context sets the context to be used in this call's Do method. Any
  347. // pending HTTP request will be aborted if the provided context is
  348. // canceled.
  349. func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall {
  350. c.ctx_ = ctx
  351. return c
  352. }
  353. // Header returns an http.Header that can be modified by the caller to
  354. // add HTTP headers to the request.
  355. func (c *OperationsCancelCall) Header() http.Header {
  356. if c.header_ == nil {
  357. c.header_ = make(http.Header)
  358. }
  359. return c.header_
  360. }
  361. func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  362. reqHeaders := make(http.Header)
  363. for k, v := range c.header_ {
  364. reqHeaders[k] = v
  365. }
  366. reqHeaders.Set("User-Agent", c.s.userAgent())
  367. var body io.Reader = nil
  368. body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
  369. if err != nil {
  370. return nil, err
  371. }
  372. reqHeaders.Set("Content-Type", "application/json")
  373. c.urlParams_.Set("alt", alt)
  374. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  375. urls += "?" + c.urlParams_.Encode()
  376. req, _ := http.NewRequest("POST", urls, body)
  377. req.Header = reqHeaders
  378. googleapi.Expand(req.URL, map[string]string{
  379. "name": c.name,
  380. })
  381. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  382. }
  383. // Do executes the "runtimeconfig.operations.cancel" call.
  384. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  385. // code is an error. Response headers are in either
  386. // *Empty.ServerResponse.Header or (if a response was returned at all)
  387. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  388. // check whether the returned error was because http.StatusNotModified
  389. // was returned.
  390. func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  391. gensupport.SetOptions(c.urlParams_, opts...)
  392. res, err := c.doRequest("json")
  393. if res != nil && res.StatusCode == http.StatusNotModified {
  394. if res.Body != nil {
  395. res.Body.Close()
  396. }
  397. return nil, &googleapi.Error{
  398. Code: res.StatusCode,
  399. Header: res.Header,
  400. }
  401. }
  402. if err != nil {
  403. return nil, err
  404. }
  405. defer googleapi.CloseBody(res)
  406. if err := googleapi.CheckResponse(res); err != nil {
  407. return nil, err
  408. }
  409. ret := &Empty{
  410. ServerResponse: googleapi.ServerResponse{
  411. Header: res.Header,
  412. HTTPStatusCode: res.StatusCode,
  413. },
  414. }
  415. target := &ret
  416. if err := gensupport.DecodeResponse(target, res); err != nil {
  417. return nil, err
  418. }
  419. return ret, nil
  420. // {
  421. // "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.",
  422. // "flatPath": "v1/operations/{operationsId}:cancel",
  423. // "httpMethod": "POST",
  424. // "id": "runtimeconfig.operations.cancel",
  425. // "parameterOrder": [
  426. // "name"
  427. // ],
  428. // "parameters": {
  429. // "name": {
  430. // "description": "The name of the operation resource to be cancelled.",
  431. // "location": "path",
  432. // "pattern": "^operations/.+$",
  433. // "required": true,
  434. // "type": "string"
  435. // }
  436. // },
  437. // "path": "v1/{+name}:cancel",
  438. // "request": {
  439. // "$ref": "CancelOperationRequest"
  440. // },
  441. // "response": {
  442. // "$ref": "Empty"
  443. // },
  444. // "scopes": [
  445. // "https://www.googleapis.com/auth/cloud-platform",
  446. // "https://www.googleapis.com/auth/cloudruntimeconfig"
  447. // ]
  448. // }
  449. }
  450. // method id "runtimeconfig.operations.delete":
  451. type OperationsDeleteCall struct {
  452. s *Service
  453. name string
  454. urlParams_ gensupport.URLParams
  455. ctx_ context.Context
  456. header_ http.Header
  457. }
  458. // Delete: Deletes a long-running operation. This method indicates that
  459. // the client is
  460. // no longer interested in the operation result. It does not cancel
  461. // the
  462. // operation. If the server doesn't support this method, it
  463. // returns
  464. // `google.rpc.Code.UNIMPLEMENTED`.
  465. func (r *OperationsService) Delete(name string) *OperationsDeleteCall {
  466. c := &OperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  467. c.name = name
  468. return c
  469. }
  470. // Fields allows partial responses to be retrieved. See
  471. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  472. // for more information.
  473. func (c *OperationsDeleteCall) Fields(s ...googleapi.Field) *OperationsDeleteCall {
  474. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  475. return c
  476. }
  477. // Context sets the context to be used in this call's Do method. Any
  478. // pending HTTP request will be aborted if the provided context is
  479. // canceled.
  480. func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {
  481. c.ctx_ = ctx
  482. return c
  483. }
  484. // Header returns an http.Header that can be modified by the caller to
  485. // add HTTP headers to the request.
  486. func (c *OperationsDeleteCall) Header() http.Header {
  487. if c.header_ == nil {
  488. c.header_ = make(http.Header)
  489. }
  490. return c.header_
  491. }
  492. func (c *OperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  493. reqHeaders := make(http.Header)
  494. for k, v := range c.header_ {
  495. reqHeaders[k] = v
  496. }
  497. reqHeaders.Set("User-Agent", c.s.userAgent())
  498. var body io.Reader = nil
  499. c.urlParams_.Set("alt", alt)
  500. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  501. urls += "?" + c.urlParams_.Encode()
  502. req, _ := http.NewRequest("DELETE", urls, body)
  503. req.Header = reqHeaders
  504. googleapi.Expand(req.URL, map[string]string{
  505. "name": c.name,
  506. })
  507. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  508. }
  509. // Do executes the "runtimeconfig.operations.delete" call.
  510. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  511. // code is an error. Response headers are in either
  512. // *Empty.ServerResponse.Header or (if a response was returned at all)
  513. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  514. // check whether the returned error was because http.StatusNotModified
  515. // was returned.
  516. func (c *OperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  517. gensupport.SetOptions(c.urlParams_, opts...)
  518. res, err := c.doRequest("json")
  519. if res != nil && res.StatusCode == http.StatusNotModified {
  520. if res.Body != nil {
  521. res.Body.Close()
  522. }
  523. return nil, &googleapi.Error{
  524. Code: res.StatusCode,
  525. Header: res.Header,
  526. }
  527. }
  528. if err != nil {
  529. return nil, err
  530. }
  531. defer googleapi.CloseBody(res)
  532. if err := googleapi.CheckResponse(res); err != nil {
  533. return nil, err
  534. }
  535. ret := &Empty{
  536. ServerResponse: googleapi.ServerResponse{
  537. Header: res.Header,
  538. HTTPStatusCode: res.StatusCode,
  539. },
  540. }
  541. target := &ret
  542. if err := gensupport.DecodeResponse(target, res); err != nil {
  543. return nil, err
  544. }
  545. return ret, nil
  546. // {
  547. // "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.",
  548. // "flatPath": "v1/operations/{operationsId}",
  549. // "httpMethod": "DELETE",
  550. // "id": "runtimeconfig.operations.delete",
  551. // "parameterOrder": [
  552. // "name"
  553. // ],
  554. // "parameters": {
  555. // "name": {
  556. // "description": "The name of the operation resource to be deleted.",
  557. // "location": "path",
  558. // "pattern": "^operations/.+$",
  559. // "required": true,
  560. // "type": "string"
  561. // }
  562. // },
  563. // "path": "v1/{+name}",
  564. // "response": {
  565. // "$ref": "Empty"
  566. // },
  567. // "scopes": [
  568. // "https://www.googleapis.com/auth/cloud-platform",
  569. // "https://www.googleapis.com/auth/cloudruntimeconfig"
  570. // ]
  571. // }
  572. }
  573. // method id "runtimeconfig.operations.list":
  574. type OperationsListCall struct {
  575. s *Service
  576. name string
  577. urlParams_ gensupport.URLParams
  578. ifNoneMatch_ string
  579. ctx_ context.Context
  580. header_ http.Header
  581. }
  582. // List: Lists operations that match the specified filter in the
  583. // request. If the
  584. // server doesn't support this method, it returns
  585. // `UNIMPLEMENTED`.
  586. //
  587. // NOTE: the `name` binding allows API services to override the
  588. // binding
  589. // to use different resource name schemes, such as `users/*/operations`.
  590. // To
  591. // override the binding, API services can add a binding such
  592. // as
  593. // "/v1/{name=users/*}/operations" to their service configuration.
  594. // For backwards compatibility, the default name includes the
  595. // operations
  596. // collection id, however overriding users must ensure the name
  597. // binding
  598. // is the parent resource, without the operations collection id.
  599. func (r *OperationsService) List(name string) *OperationsListCall {
  600. c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  601. c.name = name
  602. return c
  603. }
  604. // Filter sets the optional parameter "filter": The standard list
  605. // filter.
  606. func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
  607. c.urlParams_.Set("filter", filter)
  608. return c
  609. }
  610. // PageSize sets the optional parameter "pageSize": The standard list
  611. // page size.
  612. func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
  613. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  614. return c
  615. }
  616. // PageToken sets the optional parameter "pageToken": The standard list
  617. // page token.
  618. func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
  619. c.urlParams_.Set("pageToken", pageToken)
  620. return c
  621. }
  622. // Fields allows partial responses to be retrieved. See
  623. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  624. // for more information.
  625. func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
  626. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  627. return c
  628. }
  629. // IfNoneMatch sets the optional parameter which makes the operation
  630. // fail if the object's ETag matches the given value. This is useful for
  631. // getting updates only after the object has changed since the last
  632. // request. Use googleapi.IsNotModified to check whether the response
  633. // error from Do is the result of In-None-Match.
  634. func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
  635. c.ifNoneMatch_ = entityTag
  636. return c
  637. }
  638. // Context sets the context to be used in this call's Do method. Any
  639. // pending HTTP request will be aborted if the provided context is
  640. // canceled.
  641. func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
  642. c.ctx_ = ctx
  643. return c
  644. }
  645. // Header returns an http.Header that can be modified by the caller to
  646. // add HTTP headers to the request.
  647. func (c *OperationsListCall) Header() http.Header {
  648. if c.header_ == nil {
  649. c.header_ = make(http.Header)
  650. }
  651. return c.header_
  652. }
  653. func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
  654. reqHeaders := make(http.Header)
  655. for k, v := range c.header_ {
  656. reqHeaders[k] = v
  657. }
  658. reqHeaders.Set("User-Agent", c.s.userAgent())
  659. if c.ifNoneMatch_ != "" {
  660. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  661. }
  662. var body io.Reader = nil
  663. c.urlParams_.Set("alt", alt)
  664. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  665. urls += "?" + c.urlParams_.Encode()
  666. req, _ := http.NewRequest("GET", urls, body)
  667. req.Header = reqHeaders
  668. googleapi.Expand(req.URL, map[string]string{
  669. "name": c.name,
  670. })
  671. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  672. }
  673. // Do executes the "runtimeconfig.operations.list" call.
  674. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  675. // non-2xx status code is an error. Response headers are in either
  676. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  677. // returned at all) in error.(*googleapi.Error).Header. Use
  678. // googleapi.IsNotModified to check whether the returned error was
  679. // because http.StatusNotModified was returned.
  680. func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  681. gensupport.SetOptions(c.urlParams_, opts...)
  682. res, err := c.doRequest("json")
  683. if res != nil && res.StatusCode == http.StatusNotModified {
  684. if res.Body != nil {
  685. res.Body.Close()
  686. }
  687. return nil, &googleapi.Error{
  688. Code: res.StatusCode,
  689. Header: res.Header,
  690. }
  691. }
  692. if err != nil {
  693. return nil, err
  694. }
  695. defer googleapi.CloseBody(res)
  696. if err := googleapi.CheckResponse(res); err != nil {
  697. return nil, err
  698. }
  699. ret := &ListOperationsResponse{
  700. ServerResponse: googleapi.ServerResponse{
  701. Header: res.Header,
  702. HTTPStatusCode: res.StatusCode,
  703. },
  704. }
  705. target := &ret
  706. if err := gensupport.DecodeResponse(target, res); err != nil {
  707. return nil, err
  708. }
  709. return ret, nil
  710. // {
  711. // "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.",
  712. // "flatPath": "v1/operations",
  713. // "httpMethod": "GET",
  714. // "id": "runtimeconfig.operations.list",
  715. // "parameterOrder": [
  716. // "name"
  717. // ],
  718. // "parameters": {
  719. // "filter": {
  720. // "description": "The standard list filter.",
  721. // "location": "query",
  722. // "type": "string"
  723. // },
  724. // "name": {
  725. // "description": "The name of the operation's parent resource.",
  726. // "location": "path",
  727. // "pattern": "^operations$",
  728. // "required": true,
  729. // "type": "string"
  730. // },
  731. // "pageSize": {
  732. // "description": "The standard list page size.",
  733. // "format": "int32",
  734. // "location": "query",
  735. // "type": "integer"
  736. // },
  737. // "pageToken": {
  738. // "description": "The standard list page token.",
  739. // "location": "query",
  740. // "type": "string"
  741. // }
  742. // },
  743. // "path": "v1/{+name}",
  744. // "response": {
  745. // "$ref": "ListOperationsResponse"
  746. // },
  747. // "scopes": [
  748. // "https://www.googleapis.com/auth/cloud-platform",
  749. // "https://www.googleapis.com/auth/cloudruntimeconfig"
  750. // ]
  751. // }
  752. }
  753. // Pages invokes f for each page of results.
  754. // A non-nil error returned from f will halt the iteration.
  755. // The provided context supersedes any context provided to the Context method.
  756. func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  757. c.ctx_ = ctx
  758. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  759. for {
  760. x, err := c.Do()
  761. if err != nil {
  762. return err
  763. }
  764. if err := f(x); err != nil {
  765. return err
  766. }
  767. if x.NextPageToken == "" {
  768. return nil
  769. }
  770. c.PageToken(x.NextPageToken)
  771. }
  772. }