...

Source file src/google.golang.org/api/cloudshell/v1alpha1/cloudshell-gen.go

Documentation: google.golang.org/api/cloudshell/v1alpha1

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

View as plain text