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.
 
 
 

910 lines
30 KiB

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