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