Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

1276 rader
43 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 cloudshell provides access to the Cloud Shell API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/shell/docs/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/cloudshell/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // cloudshellService, err := cloudshell.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. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // cloudshellService, err := cloudshell.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // cloudshellService, err := cloudshell.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package cloudshell // import "google.golang.org/api/cloudshell/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "cloudshell:v1"
  67. const apiName = "cloudshell"
  68. const apiVersion = "v1"
  69. const basePath = "https://cloudshell.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Operations = NewOperationsService(s)
  106. return s, nil
  107. }
  108. type Service struct {
  109. client *http.Client
  110. BasePath string // API endpoint base URL
  111. UserAgent string // optional additional User-Agent fragment
  112. Operations *OperationsService
  113. }
  114. func (s *Service) userAgent() string {
  115. if s.UserAgent == "" {
  116. return googleapi.UserAgent
  117. }
  118. return googleapi.UserAgent + " " + s.UserAgent
  119. }
  120. func NewOperationsService(s *Service) *OperationsService {
  121. rs := &OperationsService{s: s}
  122. return rs
  123. }
  124. type OperationsService struct {
  125. s *Service
  126. }
  127. // CancelOperationRequest: The request message for
  128. // Operations.CancelOperation.
  129. type CancelOperationRequest struct {
  130. }
  131. // Empty: A generic empty message that you can re-use to avoid defining
  132. // duplicated
  133. // empty messages in your APIs. A typical example is to use it as the
  134. // request
  135. // or the response type of an API method. For instance:
  136. //
  137. // service Foo {
  138. // rpc Bar(google.protobuf.Empty) returns
  139. // (google.protobuf.Empty);
  140. // }
  141. //
  142. // The JSON representation for `Empty` is empty JSON object `{}`.
  143. type Empty struct {
  144. // ServerResponse contains the HTTP response code and headers from the
  145. // server.
  146. googleapi.ServerResponse `json:"-"`
  147. }
  148. // Environment: A Cloud Shell environment, which is defined as the
  149. // combination of a Docker
  150. // image specifying what is installed on the environment and a home
  151. // directory
  152. // containing the user's data that will remain across sessions. Each
  153. // user has a
  154. // single environment with the ID "default".
  155. type Environment struct {
  156. // DockerImage: Required. Full path to the Docker image used to run this
  157. // environment, e.g.
  158. // "gcr.io/dev-con/cloud-devshell:latest".
  159. DockerImage string `json:"dockerImage,omitempty"`
  160. // Id: Output only. The environment's identifier, which is always
  161. // "default".
  162. Id string `json:"id,omitempty"`
  163. // Name: Output only. Full name of this resource, in the
  164. // format
  165. // `users/{owner_email}/environments/{environment_id}`. `{owner_email}`
  166. // is the
  167. // email address of the user to whom this environment belongs,
  168. // and
  169. // `{environment_id}` is the identifier of this environment. For
  170. // example,
  171. // `users/someone@example.com/environments/default`.
  172. Name string `json:"name,omitempty"`
  173. // PublicKeys: Output only. Public keys associated with the environment.
  174. // Clients can
  175. // connect to this environment via SSH only if they possess a private
  176. // key
  177. // corresponding to at least one of these public keys. Keys can be added
  178. // to or
  179. // removed from the environment using the CreatePublicKey and
  180. // DeletePublicKey
  181. // methods.
  182. PublicKeys []*PublicKey `json:"publicKeys,omitempty"`
  183. // SshHost: Output only. Host to which clients can connect to initiate
  184. // SSH sessions
  185. // with the environment.
  186. SshHost string `json:"sshHost,omitempty"`
  187. // SshPort: Output only. Port to which clients can connect to initiate
  188. // SSH sessions
  189. // with the environment.
  190. SshPort int64 `json:"sshPort,omitempty"`
  191. // SshUsername: Output only. Username that clients should use when
  192. // initiating SSH sessions
  193. // with the environment.
  194. SshUsername string `json:"sshUsername,omitempty"`
  195. // State: Output only. Current execution state of this environment.
  196. //
  197. // Possible values:
  198. // "STATE_UNSPECIFIED" - The environment's states is unknown.
  199. // "DISABLED" - The environment is not running and can't be connected
  200. // to. Starting the
  201. // environment will transition it to the STARTING state.
  202. // "STARTING" - The environment is being started but is not yet ready
  203. // to accept
  204. // connections.
  205. // "RUNNING" - The environment is running and ready to accept
  206. // connections. It will
  207. // automatically transition back to DISABLED after a period of
  208. // inactivity or
  209. // if another environment is started.
  210. State string `json:"state,omitempty"`
  211. // ForceSendFields is a list of field names (e.g. "DockerImage") to
  212. // unconditionally include in API requests. By default, fields with
  213. // empty values are omitted from API requests. However, any non-pointer,
  214. // non-interface field appearing in ForceSendFields will be sent to the
  215. // server regardless of whether the field is empty or not. This may be
  216. // used to include empty fields in Patch requests.
  217. ForceSendFields []string `json:"-"`
  218. // NullFields is a list of field names (e.g. "DockerImage") to include
  219. // in API requests with the JSON null value. By default, fields with
  220. // empty values are omitted from API requests. However, any field with
  221. // an empty value appearing in NullFields will be sent to the server as
  222. // null. It is an error if a field in this list has a non-empty value.
  223. // This may be used to include null fields in Patch requests.
  224. NullFields []string `json:"-"`
  225. }
  226. func (s *Environment) MarshalJSON() ([]byte, error) {
  227. type NoMethod Environment
  228. raw := NoMethod(*s)
  229. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  230. }
  231. // ListOperationsResponse: The response message for
  232. // Operations.ListOperations.
  233. type ListOperationsResponse struct {
  234. // NextPageToken: The standard List next-page token.
  235. NextPageToken string `json:"nextPageToken,omitempty"`
  236. // Operations: A list of operations that matches the specified filter in
  237. // the request.
  238. Operations []*Operation `json:"operations,omitempty"`
  239. // ServerResponse contains the HTTP response code and headers from the
  240. // server.
  241. googleapi.ServerResponse `json:"-"`
  242. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  243. // unconditionally include in API requests. By default, fields with
  244. // empty values are omitted from API requests. However, any non-pointer,
  245. // non-interface field appearing in ForceSendFields will be sent to the
  246. // server regardless of whether the field is empty or not. This may be
  247. // used to include empty fields in Patch requests.
  248. ForceSendFields []string `json:"-"`
  249. // NullFields is a list of field names (e.g. "NextPageToken") to include
  250. // in API requests with the JSON null value. By default, fields with
  251. // empty values are omitted from API requests. However, any field with
  252. // an empty value appearing in NullFields will be sent to the server as
  253. // null. It is an error if a field in this list has a non-empty value.
  254. // This may be used to include null fields in Patch requests.
  255. NullFields []string `json:"-"`
  256. }
  257. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  258. type NoMethod ListOperationsResponse
  259. raw := NoMethod(*s)
  260. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  261. }
  262. // Operation: This resource represents a long-running operation that is
  263. // the result of a
  264. // network API call.
  265. type Operation struct {
  266. // Done: If the value is `false`, it means the operation is still in
  267. // progress.
  268. // If `true`, the operation is completed, and either `error` or
  269. // `response` is
  270. // available.
  271. Done bool `json:"done,omitempty"`
  272. // Error: The error result of the operation in case of failure or
  273. // cancellation.
  274. Error *Status `json:"error,omitempty"`
  275. // Metadata: Service-specific metadata associated with the operation.
  276. // It typically
  277. // contains progress information and common metadata such as create
  278. // time.
  279. // Some services might not provide such metadata. Any method that
  280. // returns a
  281. // long-running operation should document the metadata type, if any.
  282. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  283. // Name: The server-assigned name, which is only unique within the same
  284. // service that
  285. // originally returns it. If you use the default HTTP mapping,
  286. // the
  287. // `name` should have the format of `operations/some/unique/name`.
  288. Name string `json:"name,omitempty"`
  289. // Response: The normal response of the operation in case of success.
  290. // If the original
  291. // method returns no data on success, such as `Delete`, the response
  292. // is
  293. // `google.protobuf.Empty`. If the original method is
  294. // standard
  295. // `Get`/`Create`/`Update`, the response should be the resource. For
  296. // other
  297. // methods, the response should have the type `XxxResponse`, where
  298. // `Xxx`
  299. // is the original method name. For example, if the original method
  300. // name
  301. // is `TakeSnapshot()`, the inferred response type
  302. // is
  303. // `TakeSnapshotResponse`.
  304. Response googleapi.RawMessage `json:"response,omitempty"`
  305. // ServerResponse contains the HTTP response code and headers from the
  306. // server.
  307. googleapi.ServerResponse `json:"-"`
  308. // ForceSendFields is a list of field names (e.g. "Done") to
  309. // unconditionally include in API requests. By default, fields with
  310. // empty values are omitted from API requests. However, any non-pointer,
  311. // non-interface field appearing in ForceSendFields will be sent to the
  312. // server regardless of whether the field is empty or not. This may be
  313. // used to include empty fields in Patch requests.
  314. ForceSendFields []string `json:"-"`
  315. // NullFields is a list of field names (e.g. "Done") to include in API
  316. // requests with the JSON null value. By default, fields with empty
  317. // values are omitted from API requests. However, any field with an
  318. // empty value appearing in NullFields will be sent to the server as
  319. // null. It is an error if a field in this list has a non-empty value.
  320. // This may be used to include null fields in Patch requests.
  321. NullFields []string `json:"-"`
  322. }
  323. func (s *Operation) MarshalJSON() ([]byte, error) {
  324. type NoMethod Operation
  325. raw := NoMethod(*s)
  326. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  327. }
  328. // PublicKey: A public SSH key, corresponding to a private SSH key held
  329. // by the client.
  330. type PublicKey struct {
  331. // Format: Required. Format of this key's content.
  332. //
  333. // Possible values:
  334. // "FORMAT_UNSPECIFIED" - Unknown format. Do not use.
  335. // "SSH_DSS" - `ssh-dss` key format (see RFC4253).
  336. // "SSH_RSA" - `ssh-rsa` key format (see RFC4253).
  337. // "ECDSA_SHA2_NISTP256" - `ecdsa-sha2-nistp256` key format (see
  338. // RFC5656).
  339. // "ECDSA_SHA2_NISTP384" - `ecdsa-sha2-nistp384` key format (see
  340. // RFC5656).
  341. // "ECDSA_SHA2_NISTP521" - `ecdsa-sha2-nistp521` key format (see
  342. // RFC5656).
  343. Format string `json:"format,omitempty"`
  344. // Key: Required. Content of this key.
  345. Key string `json:"key,omitempty"`
  346. // Name: Output only. Full name of this resource, in the
  347. // format
  348. // `users/{owner_email}/environments/{environment_id}/publicKeys/{
  349. // key_id}`.
  350. // `{owner_email}` is the email address of the user to whom the key
  351. // belongs.
  352. // `{environment_id}` is the identifier of the environment to which the
  353. // key
  354. // grants access. `{key_id}` is the unique identifier of the key. For
  355. // example,
  356. // `users/someone@example.com/environments/default/publicKeys/my
  357. // Key`.
  358. Name string `json:"name,omitempty"`
  359. // ForceSendFields is a list of field names (e.g. "Format") to
  360. // unconditionally include in API requests. By default, fields with
  361. // empty values are omitted from API requests. However, any non-pointer,
  362. // non-interface field appearing in ForceSendFields will be sent to the
  363. // server regardless of whether the field is empty or not. This may be
  364. // used to include empty fields in Patch requests.
  365. ForceSendFields []string `json:"-"`
  366. // NullFields is a list of field names (e.g. "Format") to include in API
  367. // requests with the JSON null value. By default, fields with empty
  368. // values are omitted from API requests. However, any field with an
  369. // empty value appearing in NullFields will be sent to the server as
  370. // null. It is an error if a field in this list has a non-empty value.
  371. // This may be used to include null fields in Patch requests.
  372. NullFields []string `json:"-"`
  373. }
  374. func (s *PublicKey) MarshalJSON() ([]byte, error) {
  375. type NoMethod PublicKey
  376. raw := NoMethod(*s)
  377. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  378. }
  379. // StartEnvironmentMetadata: Message included in the metadata field of
  380. // operations returned from
  381. // StartEnvironment.
  382. type StartEnvironmentMetadata struct {
  383. // State: Current state of the environment being started.
  384. //
  385. // Possible values:
  386. // "STATE_UNSPECIFIED" - The environment's start state is unknown.
  387. // "STARTING" - The environment is in the process of being started,
  388. // but no additional
  389. // details are available.
  390. // "UNARCHIVING_DISK" - Startup is waiting for the user's disk to be
  391. // unarchived. This can happen
  392. // when the user returns to Cloud Shell after not having used it for
  393. // a
  394. // while, and suggests that startup will take longer than normal.
  395. // "FINISHED" - Startup is complete and the user should be able to
  396. // establish an SSH
  397. // connection to their environment.
  398. State string `json:"state,omitempty"`
  399. // ForceSendFields is a list of field names (e.g. "State") to
  400. // unconditionally include in API requests. By default, fields with
  401. // empty values are omitted from API requests. However, any non-pointer,
  402. // non-interface field appearing in ForceSendFields will be sent to the
  403. // server regardless of whether the field is empty or not. This may be
  404. // used to include empty fields in Patch requests.
  405. ForceSendFields []string `json:"-"`
  406. // NullFields is a list of field names (e.g. "State") to include in API
  407. // requests with the JSON null value. By default, fields with empty
  408. // values are omitted from API requests. However, any field with an
  409. // empty value appearing in NullFields will be sent to the server as
  410. // null. It is an error if a field in this list has a non-empty value.
  411. // This may be used to include null fields in Patch requests.
  412. NullFields []string `json:"-"`
  413. }
  414. func (s *StartEnvironmentMetadata) MarshalJSON() ([]byte, error) {
  415. type NoMethod StartEnvironmentMetadata
  416. raw := NoMethod(*s)
  417. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  418. }
  419. // StartEnvironmentResponse: Message included in the response field of
  420. // operations returned from
  421. // StartEnvironment once the
  422. // operation is complete.
  423. type StartEnvironmentResponse struct {
  424. // Environment: Environment that was started.
  425. Environment *Environment `json:"environment,omitempty"`
  426. // ForceSendFields is a list of field names (e.g. "Environment") to
  427. // unconditionally include in API requests. By default, fields with
  428. // empty values are omitted from API requests. However, any non-pointer,
  429. // non-interface field appearing in ForceSendFields will be sent to the
  430. // server regardless of whether the field is empty or not. This may be
  431. // used to include empty fields in Patch requests.
  432. ForceSendFields []string `json:"-"`
  433. // NullFields is a list of field names (e.g. "Environment") to include
  434. // in API requests with the JSON null value. By default, fields with
  435. // empty values are omitted from API requests. However, any field with
  436. // an empty value appearing in NullFields will be sent to the server as
  437. // null. It is an error if a field in this list has a non-empty value.
  438. // This may be used to include null fields in Patch requests.
  439. NullFields []string `json:"-"`
  440. }
  441. func (s *StartEnvironmentResponse) MarshalJSON() ([]byte, error) {
  442. type NoMethod StartEnvironmentResponse
  443. raw := NoMethod(*s)
  444. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  445. }
  446. // Status: The `Status` type defines a logical error model that is
  447. // suitable for different
  448. // programming environments, including REST APIs and RPC APIs. It is
  449. // used by
  450. // [gRPC](https://github.com/grpc). The error model is designed to
  451. // be:
  452. //
  453. // - Simple to use and understand for most users
  454. // - Flexible enough to meet unexpected needs
  455. //
  456. // # Overview
  457. //
  458. // The `Status` message contains three pieces of data: error code, error
  459. // message,
  460. // and error details. The error code should be an enum value
  461. // of
  462. // google.rpc.Code, but it may accept additional error codes if needed.
  463. // The
  464. // error message should be a developer-facing English message that
  465. // helps
  466. // developers *understand* and *resolve* the error. If a localized
  467. // user-facing
  468. // error message is needed, put the localized message in the error
  469. // details or
  470. // localize it in the client. The optional error details may contain
  471. // arbitrary
  472. // information about the error. There is a predefined set of error
  473. // detail types
  474. // in the package `google.rpc` that can be used for common error
  475. // conditions.
  476. //
  477. // # Language mapping
  478. //
  479. // The `Status` message is the logical representation of the error
  480. // model, but it
  481. // is not necessarily the actual wire format. When the `Status` message
  482. // is
  483. // exposed in different client libraries and different wire protocols,
  484. // it can be
  485. // mapped differently. For example, it will likely be mapped to some
  486. // exceptions
  487. // in Java, but more likely mapped to some error codes in C.
  488. //
  489. // # Other uses
  490. //
  491. // The error model and the `Status` message can be used in a variety
  492. // of
  493. // environments, either with or without APIs, to provide a
  494. // consistent developer experience across different
  495. // environments.
  496. //
  497. // Example uses of this error model include:
  498. //
  499. // - Partial errors. If a service needs to return partial errors to the
  500. // client,
  501. // it may embed the `Status` in the normal response to indicate the
  502. // partial
  503. // errors.
  504. //
  505. // - Workflow errors. A typical workflow has multiple steps. Each step
  506. // may
  507. // have a `Status` message for error reporting.
  508. //
  509. // - Batch operations. If a client uses batch request and batch
  510. // response, the
  511. // `Status` message should be used directly inside batch response,
  512. // one for
  513. // each error sub-response.
  514. //
  515. // - Asynchronous operations. If an API call embeds asynchronous
  516. // operation
  517. // results in its response, the status of those operations should
  518. // be
  519. // represented directly using the `Status` message.
  520. //
  521. // - Logging. If some API errors are stored in logs, the message
  522. // `Status` could
  523. // be used directly after any stripping needed for security/privacy
  524. // reasons.
  525. type Status struct {
  526. // Code: The status code, which should be an enum value of
  527. // google.rpc.Code.
  528. Code int64 `json:"code,omitempty"`
  529. // Details: A list of messages that carry the error details. There is a
  530. // common set of
  531. // message types for APIs to use.
  532. Details []googleapi.RawMessage `json:"details,omitempty"`
  533. // Message: A developer-facing error message, which should be in
  534. // English. Any
  535. // user-facing error message should be localized and sent in
  536. // the
  537. // google.rpc.Status.details field, or localized by the client.
  538. Message string `json:"message,omitempty"`
  539. // ForceSendFields is a list of field names (e.g. "Code") to
  540. // unconditionally include in API requests. By default, fields with
  541. // empty values are omitted from API requests. However, any non-pointer,
  542. // non-interface field appearing in ForceSendFields will be sent to the
  543. // server regardless of whether the field is empty or not. This may be
  544. // used to include empty fields in Patch requests.
  545. ForceSendFields []string `json:"-"`
  546. // NullFields is a list of field names (e.g. "Code") to include in API
  547. // requests with the JSON null value. By default, fields with empty
  548. // values are omitted from API requests. However, any field with an
  549. // empty value appearing in NullFields will be sent to the server as
  550. // null. It is an error if a field in this list has a non-empty value.
  551. // This may be used to include null fields in Patch requests.
  552. NullFields []string `json:"-"`
  553. }
  554. func (s *Status) MarshalJSON() ([]byte, error) {
  555. type NoMethod Status
  556. raw := NoMethod(*s)
  557. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  558. }
  559. // method id "cloudshell.operations.cancel":
  560. type OperationsCancelCall struct {
  561. s *Service
  562. name string
  563. canceloperationrequest *CancelOperationRequest
  564. urlParams_ gensupport.URLParams
  565. ctx_ context.Context
  566. header_ http.Header
  567. }
  568. // Cancel: Starts asynchronous cancellation on a long-running operation.
  569. // The server
  570. // makes a best effort to cancel the operation, but success is
  571. // not
  572. // guaranteed. If the server doesn't support this method, it
  573. // returns
  574. // `google.rpc.Code.UNIMPLEMENTED`. Clients can
  575. // use
  576. // Operations.GetOperation or
  577. // other methods to check whether the cancellation succeeded or whether
  578. // the
  579. // operation completed despite cancellation. On successful
  580. // cancellation,
  581. // the operation is not deleted; instead, it becomes an operation
  582. // with
  583. // an Operation.error value with a google.rpc.Status.code of
  584. // 1,
  585. // corresponding to `Code.CANCELLED`.
  586. func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall {
  587. c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  588. c.name = name
  589. c.canceloperationrequest = canceloperationrequest
  590. return c
  591. }
  592. // Fields allows partial responses to be retrieved. See
  593. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  594. // for more information.
  595. func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall {
  596. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  597. return c
  598. }
  599. // Context sets the context to be used in this call's Do method. Any
  600. // pending HTTP request will be aborted if the provided context is
  601. // canceled.
  602. func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall {
  603. c.ctx_ = ctx
  604. return c
  605. }
  606. // Header returns an http.Header that can be modified by the caller to
  607. // add HTTP headers to the request.
  608. func (c *OperationsCancelCall) Header() http.Header {
  609. if c.header_ == nil {
  610. c.header_ = make(http.Header)
  611. }
  612. return c.header_
  613. }
  614. func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  615. reqHeaders := make(http.Header)
  616. for k, v := range c.header_ {
  617. reqHeaders[k] = v
  618. }
  619. reqHeaders.Set("User-Agent", c.s.userAgent())
  620. var body io.Reader = nil
  621. body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
  622. if err != nil {
  623. return nil, err
  624. }
  625. reqHeaders.Set("Content-Type", "application/json")
  626. c.urlParams_.Set("alt", alt)
  627. c.urlParams_.Set("prettyPrint", "false")
  628. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  629. urls += "?" + c.urlParams_.Encode()
  630. req, err := http.NewRequest("POST", urls, body)
  631. if err != nil {
  632. return nil, err
  633. }
  634. req.Header = reqHeaders
  635. googleapi.Expand(req.URL, map[string]string{
  636. "name": c.name,
  637. })
  638. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  639. }
  640. // Do executes the "cloudshell.operations.cancel" call.
  641. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  642. // code is an error. Response headers are in either
  643. // *Empty.ServerResponse.Header or (if a response was returned at all)
  644. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  645. // check whether the returned error was because http.StatusNotModified
  646. // was returned.
  647. func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  648. gensupport.SetOptions(c.urlParams_, opts...)
  649. res, err := c.doRequest("json")
  650. if res != nil && res.StatusCode == http.StatusNotModified {
  651. if res.Body != nil {
  652. res.Body.Close()
  653. }
  654. return nil, &googleapi.Error{
  655. Code: res.StatusCode,
  656. Header: res.Header,
  657. }
  658. }
  659. if err != nil {
  660. return nil, err
  661. }
  662. defer googleapi.CloseBody(res)
  663. if err := googleapi.CheckResponse(res); err != nil {
  664. return nil, err
  665. }
  666. ret := &Empty{
  667. ServerResponse: googleapi.ServerResponse{
  668. Header: res.Header,
  669. HTTPStatusCode: res.StatusCode,
  670. },
  671. }
  672. target := &ret
  673. if err := gensupport.DecodeResponse(target, res); err != nil {
  674. return nil, err
  675. }
  676. return ret, nil
  677. // {
  678. // "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`.",
  679. // "flatPath": "v1/operations/{operationsId}:cancel",
  680. // "httpMethod": "POST",
  681. // "id": "cloudshell.operations.cancel",
  682. // "parameterOrder": [
  683. // "name"
  684. // ],
  685. // "parameters": {
  686. // "name": {
  687. // "description": "The name of the operation resource to be cancelled.",
  688. // "location": "path",
  689. // "pattern": "^operations/.+$",
  690. // "required": true,
  691. // "type": "string"
  692. // }
  693. // },
  694. // "path": "v1/{+name}:cancel",
  695. // "request": {
  696. // "$ref": "CancelOperationRequest"
  697. // },
  698. // "response": {
  699. // "$ref": "Empty"
  700. // },
  701. // "scopes": [
  702. // "https://www.googleapis.com/auth/cloud-platform"
  703. // ]
  704. // }
  705. }
  706. // method id "cloudshell.operations.delete":
  707. type OperationsDeleteCall struct {
  708. s *Service
  709. name string
  710. urlParams_ gensupport.URLParams
  711. ctx_ context.Context
  712. header_ http.Header
  713. }
  714. // Delete: Deletes a long-running operation. This method indicates that
  715. // the client is
  716. // no longer interested in the operation result. It does not cancel
  717. // the
  718. // operation. If the server doesn't support this method, it
  719. // returns
  720. // `google.rpc.Code.UNIMPLEMENTED`.
  721. func (r *OperationsService) Delete(name string) *OperationsDeleteCall {
  722. c := &OperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  723. c.name = name
  724. return c
  725. }
  726. // Fields allows partial responses to be retrieved. See
  727. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  728. // for more information.
  729. func (c *OperationsDeleteCall) Fields(s ...googleapi.Field) *OperationsDeleteCall {
  730. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  731. return c
  732. }
  733. // Context sets the context to be used in this call's Do method. Any
  734. // pending HTTP request will be aborted if the provided context is
  735. // canceled.
  736. func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {
  737. c.ctx_ = ctx
  738. return c
  739. }
  740. // Header returns an http.Header that can be modified by the caller to
  741. // add HTTP headers to the request.
  742. func (c *OperationsDeleteCall) Header() http.Header {
  743. if c.header_ == nil {
  744. c.header_ = make(http.Header)
  745. }
  746. return c.header_
  747. }
  748. func (c *OperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  749. reqHeaders := make(http.Header)
  750. for k, v := range c.header_ {
  751. reqHeaders[k] = v
  752. }
  753. reqHeaders.Set("User-Agent", c.s.userAgent())
  754. var body io.Reader = nil
  755. c.urlParams_.Set("alt", alt)
  756. c.urlParams_.Set("prettyPrint", "false")
  757. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  758. urls += "?" + c.urlParams_.Encode()
  759. req, err := http.NewRequest("DELETE", urls, body)
  760. if err != nil {
  761. return nil, err
  762. }
  763. req.Header = reqHeaders
  764. googleapi.Expand(req.URL, map[string]string{
  765. "name": c.name,
  766. })
  767. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  768. }
  769. // Do executes the "cloudshell.operations.delete" call.
  770. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  771. // code is an error. Response headers are in either
  772. // *Empty.ServerResponse.Header or (if a response was returned at all)
  773. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  774. // check whether the returned error was because http.StatusNotModified
  775. // was returned.
  776. func (c *OperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  777. gensupport.SetOptions(c.urlParams_, opts...)
  778. res, err := c.doRequest("json")
  779. if res != nil && res.StatusCode == http.StatusNotModified {
  780. if res.Body != nil {
  781. res.Body.Close()
  782. }
  783. return nil, &googleapi.Error{
  784. Code: res.StatusCode,
  785. Header: res.Header,
  786. }
  787. }
  788. if err != nil {
  789. return nil, err
  790. }
  791. defer googleapi.CloseBody(res)
  792. if err := googleapi.CheckResponse(res); err != nil {
  793. return nil, err
  794. }
  795. ret := &Empty{
  796. ServerResponse: googleapi.ServerResponse{
  797. Header: res.Header,
  798. HTTPStatusCode: res.StatusCode,
  799. },
  800. }
  801. target := &ret
  802. if err := gensupport.DecodeResponse(target, res); err != nil {
  803. return nil, err
  804. }
  805. return ret, nil
  806. // {
  807. // "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`.",
  808. // "flatPath": "v1/operations/{operationsId}",
  809. // "httpMethod": "DELETE",
  810. // "id": "cloudshell.operations.delete",
  811. // "parameterOrder": [
  812. // "name"
  813. // ],
  814. // "parameters": {
  815. // "name": {
  816. // "description": "The name of the operation resource to be deleted.",
  817. // "location": "path",
  818. // "pattern": "^operations/.+$",
  819. // "required": true,
  820. // "type": "string"
  821. // }
  822. // },
  823. // "path": "v1/{+name}",
  824. // "response": {
  825. // "$ref": "Empty"
  826. // },
  827. // "scopes": [
  828. // "https://www.googleapis.com/auth/cloud-platform"
  829. // ]
  830. // }
  831. }
  832. // method id "cloudshell.operations.get":
  833. type OperationsGetCall struct {
  834. s *Service
  835. name string
  836. urlParams_ gensupport.URLParams
  837. ifNoneMatch_ string
  838. ctx_ context.Context
  839. header_ http.Header
  840. }
  841. // Get: Gets the latest state of a long-running operation. Clients can
  842. // use this
  843. // method to poll the operation result at intervals as recommended by
  844. // the API
  845. // service.
  846. func (r *OperationsService) Get(name string) *OperationsGetCall {
  847. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  848. c.name = name
  849. return c
  850. }
  851. // Fields allows partial responses to be retrieved. See
  852. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  853. // for more information.
  854. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  855. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  856. return c
  857. }
  858. // IfNoneMatch sets the optional parameter which makes the operation
  859. // fail if the object's ETag matches the given value. This is useful for
  860. // getting updates only after the object has changed since the last
  861. // request. Use googleapi.IsNotModified to check whether the response
  862. // error from Do is the result of In-None-Match.
  863. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  864. c.ifNoneMatch_ = entityTag
  865. return c
  866. }
  867. // Context sets the context to be used in this call's Do method. Any
  868. // pending HTTP request will be aborted if the provided context is
  869. // canceled.
  870. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  871. c.ctx_ = ctx
  872. return c
  873. }
  874. // Header returns an http.Header that can be modified by the caller to
  875. // add HTTP headers to the request.
  876. func (c *OperationsGetCall) Header() http.Header {
  877. if c.header_ == nil {
  878. c.header_ = make(http.Header)
  879. }
  880. return c.header_
  881. }
  882. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  883. reqHeaders := make(http.Header)
  884. for k, v := range c.header_ {
  885. reqHeaders[k] = v
  886. }
  887. reqHeaders.Set("User-Agent", c.s.userAgent())
  888. if c.ifNoneMatch_ != "" {
  889. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  890. }
  891. var body io.Reader = nil
  892. c.urlParams_.Set("alt", alt)
  893. c.urlParams_.Set("prettyPrint", "false")
  894. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  895. urls += "?" + c.urlParams_.Encode()
  896. req, err := http.NewRequest("GET", urls, body)
  897. if err != nil {
  898. return nil, err
  899. }
  900. req.Header = reqHeaders
  901. googleapi.Expand(req.URL, map[string]string{
  902. "name": c.name,
  903. })
  904. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  905. }
  906. // Do executes the "cloudshell.operations.get" call.
  907. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  908. // status code is an error. Response headers are in either
  909. // *Operation.ServerResponse.Header or (if a response was returned at
  910. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  911. // to check whether the returned error was because
  912. // http.StatusNotModified was returned.
  913. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  914. gensupport.SetOptions(c.urlParams_, opts...)
  915. res, err := c.doRequest("json")
  916. if res != nil && res.StatusCode == http.StatusNotModified {
  917. if res.Body != nil {
  918. res.Body.Close()
  919. }
  920. return nil, &googleapi.Error{
  921. Code: res.StatusCode,
  922. Header: res.Header,
  923. }
  924. }
  925. if err != nil {
  926. return nil, err
  927. }
  928. defer googleapi.CloseBody(res)
  929. if err := googleapi.CheckResponse(res); err != nil {
  930. return nil, err
  931. }
  932. ret := &Operation{
  933. ServerResponse: googleapi.ServerResponse{
  934. Header: res.Header,
  935. HTTPStatusCode: res.StatusCode,
  936. },
  937. }
  938. target := &ret
  939. if err := gensupport.DecodeResponse(target, res); err != nil {
  940. return nil, err
  941. }
  942. return ret, nil
  943. // {
  944. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  945. // "flatPath": "v1/operations/{operationsId}",
  946. // "httpMethod": "GET",
  947. // "id": "cloudshell.operations.get",
  948. // "parameterOrder": [
  949. // "name"
  950. // ],
  951. // "parameters": {
  952. // "name": {
  953. // "description": "The name of the operation resource.",
  954. // "location": "path",
  955. // "pattern": "^operations/.+$",
  956. // "required": true,
  957. // "type": "string"
  958. // }
  959. // },
  960. // "path": "v1/{+name}",
  961. // "response": {
  962. // "$ref": "Operation"
  963. // },
  964. // "scopes": [
  965. // "https://www.googleapis.com/auth/cloud-platform"
  966. // ]
  967. // }
  968. }
  969. // method id "cloudshell.operations.list":
  970. type OperationsListCall struct {
  971. s *Service
  972. name string
  973. urlParams_ gensupport.URLParams
  974. ifNoneMatch_ string
  975. ctx_ context.Context
  976. header_ http.Header
  977. }
  978. // List: Lists operations that match the specified filter in the
  979. // request. If the
  980. // server doesn't support this method, it returns
  981. // `UNIMPLEMENTED`.
  982. //
  983. // NOTE: the `name` binding allows API services to override the
  984. // binding
  985. // to use different resource name schemes, such as `users/*/operations`.
  986. // To
  987. // override the binding, API services can add a binding such
  988. // as
  989. // "/v1/{name=users/*}/operations" to their service configuration.
  990. // For backwards compatibility, the default name includes the
  991. // operations
  992. // collection id, however overriding users must ensure the name
  993. // binding
  994. // is the parent resource, without the operations collection id.
  995. func (r *OperationsService) List(name string) *OperationsListCall {
  996. c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  997. c.name = name
  998. return c
  999. }
  1000. // Filter sets the optional parameter "filter": The standard list
  1001. // filter.
  1002. func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
  1003. c.urlParams_.Set("filter", filter)
  1004. return c
  1005. }
  1006. // PageSize sets the optional parameter "pageSize": The standard list
  1007. // page size.
  1008. func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
  1009. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1010. return c
  1011. }
  1012. // PageToken sets the optional parameter "pageToken": The standard list
  1013. // page token.
  1014. func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
  1015. c.urlParams_.Set("pageToken", pageToken)
  1016. return c
  1017. }
  1018. // Fields allows partial responses to be retrieved. See
  1019. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1020. // for more information.
  1021. func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
  1022. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1023. return c
  1024. }
  1025. // IfNoneMatch sets the optional parameter which makes the operation
  1026. // fail if the object's ETag matches the given value. This is useful for
  1027. // getting updates only after the object has changed since the last
  1028. // request. Use googleapi.IsNotModified to check whether the response
  1029. // error from Do is the result of In-None-Match.
  1030. func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
  1031. c.ifNoneMatch_ = entityTag
  1032. return c
  1033. }
  1034. // Context sets the context to be used in this call's Do method. Any
  1035. // pending HTTP request will be aborted if the provided context is
  1036. // canceled.
  1037. func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
  1038. c.ctx_ = ctx
  1039. return c
  1040. }
  1041. // Header returns an http.Header that can be modified by the caller to
  1042. // add HTTP headers to the request.
  1043. func (c *OperationsListCall) Header() http.Header {
  1044. if c.header_ == nil {
  1045. c.header_ = make(http.Header)
  1046. }
  1047. return c.header_
  1048. }
  1049. func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
  1050. reqHeaders := make(http.Header)
  1051. for k, v := range c.header_ {
  1052. reqHeaders[k] = v
  1053. }
  1054. reqHeaders.Set("User-Agent", c.s.userAgent())
  1055. if c.ifNoneMatch_ != "" {
  1056. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1057. }
  1058. var body io.Reader = nil
  1059. c.urlParams_.Set("alt", alt)
  1060. c.urlParams_.Set("prettyPrint", "false")
  1061. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1062. urls += "?" + c.urlParams_.Encode()
  1063. req, err := http.NewRequest("GET", urls, body)
  1064. if err != nil {
  1065. return nil, err
  1066. }
  1067. req.Header = reqHeaders
  1068. googleapi.Expand(req.URL, map[string]string{
  1069. "name": c.name,
  1070. })
  1071. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1072. }
  1073. // Do executes the "cloudshell.operations.list" call.
  1074. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  1075. // non-2xx status code is an error. Response headers are in either
  1076. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  1077. // returned at all) in error.(*googleapi.Error).Header. Use
  1078. // googleapi.IsNotModified to check whether the returned error was
  1079. // because http.StatusNotModified was returned.
  1080. func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  1081. gensupport.SetOptions(c.urlParams_, opts...)
  1082. res, err := c.doRequest("json")
  1083. if res != nil && res.StatusCode == http.StatusNotModified {
  1084. if res.Body != nil {
  1085. res.Body.Close()
  1086. }
  1087. return nil, &googleapi.Error{
  1088. Code: res.StatusCode,
  1089. Header: res.Header,
  1090. }
  1091. }
  1092. if err != nil {
  1093. return nil, err
  1094. }
  1095. defer googleapi.CloseBody(res)
  1096. if err := googleapi.CheckResponse(res); err != nil {
  1097. return nil, err
  1098. }
  1099. ret := &ListOperationsResponse{
  1100. ServerResponse: googleapi.ServerResponse{
  1101. Header: res.Header,
  1102. HTTPStatusCode: res.StatusCode,
  1103. },
  1104. }
  1105. target := &ret
  1106. if err := gensupport.DecodeResponse(target, res); err != nil {
  1107. return nil, err
  1108. }
  1109. return ret, nil
  1110. // {
  1111. // "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.",
  1112. // "flatPath": "v1/operations",
  1113. // "httpMethod": "GET",
  1114. // "id": "cloudshell.operations.list",
  1115. // "parameterOrder": [
  1116. // "name"
  1117. // ],
  1118. // "parameters": {
  1119. // "filter": {
  1120. // "description": "The standard list filter.",
  1121. // "location": "query",
  1122. // "type": "string"
  1123. // },
  1124. // "name": {
  1125. // "description": "The name of the operation's parent resource.",
  1126. // "location": "path",
  1127. // "pattern": "^operations$",
  1128. // "required": true,
  1129. // "type": "string"
  1130. // },
  1131. // "pageSize": {
  1132. // "description": "The standard list page size.",
  1133. // "format": "int32",
  1134. // "location": "query",
  1135. // "type": "integer"
  1136. // },
  1137. // "pageToken": {
  1138. // "description": "The standard list page token.",
  1139. // "location": "query",
  1140. // "type": "string"
  1141. // }
  1142. // },
  1143. // "path": "v1/{+name}",
  1144. // "response": {
  1145. // "$ref": "ListOperationsResponse"
  1146. // },
  1147. // "scopes": [
  1148. // "https://www.googleapis.com/auth/cloud-platform"
  1149. // ]
  1150. // }
  1151. }
  1152. // Pages invokes f for each page of results.
  1153. // A non-nil error returned from f will halt the iteration.
  1154. // The provided context supersedes any context provided to the Context method.
  1155. func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  1156. c.ctx_ = ctx
  1157. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1158. for {
  1159. x, err := c.Do()
  1160. if err != nil {
  1161. return err
  1162. }
  1163. if err := f(x); err != nil {
  1164. return err
  1165. }
  1166. if x.NextPageToken == "" {
  1167. return nil
  1168. }
  1169. c.PageToken(x.NextPageToken)
  1170. }
  1171. }