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.

1573 lines
54 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/v1alpha1"
  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/v1alpha1"
  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:v1alpha1"
  67. const apiName = "cloudshell"
  68. const apiVersion = "v1alpha1"
  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.Users = NewUsersService(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. Users *UsersService
  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 NewUsersService(s *Service) *UsersService {
  121. rs := &UsersService{s: s}
  122. rs.Environments = NewUsersEnvironmentsService(s)
  123. return rs
  124. }
  125. type UsersService struct {
  126. s *Service
  127. Environments *UsersEnvironmentsService
  128. }
  129. func NewUsersEnvironmentsService(s *Service) *UsersEnvironmentsService {
  130. rs := &UsersEnvironmentsService{s: s}
  131. rs.PublicKeys = NewUsersEnvironmentsPublicKeysService(s)
  132. return rs
  133. }
  134. type UsersEnvironmentsService struct {
  135. s *Service
  136. PublicKeys *UsersEnvironmentsPublicKeysService
  137. }
  138. func NewUsersEnvironmentsPublicKeysService(s *Service) *UsersEnvironmentsPublicKeysService {
  139. rs := &UsersEnvironmentsPublicKeysService{s: s}
  140. return rs
  141. }
  142. type UsersEnvironmentsPublicKeysService struct {
  143. s *Service
  144. }
  145. // AuthorizeEnvironmentRequest: Request message for
  146. // AuthorizeEnvironment.
  147. type AuthorizeEnvironmentRequest struct {
  148. // AccessToken: The OAuth access token that should be sent to the
  149. // environment.
  150. AccessToken string `json:"accessToken,omitempty"`
  151. // ExpireTime: The time when the token expires. If not set, defaults to
  152. // one hour from when
  153. // the server received the request.
  154. ExpireTime string `json:"expireTime,omitempty"`
  155. // ForceSendFields is a list of field names (e.g. "AccessToken") to
  156. // unconditionally include in API requests. By default, fields with
  157. // empty values are omitted from API requests. However, any non-pointer,
  158. // non-interface field appearing in ForceSendFields will be sent to the
  159. // server regardless of whether the field is empty or not. This may be
  160. // used to include empty fields in Patch requests.
  161. ForceSendFields []string `json:"-"`
  162. // NullFields is a list of field names (e.g. "AccessToken") to include
  163. // in API requests with the JSON null value. By default, fields with
  164. // empty values are omitted from API requests. However, any field with
  165. // an empty value appearing in NullFields will be sent to the server as
  166. // null. It is an error if a field in this list has a non-empty value.
  167. // This may be used to include null fields in Patch requests.
  168. NullFields []string `json:"-"`
  169. }
  170. func (s *AuthorizeEnvironmentRequest) MarshalJSON() ([]byte, error) {
  171. type NoMethod AuthorizeEnvironmentRequest
  172. raw := NoMethod(*s)
  173. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  174. }
  175. // CreatePublicKeyRequest: Request message for CreatePublicKey.
  176. type CreatePublicKeyRequest struct {
  177. // Key: Key that should be added to the environment.
  178. Key *PublicKey `json:"key,omitempty"`
  179. // ForceSendFields is a list of field names (e.g. "Key") to
  180. // unconditionally include in API requests. By default, fields with
  181. // empty values are omitted from API requests. However, any non-pointer,
  182. // non-interface field appearing in ForceSendFields will be sent to the
  183. // server regardless of whether the field is empty or not. This may be
  184. // used to include empty fields in Patch requests.
  185. ForceSendFields []string `json:"-"`
  186. // NullFields is a list of field names (e.g. "Key") to include in API
  187. // requests with the JSON null value. By default, fields with empty
  188. // values are omitted from API requests. However, any field with an
  189. // empty value appearing in NullFields will be sent to the server as
  190. // null. It is an error if a field in this list has a non-empty value.
  191. // This may be used to include null fields in Patch requests.
  192. NullFields []string `json:"-"`
  193. }
  194. func (s *CreatePublicKeyRequest) MarshalJSON() ([]byte, error) {
  195. type NoMethod CreatePublicKeyRequest
  196. raw := NoMethod(*s)
  197. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  198. }
  199. // Empty: A generic empty message that you can re-use to avoid defining
  200. // duplicated
  201. // empty messages in your APIs. A typical example is to use it as the
  202. // request
  203. // or the response type of an API method. For instance:
  204. //
  205. // service Foo {
  206. // rpc Bar(google.protobuf.Empty) returns
  207. // (google.protobuf.Empty);
  208. // }
  209. //
  210. // The JSON representation for `Empty` is empty JSON object `{}`.
  211. type Empty struct {
  212. // ServerResponse contains the HTTP response code and headers from the
  213. // server.
  214. googleapi.ServerResponse `json:"-"`
  215. }
  216. // Environment: A Cloud Shell environment, which is defined as the
  217. // combination of a Docker
  218. // image specifying what is installed on the environment and a home
  219. // directory
  220. // containing the user's data that will remain across sessions. Each
  221. // user has a
  222. // single environment with the ID "default".
  223. type Environment struct {
  224. // DockerImage: Required. Full path to the Docker image used to run this
  225. // environment, e.g.
  226. // "gcr.io/dev-con/cloud-devshell:latest".
  227. DockerImage string `json:"dockerImage,omitempty"`
  228. // Id: Output only. The environment's identifier, which is always
  229. // "default".
  230. Id string `json:"id,omitempty"`
  231. // Name: Output only. Full name of this resource, in the
  232. // format
  233. // `users/{owner_email}/environments/{environment_id}`. `{owner_email}`
  234. // is the
  235. // email address of the user to whom this environment belongs,
  236. // and
  237. // `{environment_id}` is the identifier of this environment. For
  238. // example,
  239. // `users/someone@example.com/environments/default`.
  240. Name string `json:"name,omitempty"`
  241. // PublicKeys: Output only. Public keys associated with the environment.
  242. // Clients can
  243. // connect to this environment via SSH only if they possess a private
  244. // key
  245. // corresponding to at least one of these public keys. Keys can be added
  246. // to or
  247. // removed from the environment using the CreatePublicKey and
  248. // DeletePublicKey
  249. // methods.
  250. PublicKeys []*PublicKey `json:"publicKeys,omitempty"`
  251. // SshHost: Output only. Host to which clients can connect to initiate
  252. // SSH sessions
  253. // with the environment.
  254. SshHost string `json:"sshHost,omitempty"`
  255. // SshPort: Output only. Port to which clients can connect to initiate
  256. // SSH sessions
  257. // with the environment.
  258. SshPort int64 `json:"sshPort,omitempty"`
  259. // SshUsername: Output only. Username that clients should use when
  260. // initiating SSH sessions
  261. // with the environment.
  262. SshUsername string `json:"sshUsername,omitempty"`
  263. // State: Output only. Current execution state of this environment.
  264. //
  265. // Possible values:
  266. // "STATE_UNSPECIFIED" - The environment's states is unknown.
  267. // "DISABLED" - The environment is not running and can't be connected
  268. // to. Starting the
  269. // environment will transition it to the STARTING state.
  270. // "STARTING" - The environment is being started but is not yet ready
  271. // to accept
  272. // connections.
  273. // "RUNNING" - The environment is running and ready to accept
  274. // connections. It will
  275. // automatically transition back to DISABLED after a period of
  276. // inactivity or
  277. // if another environment is started.
  278. State string `json:"state,omitempty"`
  279. // ServerResponse contains the HTTP response code and headers from the
  280. // server.
  281. googleapi.ServerResponse `json:"-"`
  282. // ForceSendFields is a list of field names (e.g. "DockerImage") to
  283. // unconditionally include in API requests. By default, fields with
  284. // empty values are omitted from API requests. However, any non-pointer,
  285. // non-interface field appearing in ForceSendFields will be sent to the
  286. // server regardless of whether the field is empty or not. This may be
  287. // used to include empty fields in Patch requests.
  288. ForceSendFields []string `json:"-"`
  289. // NullFields is a list of field names (e.g. "DockerImage") to include
  290. // in API requests with the JSON null value. By default, fields with
  291. // empty values are omitted from API requests. However, any field with
  292. // an empty value appearing in NullFields will be sent to the server as
  293. // null. It is an error if a field in this list has a non-empty value.
  294. // This may be used to include null fields in Patch requests.
  295. NullFields []string `json:"-"`
  296. }
  297. func (s *Environment) MarshalJSON() ([]byte, error) {
  298. type NoMethod Environment
  299. raw := NoMethod(*s)
  300. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  301. }
  302. // Operation: This resource represents a long-running operation that is
  303. // the result of a
  304. // network API call.
  305. type Operation struct {
  306. // Done: If the value is `false`, it means the operation is still in
  307. // progress.
  308. // If `true`, the operation is completed, and either `error` or
  309. // `response` is
  310. // available.
  311. Done bool `json:"done,omitempty"`
  312. // Error: The error result of the operation in case of failure or
  313. // cancellation.
  314. Error *Status `json:"error,omitempty"`
  315. // Metadata: Service-specific metadata associated with the operation.
  316. // It typically
  317. // contains progress information and common metadata such as create
  318. // time.
  319. // Some services might not provide such metadata. Any method that
  320. // returns a
  321. // long-running operation should document the metadata type, if any.
  322. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  323. // Name: The server-assigned name, which is only unique within the same
  324. // service that
  325. // originally returns it. If you use the default HTTP mapping,
  326. // the
  327. // `name` should have the format of `operations/some/unique/name`.
  328. Name string `json:"name,omitempty"`
  329. // Response: The normal response of the operation in case of success.
  330. // If the original
  331. // method returns no data on success, such as `Delete`, the response
  332. // is
  333. // `google.protobuf.Empty`. If the original method is
  334. // standard
  335. // `Get`/`Create`/`Update`, the response should be the resource. For
  336. // other
  337. // methods, the response should have the type `XxxResponse`, where
  338. // `Xxx`
  339. // is the original method name. For example, if the original method
  340. // name
  341. // is `TakeSnapshot()`, the inferred response type
  342. // is
  343. // `TakeSnapshotResponse`.
  344. Response googleapi.RawMessage `json:"response,omitempty"`
  345. // ServerResponse contains the HTTP response code and headers from the
  346. // server.
  347. googleapi.ServerResponse `json:"-"`
  348. // ForceSendFields is a list of field names (e.g. "Done") to
  349. // unconditionally include in API requests. By default, fields with
  350. // empty values are omitted from API requests. However, any non-pointer,
  351. // non-interface field appearing in ForceSendFields will be sent to the
  352. // server regardless of whether the field is empty or not. This may be
  353. // used to include empty fields in Patch requests.
  354. ForceSendFields []string `json:"-"`
  355. // NullFields is a list of field names (e.g. "Done") to include in API
  356. // requests with the JSON null value. By default, fields with empty
  357. // values are omitted from API requests. However, any field with an
  358. // empty value appearing in NullFields will be sent to the server as
  359. // null. It is an error if a field in this list has a non-empty value.
  360. // This may be used to include null fields in Patch requests.
  361. NullFields []string `json:"-"`
  362. }
  363. func (s *Operation) MarshalJSON() ([]byte, error) {
  364. type NoMethod Operation
  365. raw := NoMethod(*s)
  366. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  367. }
  368. // PublicKey: A public SSH key, corresponding to a private SSH key held
  369. // by the client.
  370. type PublicKey struct {
  371. // Format: Required. Format of this key's content.
  372. //
  373. // Possible values:
  374. // "FORMAT_UNSPECIFIED" - Unknown format. Do not use.
  375. // "SSH_DSS" - `ssh-dss` key format (see RFC4253).
  376. // "SSH_RSA" - `ssh-rsa` key format (see RFC4253).
  377. // "ECDSA_SHA2_NISTP256" - `ecdsa-sha2-nistp256` key format (see
  378. // RFC5656).
  379. // "ECDSA_SHA2_NISTP384" - `ecdsa-sha2-nistp384` key format (see
  380. // RFC5656).
  381. // "ECDSA_SHA2_NISTP521" - `ecdsa-sha2-nistp521` key format (see
  382. // RFC5656).
  383. Format string `json:"format,omitempty"`
  384. // Key: Required. Content of this key.
  385. Key string `json:"key,omitempty"`
  386. // Name: Output only. Full name of this resource, in the
  387. // format
  388. // `users/{owner_email}/environments/{environment_id}/publicKeys/{
  389. // key_id}`.
  390. // `{owner_email}` is the email address of the user to whom the key
  391. // belongs.
  392. // `{environment_id}` is the identifier of the environment to which the
  393. // key
  394. // grants access. `{key_id}` is the unique identifier of the key. For
  395. // example,
  396. // `users/someone@example.com/environments/default/publicKeys/my
  397. // Key`.
  398. Name string `json:"name,omitempty"`
  399. // ServerResponse contains the HTTP response code and headers from the
  400. // server.
  401. googleapi.ServerResponse `json:"-"`
  402. // ForceSendFields is a list of field names (e.g. "Format") to
  403. // unconditionally include in API requests. By default, fields with
  404. // empty values are omitted from API requests. However, any non-pointer,
  405. // non-interface field appearing in ForceSendFields will be sent to the
  406. // server regardless of whether the field is empty or not. This may be
  407. // used to include empty fields in Patch requests.
  408. ForceSendFields []string `json:"-"`
  409. // NullFields is a list of field names (e.g. "Format") to include in API
  410. // requests with the JSON null value. By default, fields with empty
  411. // values are omitted from API requests. However, any field with an
  412. // empty value appearing in NullFields will be sent to the server as
  413. // null. It is an error if a field in this list has a non-empty value.
  414. // This may be used to include null fields in Patch requests.
  415. NullFields []string `json:"-"`
  416. }
  417. func (s *PublicKey) MarshalJSON() ([]byte, error) {
  418. type NoMethod PublicKey
  419. raw := NoMethod(*s)
  420. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  421. }
  422. // StartEnvironmentMetadata: Message included in the metadata field of
  423. // operations returned from
  424. // StartEnvironment.
  425. type StartEnvironmentMetadata struct {
  426. // State: Current state of the environment being started.
  427. //
  428. // Possible values:
  429. // "STATE_UNSPECIFIED" - The environment's start state is unknown.
  430. // "STARTING" - The environment is in the process of being started,
  431. // but no additional
  432. // details are available.
  433. // "UNARCHIVING_DISK" - Startup is waiting for the user's disk to be
  434. // unarchived. This can happen
  435. // when the user returns to Cloud Shell after not having used it for
  436. // a
  437. // while, and suggests that startup will take longer than normal.
  438. // "FINISHED" - Startup is complete and the user should be able to
  439. // establish an SSH
  440. // connection to their environment.
  441. State string `json:"state,omitempty"`
  442. // ForceSendFields is a list of field names (e.g. "State") to
  443. // unconditionally include in API requests. By default, fields with
  444. // empty values are omitted from API requests. However, any non-pointer,
  445. // non-interface field appearing in ForceSendFields will be sent to the
  446. // server regardless of whether the field is empty or not. This may be
  447. // used to include empty fields in Patch requests.
  448. ForceSendFields []string `json:"-"`
  449. // NullFields is a list of field names (e.g. "State") to include in API
  450. // requests with the JSON null value. By default, fields with empty
  451. // values are omitted from API requests. However, any field with an
  452. // empty value appearing in NullFields will be sent to the server as
  453. // null. It is an error if a field in this list has a non-empty value.
  454. // This may be used to include null fields in Patch requests.
  455. NullFields []string `json:"-"`
  456. }
  457. func (s *StartEnvironmentMetadata) MarshalJSON() ([]byte, error) {
  458. type NoMethod StartEnvironmentMetadata
  459. raw := NoMethod(*s)
  460. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  461. }
  462. // StartEnvironmentRequest: Request message for StartEnvironment.
  463. type StartEnvironmentRequest struct {
  464. // AccessToken: The initial access token passed to the environment. If
  465. // this is present and
  466. // valid, the environment will be pre-authenticated with gcloud so that
  467. // the
  468. // user can run gcloud commands in Cloud Shell without having to log in.
  469. // This
  470. // code can be updated later by calling AuthorizeEnvironment.
  471. AccessToken string `json:"accessToken,omitempty"`
  472. // ForceSendFields is a list of field names (e.g. "AccessToken") to
  473. // unconditionally include in API requests. By default, fields with
  474. // empty values are omitted from API requests. However, any non-pointer,
  475. // non-interface field appearing in ForceSendFields will be sent to the
  476. // server regardless of whether the field is empty or not. This may be
  477. // used to include empty fields in Patch requests.
  478. ForceSendFields []string `json:"-"`
  479. // NullFields is a list of field names (e.g. "AccessToken") to include
  480. // in API requests with the JSON null value. By default, fields with
  481. // empty values are omitted from API requests. However, any field with
  482. // an empty value appearing in NullFields will be sent to the server as
  483. // null. It is an error if a field in this list has a non-empty value.
  484. // This may be used to include null fields in Patch requests.
  485. NullFields []string `json:"-"`
  486. }
  487. func (s *StartEnvironmentRequest) MarshalJSON() ([]byte, error) {
  488. type NoMethod StartEnvironmentRequest
  489. raw := NoMethod(*s)
  490. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  491. }
  492. // StartEnvironmentResponse: Message included in the response field of
  493. // operations returned from
  494. // StartEnvironment once the
  495. // operation is complete.
  496. type StartEnvironmentResponse struct {
  497. // Environment: Environment that was started.
  498. Environment *Environment `json:"environment,omitempty"`
  499. // ForceSendFields is a list of field names (e.g. "Environment") to
  500. // unconditionally include in API requests. By default, fields with
  501. // empty values are omitted from API requests. However, any non-pointer,
  502. // non-interface field appearing in ForceSendFields will be sent to the
  503. // server regardless of whether the field is empty or not. This may be
  504. // used to include empty fields in Patch requests.
  505. ForceSendFields []string `json:"-"`
  506. // NullFields is a list of field names (e.g. "Environment") to include
  507. // in API requests with the JSON null value. By default, fields with
  508. // empty values are omitted from API requests. However, any field with
  509. // an empty value appearing in NullFields will be sent to the server as
  510. // null. It is an error if a field in this list has a non-empty value.
  511. // This may be used to include null fields in Patch requests.
  512. NullFields []string `json:"-"`
  513. }
  514. func (s *StartEnvironmentResponse) MarshalJSON() ([]byte, error) {
  515. type NoMethod StartEnvironmentResponse
  516. raw := NoMethod(*s)
  517. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  518. }
  519. // Status: The `Status` type defines a logical error model that is
  520. // suitable for different
  521. // programming environments, including REST APIs and RPC APIs. It is
  522. // used by
  523. // [gRPC](https://github.com/grpc). The error model is designed to
  524. // be:
  525. //
  526. // - Simple to use and understand for most users
  527. // - Flexible enough to meet unexpected needs
  528. //
  529. // # Overview
  530. //
  531. // The `Status` message contains three pieces of data: error code, error
  532. // message,
  533. // and error details. The error code should be an enum value
  534. // of
  535. // google.rpc.Code, but it may accept additional error codes if needed.
  536. // The
  537. // error message should be a developer-facing English message that
  538. // helps
  539. // developers *understand* and *resolve* the error. If a localized
  540. // user-facing
  541. // error message is needed, put the localized message in the error
  542. // details or
  543. // localize it in the client. The optional error details may contain
  544. // arbitrary
  545. // information about the error. There is a predefined set of error
  546. // detail types
  547. // in the package `google.rpc` that can be used for common error
  548. // conditions.
  549. //
  550. // # Language mapping
  551. //
  552. // The `Status` message is the logical representation of the error
  553. // model, but it
  554. // is not necessarily the actual wire format. When the `Status` message
  555. // is
  556. // exposed in different client libraries and different wire protocols,
  557. // it can be
  558. // mapped differently. For example, it will likely be mapped to some
  559. // exceptions
  560. // in Java, but more likely mapped to some error codes in C.
  561. //
  562. // # Other uses
  563. //
  564. // The error model and the `Status` message can be used in a variety
  565. // of
  566. // environments, either with or without APIs, to provide a
  567. // consistent developer experience across different
  568. // environments.
  569. //
  570. // Example uses of this error model include:
  571. //
  572. // - Partial errors. If a service needs to return partial errors to the
  573. // client,
  574. // it may embed the `Status` in the normal response to indicate the
  575. // partial
  576. // errors.
  577. //
  578. // - Workflow errors. A typical workflow has multiple steps. Each step
  579. // may
  580. // have a `Status` message for error reporting.
  581. //
  582. // - Batch operations. If a client uses batch request and batch
  583. // response, the
  584. // `Status` message should be used directly inside batch response,
  585. // one for
  586. // each error sub-response.
  587. //
  588. // - Asynchronous operations. If an API call embeds asynchronous
  589. // operation
  590. // results in its response, the status of those operations should
  591. // be
  592. // represented directly using the `Status` message.
  593. //
  594. // - Logging. If some API errors are stored in logs, the message
  595. // `Status` could
  596. // be used directly after any stripping needed for security/privacy
  597. // reasons.
  598. type Status struct {
  599. // Code: The status code, which should be an enum value of
  600. // google.rpc.Code.
  601. Code int64 `json:"code,omitempty"`
  602. // Details: A list of messages that carry the error details. There is a
  603. // common set of
  604. // message types for APIs to use.
  605. Details []googleapi.RawMessage `json:"details,omitempty"`
  606. // Message: A developer-facing error message, which should be in
  607. // English. Any
  608. // user-facing error message should be localized and sent in
  609. // the
  610. // google.rpc.Status.details field, or localized by the client.
  611. Message string `json:"message,omitempty"`
  612. // ForceSendFields is a list of field names (e.g. "Code") to
  613. // unconditionally include in API requests. By default, fields with
  614. // empty values are omitted from API requests. However, any non-pointer,
  615. // non-interface field appearing in ForceSendFields will be sent to the
  616. // server regardless of whether the field is empty or not. This may be
  617. // used to include empty fields in Patch requests.
  618. ForceSendFields []string `json:"-"`
  619. // NullFields is a list of field names (e.g. "Code") to include in API
  620. // requests with the JSON null value. By default, fields with empty
  621. // values are omitted from API requests. However, any field with an
  622. // empty value appearing in NullFields will be sent to the server as
  623. // null. It is an error if a field in this list has a non-empty value.
  624. // This may be used to include null fields in Patch requests.
  625. NullFields []string `json:"-"`
  626. }
  627. func (s *Status) MarshalJSON() ([]byte, error) {
  628. type NoMethod Status
  629. raw := NoMethod(*s)
  630. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  631. }
  632. // method id "cloudshell.users.environments.authorize":
  633. type UsersEnvironmentsAuthorizeCall struct {
  634. s *Service
  635. name string
  636. authorizeenvironmentrequest *AuthorizeEnvironmentRequest
  637. urlParams_ gensupport.URLParams
  638. ctx_ context.Context
  639. header_ http.Header
  640. }
  641. // Authorize: Sends an access token to a running environment on behalf
  642. // of a user. When
  643. // this completes, the environment will be authorized to run gcloud
  644. // commands
  645. // without requiring the user to manually authenticate.
  646. func (r *UsersEnvironmentsService) Authorize(name string, authorizeenvironmentrequest *AuthorizeEnvironmentRequest) *UsersEnvironmentsAuthorizeCall {
  647. c := &UsersEnvironmentsAuthorizeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  648. c.name = name
  649. c.authorizeenvironmentrequest = authorizeenvironmentrequest
  650. return c
  651. }
  652. // Fields allows partial responses to be retrieved. See
  653. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  654. // for more information.
  655. func (c *UsersEnvironmentsAuthorizeCall) Fields(s ...googleapi.Field) *UsersEnvironmentsAuthorizeCall {
  656. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  657. return c
  658. }
  659. // Context sets the context to be used in this call's Do method. Any
  660. // pending HTTP request will be aborted if the provided context is
  661. // canceled.
  662. func (c *UsersEnvironmentsAuthorizeCall) Context(ctx context.Context) *UsersEnvironmentsAuthorizeCall {
  663. c.ctx_ = ctx
  664. return c
  665. }
  666. // Header returns an http.Header that can be modified by the caller to
  667. // add HTTP headers to the request.
  668. func (c *UsersEnvironmentsAuthorizeCall) Header() http.Header {
  669. if c.header_ == nil {
  670. c.header_ = make(http.Header)
  671. }
  672. return c.header_
  673. }
  674. func (c *UsersEnvironmentsAuthorizeCall) doRequest(alt string) (*http.Response, error) {
  675. reqHeaders := make(http.Header)
  676. for k, v := range c.header_ {
  677. reqHeaders[k] = v
  678. }
  679. reqHeaders.Set("User-Agent", c.s.userAgent())
  680. var body io.Reader = nil
  681. body, err := googleapi.WithoutDataWrapper.JSONReader(c.authorizeenvironmentrequest)
  682. if err != nil {
  683. return nil, err
  684. }
  685. reqHeaders.Set("Content-Type", "application/json")
  686. c.urlParams_.Set("alt", alt)
  687. c.urlParams_.Set("prettyPrint", "false")
  688. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:authorize")
  689. urls += "?" + c.urlParams_.Encode()
  690. req, err := http.NewRequest("POST", urls, body)
  691. if err != nil {
  692. return nil, err
  693. }
  694. req.Header = reqHeaders
  695. googleapi.Expand(req.URL, map[string]string{
  696. "name": c.name,
  697. })
  698. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  699. }
  700. // Do executes the "cloudshell.users.environments.authorize" call.
  701. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  702. // code is an error. Response headers are in either
  703. // *Empty.ServerResponse.Header or (if a response was returned at all)
  704. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  705. // check whether the returned error was because http.StatusNotModified
  706. // was returned.
  707. func (c *UsersEnvironmentsAuthorizeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  708. gensupport.SetOptions(c.urlParams_, opts...)
  709. res, err := c.doRequest("json")
  710. if res != nil && res.StatusCode == http.StatusNotModified {
  711. if res.Body != nil {
  712. res.Body.Close()
  713. }
  714. return nil, &googleapi.Error{
  715. Code: res.StatusCode,
  716. Header: res.Header,
  717. }
  718. }
  719. if err != nil {
  720. return nil, err
  721. }
  722. defer googleapi.CloseBody(res)
  723. if err := googleapi.CheckResponse(res); err != nil {
  724. return nil, err
  725. }
  726. ret := &Empty{
  727. ServerResponse: googleapi.ServerResponse{
  728. Header: res.Header,
  729. HTTPStatusCode: res.StatusCode,
  730. },
  731. }
  732. target := &ret
  733. if err := gensupport.DecodeResponse(target, res); err != nil {
  734. return nil, err
  735. }
  736. return ret, nil
  737. // {
  738. // "description": "Sends an access token to a running environment on behalf of a user. When\nthis completes, the environment will be authorized to run gcloud commands\nwithout requiring the user to manually authenticate.",
  739. // "flatPath": "v1alpha1/users/{usersId}/environments/{environmentsId}:authorize",
  740. // "httpMethod": "POST",
  741. // "id": "cloudshell.users.environments.authorize",
  742. // "parameterOrder": [
  743. // "name"
  744. // ],
  745. // "parameters": {
  746. // "name": {
  747. // "description": "Name of the resource that should receive the token, for example\n`users/me/environments/default` or\n`users/someone@example.com/environments/default`.",
  748. // "location": "path",
  749. // "pattern": "^users/[^/]+/environments/[^/]+$",
  750. // "required": true,
  751. // "type": "string"
  752. // }
  753. // },
  754. // "path": "v1alpha1/{+name}:authorize",
  755. // "request": {
  756. // "$ref": "AuthorizeEnvironmentRequest"
  757. // },
  758. // "response": {
  759. // "$ref": "Empty"
  760. // },
  761. // "scopes": [
  762. // "https://www.googleapis.com/auth/cloud-platform"
  763. // ]
  764. // }
  765. }
  766. // method id "cloudshell.users.environments.get":
  767. type UsersEnvironmentsGetCall struct {
  768. s *Service
  769. name string
  770. urlParams_ gensupport.URLParams
  771. ifNoneMatch_ string
  772. ctx_ context.Context
  773. header_ http.Header
  774. }
  775. // Get: Gets an environment. Returns NOT_FOUND if the environment does
  776. // not exist.
  777. func (r *UsersEnvironmentsService) Get(name string) *UsersEnvironmentsGetCall {
  778. c := &UsersEnvironmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  779. c.name = name
  780. return c
  781. }
  782. // Fields allows partial responses to be retrieved. See
  783. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  784. // for more information.
  785. func (c *UsersEnvironmentsGetCall) Fields(s ...googleapi.Field) *UsersEnvironmentsGetCall {
  786. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  787. return c
  788. }
  789. // IfNoneMatch sets the optional parameter which makes the operation
  790. // fail if the object's ETag matches the given value. This is useful for
  791. // getting updates only after the object has changed since the last
  792. // request. Use googleapi.IsNotModified to check whether the response
  793. // error from Do is the result of In-None-Match.
  794. func (c *UsersEnvironmentsGetCall) IfNoneMatch(entityTag string) *UsersEnvironmentsGetCall {
  795. c.ifNoneMatch_ = entityTag
  796. return c
  797. }
  798. // Context sets the context to be used in this call's Do method. Any
  799. // pending HTTP request will be aborted if the provided context is
  800. // canceled.
  801. func (c *UsersEnvironmentsGetCall) Context(ctx context.Context) *UsersEnvironmentsGetCall {
  802. c.ctx_ = ctx
  803. return c
  804. }
  805. // Header returns an http.Header that can be modified by the caller to
  806. // add HTTP headers to the request.
  807. func (c *UsersEnvironmentsGetCall) Header() http.Header {
  808. if c.header_ == nil {
  809. c.header_ = make(http.Header)
  810. }
  811. return c.header_
  812. }
  813. func (c *UsersEnvironmentsGetCall) doRequest(alt string) (*http.Response, error) {
  814. reqHeaders := make(http.Header)
  815. for k, v := range c.header_ {
  816. reqHeaders[k] = v
  817. }
  818. reqHeaders.Set("User-Agent", c.s.userAgent())
  819. if c.ifNoneMatch_ != "" {
  820. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  821. }
  822. var body io.Reader = nil
  823. c.urlParams_.Set("alt", alt)
  824. c.urlParams_.Set("prettyPrint", "false")
  825. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  826. urls += "?" + c.urlParams_.Encode()
  827. req, err := http.NewRequest("GET", urls, body)
  828. if err != nil {
  829. return nil, err
  830. }
  831. req.Header = reqHeaders
  832. googleapi.Expand(req.URL, map[string]string{
  833. "name": c.name,
  834. })
  835. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  836. }
  837. // Do executes the "cloudshell.users.environments.get" call.
  838. // Exactly one of *Environment or error will be non-nil. Any non-2xx
  839. // status code is an error. Response headers are in either
  840. // *Environment.ServerResponse.Header or (if a response was returned at
  841. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  842. // to check whether the returned error was because
  843. // http.StatusNotModified was returned.
  844. func (c *UsersEnvironmentsGetCall) Do(opts ...googleapi.CallOption) (*Environment, error) {
  845. gensupport.SetOptions(c.urlParams_, opts...)
  846. res, err := c.doRequest("json")
  847. if res != nil && res.StatusCode == http.StatusNotModified {
  848. if res.Body != nil {
  849. res.Body.Close()
  850. }
  851. return nil, &googleapi.Error{
  852. Code: res.StatusCode,
  853. Header: res.Header,
  854. }
  855. }
  856. if err != nil {
  857. return nil, err
  858. }
  859. defer googleapi.CloseBody(res)
  860. if err := googleapi.CheckResponse(res); err != nil {
  861. return nil, err
  862. }
  863. ret := &Environment{
  864. ServerResponse: googleapi.ServerResponse{
  865. Header: res.Header,
  866. HTTPStatusCode: res.StatusCode,
  867. },
  868. }
  869. target := &ret
  870. if err := gensupport.DecodeResponse(target, res); err != nil {
  871. return nil, err
  872. }
  873. return ret, nil
  874. // {
  875. // "description": "Gets an environment. Returns NOT_FOUND if the environment does not exist.",
  876. // "flatPath": "v1alpha1/users/{usersId}/environments/{environmentsId}",
  877. // "httpMethod": "GET",
  878. // "id": "cloudshell.users.environments.get",
  879. // "parameterOrder": [
  880. // "name"
  881. // ],
  882. // "parameters": {
  883. // "name": {
  884. // "description": "Name of the requested resource, for example `users/me/environments/default`\nor `users/someone@example.com/environments/default`.",
  885. // "location": "path",
  886. // "pattern": "^users/[^/]+/environments/[^/]+$",
  887. // "required": true,
  888. // "type": "string"
  889. // }
  890. // },
  891. // "path": "v1alpha1/{+name}",
  892. // "response": {
  893. // "$ref": "Environment"
  894. // },
  895. // "scopes": [
  896. // "https://www.googleapis.com/auth/cloud-platform"
  897. // ]
  898. // }
  899. }
  900. // method id "cloudshell.users.environments.patch":
  901. type UsersEnvironmentsPatchCall struct {
  902. s *Service
  903. name string
  904. environment *Environment
  905. urlParams_ gensupport.URLParams
  906. ctx_ context.Context
  907. header_ http.Header
  908. }
  909. // Patch: Updates an existing environment.
  910. func (r *UsersEnvironmentsService) Patch(name string, environment *Environment) *UsersEnvironmentsPatchCall {
  911. c := &UsersEnvironmentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  912. c.name = name
  913. c.environment = environment
  914. return c
  915. }
  916. // UpdateMask sets the optional parameter "updateMask": Mask specifying
  917. // which fields in the environment should be updated.
  918. func (c *UsersEnvironmentsPatchCall) UpdateMask(updateMask string) *UsersEnvironmentsPatchCall {
  919. c.urlParams_.Set("updateMask", updateMask)
  920. return c
  921. }
  922. // Fields allows partial responses to be retrieved. See
  923. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  924. // for more information.
  925. func (c *UsersEnvironmentsPatchCall) Fields(s ...googleapi.Field) *UsersEnvironmentsPatchCall {
  926. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  927. return c
  928. }
  929. // Context sets the context to be used in this call's Do method. Any
  930. // pending HTTP request will be aborted if the provided context is
  931. // canceled.
  932. func (c *UsersEnvironmentsPatchCall) Context(ctx context.Context) *UsersEnvironmentsPatchCall {
  933. c.ctx_ = ctx
  934. return c
  935. }
  936. // Header returns an http.Header that can be modified by the caller to
  937. // add HTTP headers to the request.
  938. func (c *UsersEnvironmentsPatchCall) Header() http.Header {
  939. if c.header_ == nil {
  940. c.header_ = make(http.Header)
  941. }
  942. return c.header_
  943. }
  944. func (c *UsersEnvironmentsPatchCall) doRequest(alt string) (*http.Response, error) {
  945. reqHeaders := make(http.Header)
  946. for k, v := range c.header_ {
  947. reqHeaders[k] = v
  948. }
  949. reqHeaders.Set("User-Agent", c.s.userAgent())
  950. var body io.Reader = nil
  951. body, err := googleapi.WithoutDataWrapper.JSONReader(c.environment)
  952. if err != nil {
  953. return nil, err
  954. }
  955. reqHeaders.Set("Content-Type", "application/json")
  956. c.urlParams_.Set("alt", alt)
  957. c.urlParams_.Set("prettyPrint", "false")
  958. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  959. urls += "?" + c.urlParams_.Encode()
  960. req, err := http.NewRequest("PATCH", urls, body)
  961. if err != nil {
  962. return nil, err
  963. }
  964. req.Header = reqHeaders
  965. googleapi.Expand(req.URL, map[string]string{
  966. "name": c.name,
  967. })
  968. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  969. }
  970. // Do executes the "cloudshell.users.environments.patch" call.
  971. // Exactly one of *Environment or error will be non-nil. Any non-2xx
  972. // status code is an error. Response headers are in either
  973. // *Environment.ServerResponse.Header or (if a response was returned at
  974. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  975. // to check whether the returned error was because
  976. // http.StatusNotModified was returned.
  977. func (c *UsersEnvironmentsPatchCall) Do(opts ...googleapi.CallOption) (*Environment, error) {
  978. gensupport.SetOptions(c.urlParams_, opts...)
  979. res, err := c.doRequest("json")
  980. if res != nil && res.StatusCode == http.StatusNotModified {
  981. if res.Body != nil {
  982. res.Body.Close()
  983. }
  984. return nil, &googleapi.Error{
  985. Code: res.StatusCode,
  986. Header: res.Header,
  987. }
  988. }
  989. if err != nil {
  990. return nil, err
  991. }
  992. defer googleapi.CloseBody(res)
  993. if err := googleapi.CheckResponse(res); err != nil {
  994. return nil, err
  995. }
  996. ret := &Environment{
  997. ServerResponse: googleapi.ServerResponse{
  998. Header: res.Header,
  999. HTTPStatusCode: res.StatusCode,
  1000. },
  1001. }
  1002. target := &ret
  1003. if err := gensupport.DecodeResponse(target, res); err != nil {
  1004. return nil, err
  1005. }
  1006. return ret, nil
  1007. // {
  1008. // "description": "Updates an existing environment.",
  1009. // "flatPath": "v1alpha1/users/{usersId}/environments/{environmentsId}",
  1010. // "httpMethod": "PATCH",
  1011. // "id": "cloudshell.users.environments.patch",
  1012. // "parameterOrder": [
  1013. // "name"
  1014. // ],
  1015. // "parameters": {
  1016. // "name": {
  1017. // "description": "Name of the resource to be updated, for example\n`users/me/environments/default` or\n`users/someone@example.com/environments/default`.",
  1018. // "location": "path",
  1019. // "pattern": "^users/[^/]+/environments/[^/]+$",
  1020. // "required": true,
  1021. // "type": "string"
  1022. // },
  1023. // "updateMask": {
  1024. // "description": "Mask specifying which fields in the environment should be updated.",
  1025. // "format": "google-fieldmask",
  1026. // "location": "query",
  1027. // "type": "string"
  1028. // }
  1029. // },
  1030. // "path": "v1alpha1/{+name}",
  1031. // "request": {
  1032. // "$ref": "Environment"
  1033. // },
  1034. // "response": {
  1035. // "$ref": "Environment"
  1036. // },
  1037. // "scopes": [
  1038. // "https://www.googleapis.com/auth/cloud-platform"
  1039. // ]
  1040. // }
  1041. }
  1042. // method id "cloudshell.users.environments.start":
  1043. type UsersEnvironmentsStartCall struct {
  1044. s *Service
  1045. name string
  1046. startenvironmentrequest *StartEnvironmentRequest
  1047. urlParams_ gensupport.URLParams
  1048. ctx_ context.Context
  1049. header_ http.Header
  1050. }
  1051. // Start: Starts an existing environment, allowing clients to connect to
  1052. // it. The
  1053. // returned operation will contain an instance of
  1054. // StartEnvironmentMetadata in
  1055. // its metadata field. Users can wait for the environment to start by
  1056. // polling
  1057. // this operation via GetOperation. Once the environment has finished
  1058. // starting
  1059. // and is ready to accept connections, the operation will contain
  1060. // a
  1061. // StartEnvironmentResponse in its response field.
  1062. func (r *UsersEnvironmentsService) Start(name string, startenvironmentrequest *StartEnvironmentRequest) *UsersEnvironmentsStartCall {
  1063. c := &UsersEnvironmentsStartCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1064. c.name = name
  1065. c.startenvironmentrequest = startenvironmentrequest
  1066. return c
  1067. }
  1068. // Fields allows partial responses to be retrieved. See
  1069. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1070. // for more information.
  1071. func (c *UsersEnvironmentsStartCall) Fields(s ...googleapi.Field) *UsersEnvironmentsStartCall {
  1072. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1073. return c
  1074. }
  1075. // Context sets the context to be used in this call's Do method. Any
  1076. // pending HTTP request will be aborted if the provided context is
  1077. // canceled.
  1078. func (c *UsersEnvironmentsStartCall) Context(ctx context.Context) *UsersEnvironmentsStartCall {
  1079. c.ctx_ = ctx
  1080. return c
  1081. }
  1082. // Header returns an http.Header that can be modified by the caller to
  1083. // add HTTP headers to the request.
  1084. func (c *UsersEnvironmentsStartCall) Header() http.Header {
  1085. if c.header_ == nil {
  1086. c.header_ = make(http.Header)
  1087. }
  1088. return c.header_
  1089. }
  1090. func (c *UsersEnvironmentsStartCall) doRequest(alt string) (*http.Response, error) {
  1091. reqHeaders := make(http.Header)
  1092. for k, v := range c.header_ {
  1093. reqHeaders[k] = v
  1094. }
  1095. reqHeaders.Set("User-Agent", c.s.userAgent())
  1096. var body io.Reader = nil
  1097. body, err := googleapi.WithoutDataWrapper.JSONReader(c.startenvironmentrequest)
  1098. if err != nil {
  1099. return nil, err
  1100. }
  1101. reqHeaders.Set("Content-Type", "application/json")
  1102. c.urlParams_.Set("alt", alt)
  1103. c.urlParams_.Set("prettyPrint", "false")
  1104. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}:start")
  1105. urls += "?" + c.urlParams_.Encode()
  1106. req, err := http.NewRequest("POST", urls, body)
  1107. if err != nil {
  1108. return nil, err
  1109. }
  1110. req.Header = reqHeaders
  1111. googleapi.Expand(req.URL, map[string]string{
  1112. "name": c.name,
  1113. })
  1114. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1115. }
  1116. // Do executes the "cloudshell.users.environments.start" call.
  1117. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1118. // status code is an error. Response headers are in either
  1119. // *Operation.ServerResponse.Header or (if a response was returned at
  1120. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1121. // to check whether the returned error was because
  1122. // http.StatusNotModified was returned.
  1123. func (c *UsersEnvironmentsStartCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1124. gensupport.SetOptions(c.urlParams_, opts...)
  1125. res, err := c.doRequest("json")
  1126. if res != nil && res.StatusCode == http.StatusNotModified {
  1127. if res.Body != nil {
  1128. res.Body.Close()
  1129. }
  1130. return nil, &googleapi.Error{
  1131. Code: res.StatusCode,
  1132. Header: res.Header,
  1133. }
  1134. }
  1135. if err != nil {
  1136. return nil, err
  1137. }
  1138. defer googleapi.CloseBody(res)
  1139. if err := googleapi.CheckResponse(res); err != nil {
  1140. return nil, err
  1141. }
  1142. ret := &Operation{
  1143. ServerResponse: googleapi.ServerResponse{
  1144. Header: res.Header,
  1145. HTTPStatusCode: res.StatusCode,
  1146. },
  1147. }
  1148. target := &ret
  1149. if err := gensupport.DecodeResponse(target, res); err != nil {
  1150. return nil, err
  1151. }
  1152. return ret, nil
  1153. // {
  1154. // "description": "Starts an existing environment, allowing clients to connect to it. The\nreturned operation will contain an instance of StartEnvironmentMetadata in\nits metadata field. Users can wait for the environment to start by polling\nthis operation via GetOperation. Once the environment has finished starting\nand is ready to accept connections, the operation will contain a\nStartEnvironmentResponse in its response field.",
  1155. // "flatPath": "v1alpha1/users/{usersId}/environments/{environmentsId}:start",
  1156. // "httpMethod": "POST",
  1157. // "id": "cloudshell.users.environments.start",
  1158. // "parameterOrder": [
  1159. // "name"
  1160. // ],
  1161. // "parameters": {
  1162. // "name": {
  1163. // "description": "Name of the resource that should be started, for example\n`users/me/environments/default` or\n`users/someone@example.com/environments/default`.",
  1164. // "location": "path",
  1165. // "pattern": "^users/[^/]+/environments/[^/]+$",
  1166. // "required": true,
  1167. // "type": "string"
  1168. // }
  1169. // },
  1170. // "path": "v1alpha1/{+name}:start",
  1171. // "request": {
  1172. // "$ref": "StartEnvironmentRequest"
  1173. // },
  1174. // "response": {
  1175. // "$ref": "Operation"
  1176. // },
  1177. // "scopes": [
  1178. // "https://www.googleapis.com/auth/cloud-platform"
  1179. // ]
  1180. // }
  1181. }
  1182. // method id "cloudshell.users.environments.publicKeys.create":
  1183. type UsersEnvironmentsPublicKeysCreateCall struct {
  1184. s *Service
  1185. parent string
  1186. createpublickeyrequest *CreatePublicKeyRequest
  1187. urlParams_ gensupport.URLParams
  1188. ctx_ context.Context
  1189. header_ http.Header
  1190. }
  1191. // Create: Adds a public SSH key to an environment, allowing clients
  1192. // with the
  1193. // corresponding private key to connect to that environment via SSH. If
  1194. // a key
  1195. // with the same format and content already exists, this will return
  1196. // the
  1197. // existing key.
  1198. func (r *UsersEnvironmentsPublicKeysService) Create(parent string, createpublickeyrequest *CreatePublicKeyRequest) *UsersEnvironmentsPublicKeysCreateCall {
  1199. c := &UsersEnvironmentsPublicKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1200. c.parent = parent
  1201. c.createpublickeyrequest = createpublickeyrequest
  1202. return c
  1203. }
  1204. // Fields allows partial responses to be retrieved. See
  1205. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1206. // for more information.
  1207. func (c *UsersEnvironmentsPublicKeysCreateCall) Fields(s ...googleapi.Field) *UsersEnvironmentsPublicKeysCreateCall {
  1208. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1209. return c
  1210. }
  1211. // Context sets the context to be used in this call's Do method. Any
  1212. // pending HTTP request will be aborted if the provided context is
  1213. // canceled.
  1214. func (c *UsersEnvironmentsPublicKeysCreateCall) Context(ctx context.Context) *UsersEnvironmentsPublicKeysCreateCall {
  1215. c.ctx_ = ctx
  1216. return c
  1217. }
  1218. // Header returns an http.Header that can be modified by the caller to
  1219. // add HTTP headers to the request.
  1220. func (c *UsersEnvironmentsPublicKeysCreateCall) Header() http.Header {
  1221. if c.header_ == nil {
  1222. c.header_ = make(http.Header)
  1223. }
  1224. return c.header_
  1225. }
  1226. func (c *UsersEnvironmentsPublicKeysCreateCall) doRequest(alt string) (*http.Response, error) {
  1227. reqHeaders := make(http.Header)
  1228. for k, v := range c.header_ {
  1229. reqHeaders[k] = v
  1230. }
  1231. reqHeaders.Set("User-Agent", c.s.userAgent())
  1232. var body io.Reader = nil
  1233. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createpublickeyrequest)
  1234. if err != nil {
  1235. return nil, err
  1236. }
  1237. reqHeaders.Set("Content-Type", "application/json")
  1238. c.urlParams_.Set("alt", alt)
  1239. c.urlParams_.Set("prettyPrint", "false")
  1240. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+parent}/publicKeys")
  1241. urls += "?" + c.urlParams_.Encode()
  1242. req, err := http.NewRequest("POST", urls, body)
  1243. if err != nil {
  1244. return nil, err
  1245. }
  1246. req.Header = reqHeaders
  1247. googleapi.Expand(req.URL, map[string]string{
  1248. "parent": c.parent,
  1249. })
  1250. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1251. }
  1252. // Do executes the "cloudshell.users.environments.publicKeys.create" call.
  1253. // Exactly one of *PublicKey or error will be non-nil. Any non-2xx
  1254. // status code is an error. Response headers are in either
  1255. // *PublicKey.ServerResponse.Header or (if a response was returned at
  1256. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1257. // to check whether the returned error was because
  1258. // http.StatusNotModified was returned.
  1259. func (c *UsersEnvironmentsPublicKeysCreateCall) Do(opts ...googleapi.CallOption) (*PublicKey, error) {
  1260. gensupport.SetOptions(c.urlParams_, opts...)
  1261. res, err := c.doRequest("json")
  1262. if res != nil && res.StatusCode == http.StatusNotModified {
  1263. if res.Body != nil {
  1264. res.Body.Close()
  1265. }
  1266. return nil, &googleapi.Error{
  1267. Code: res.StatusCode,
  1268. Header: res.Header,
  1269. }
  1270. }
  1271. if err != nil {
  1272. return nil, err
  1273. }
  1274. defer googleapi.CloseBody(res)
  1275. if err := googleapi.CheckResponse(res); err != nil {
  1276. return nil, err
  1277. }
  1278. ret := &PublicKey{
  1279. ServerResponse: googleapi.ServerResponse{
  1280. Header: res.Header,
  1281. HTTPStatusCode: res.StatusCode,
  1282. },
  1283. }
  1284. target := &ret
  1285. if err := gensupport.DecodeResponse(target, res); err != nil {
  1286. return nil, err
  1287. }
  1288. return ret, nil
  1289. // {
  1290. // "description": "Adds a public SSH key to an environment, allowing clients with the\ncorresponding private key to connect to that environment via SSH. If a key\nwith the same format and content already exists, this will return the\nexisting key.",
  1291. // "flatPath": "v1alpha1/users/{usersId}/environments/{environmentsId}/publicKeys",
  1292. // "httpMethod": "POST",
  1293. // "id": "cloudshell.users.environments.publicKeys.create",
  1294. // "parameterOrder": [
  1295. // "parent"
  1296. // ],
  1297. // "parameters": {
  1298. // "parent": {
  1299. // "description": "Parent resource name, e.g. `users/me/environments/default`.",
  1300. // "location": "path",
  1301. // "pattern": "^users/[^/]+/environments/[^/]+$",
  1302. // "required": true,
  1303. // "type": "string"
  1304. // }
  1305. // },
  1306. // "path": "v1alpha1/{+parent}/publicKeys",
  1307. // "request": {
  1308. // "$ref": "CreatePublicKeyRequest"
  1309. // },
  1310. // "response": {
  1311. // "$ref": "PublicKey"
  1312. // },
  1313. // "scopes": [
  1314. // "https://www.googleapis.com/auth/cloud-platform"
  1315. // ]
  1316. // }
  1317. }
  1318. // method id "cloudshell.users.environments.publicKeys.delete":
  1319. type UsersEnvironmentsPublicKeysDeleteCall struct {
  1320. s *Service
  1321. name string
  1322. urlParams_ gensupport.URLParams
  1323. ctx_ context.Context
  1324. header_ http.Header
  1325. }
  1326. // Delete: Removes a public SSH key from an environment. Clients will no
  1327. // longer be
  1328. // able to connect to the environment using the corresponding private
  1329. // key.
  1330. func (r *UsersEnvironmentsPublicKeysService) Delete(name string) *UsersEnvironmentsPublicKeysDeleteCall {
  1331. c := &UsersEnvironmentsPublicKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1332. c.name = name
  1333. return c
  1334. }
  1335. // Fields allows partial responses to be retrieved. See
  1336. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1337. // for more information.
  1338. func (c *UsersEnvironmentsPublicKeysDeleteCall) Fields(s ...googleapi.Field) *UsersEnvironmentsPublicKeysDeleteCall {
  1339. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1340. return c
  1341. }
  1342. // Context sets the context to be used in this call's Do method. Any
  1343. // pending HTTP request will be aborted if the provided context is
  1344. // canceled.
  1345. func (c *UsersEnvironmentsPublicKeysDeleteCall) Context(ctx context.Context) *UsersEnvironmentsPublicKeysDeleteCall {
  1346. c.ctx_ = ctx
  1347. return c
  1348. }
  1349. // Header returns an http.Header that can be modified by the caller to
  1350. // add HTTP headers to the request.
  1351. func (c *UsersEnvironmentsPublicKeysDeleteCall) Header() http.Header {
  1352. if c.header_ == nil {
  1353. c.header_ = make(http.Header)
  1354. }
  1355. return c.header_
  1356. }
  1357. func (c *UsersEnvironmentsPublicKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
  1358. reqHeaders := make(http.Header)
  1359. for k, v := range c.header_ {
  1360. reqHeaders[k] = v
  1361. }
  1362. reqHeaders.Set("User-Agent", c.s.userAgent())
  1363. var body io.Reader = nil
  1364. c.urlParams_.Set("alt", alt)
  1365. c.urlParams_.Set("prettyPrint", "false")
  1366. urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha1/{+name}")
  1367. urls += "?" + c.urlParams_.Encode()
  1368. req, err := http.NewRequest("DELETE", urls, body)
  1369. if err != nil {
  1370. return nil, err
  1371. }
  1372. req.Header = reqHeaders
  1373. googleapi.Expand(req.URL, map[string]string{
  1374. "name": c.name,
  1375. })
  1376. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1377. }
  1378. // Do executes the "cloudshell.users.environments.publicKeys.delete" call.
  1379. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1380. // code is an error. Response headers are in either
  1381. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1382. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1383. // check whether the returned error was because http.StatusNotModified
  1384. // was returned.
  1385. func (c *UsersEnvironmentsPublicKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1386. gensupport.SetOptions(c.urlParams_, opts...)
  1387. res, err := c.doRequest("json")
  1388. if res != nil && res.StatusCode == http.StatusNotModified {
  1389. if res.Body != nil {
  1390. res.Body.Close()
  1391. }
  1392. return nil, &googleapi.Error{
  1393. Code: res.StatusCode,
  1394. Header: res.Header,
  1395. }
  1396. }
  1397. if err != nil {
  1398. return nil, err
  1399. }
  1400. defer googleapi.CloseBody(res)
  1401. if err := googleapi.CheckResponse(res); err != nil {
  1402. return nil, err
  1403. }
  1404. ret := &Empty{
  1405. ServerResponse: googleapi.ServerResponse{
  1406. Header: res.Header,
  1407. HTTPStatusCode: res.StatusCode,
  1408. },
  1409. }
  1410. target := &ret
  1411. if err := gensupport.DecodeResponse(target, res); err != nil {
  1412. return nil, err
  1413. }
  1414. return ret, nil
  1415. // {
  1416. // "description": "Removes a public SSH key from an environment. Clients will no longer be\nable to connect to the environment using the corresponding private key.",
  1417. // "flatPath": "v1alpha1/users/{usersId}/environments/{environmentsId}/publicKeys/{publicKeysId}",
  1418. // "httpMethod": "DELETE",
  1419. // "id": "cloudshell.users.environments.publicKeys.delete",
  1420. // "parameterOrder": [
  1421. // "name"
  1422. // ],
  1423. // "parameters": {
  1424. // "name": {
  1425. // "description": "Name of the resource to be deleted, e.g.\n`users/me/environments/default/publicKeys/my-key`.",
  1426. // "location": "path",
  1427. // "pattern": "^users/[^/]+/environments/[^/]+/publicKeys/[^/]+$",
  1428. // "required": true,
  1429. // "type": "string"
  1430. // }
  1431. // },
  1432. // "path": "v1alpha1/{+name}",
  1433. // "response": {
  1434. // "$ref": "Empty"
  1435. // },
  1436. // "scopes": [
  1437. // "https://www.googleapis.com/auth/cloud-platform"
  1438. // ]
  1439. // }
  1440. }