...

Source file src/google.golang.org/api/oslogin/v1alpha/oslogin-gen.go

Documentation: google.golang.org/api/oslogin/v1alpha

     1  // Copyright 2024 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 oslogin provides access to the Cloud OS Login API.
     8  //
     9  // This package is DEPRECATED. Use package cloud.google.com/go/oslogin/apiv1 instead.
    10  //
    11  // For product documentation, see: https://cloud.google.com/compute/docs/oslogin/
    12  //
    13  // # Library status
    14  //
    15  // These client libraries are officially supported by Google. However, this
    16  // library is considered complete and is in maintenance mode. This means
    17  // that we will address critical bugs and security issues but will not add
    18  // any new features.
    19  //
    20  // When possible, we recommend using our newer
    21  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    22  // that are still actively being worked and iterated on.
    23  //
    24  // # Creating a client
    25  //
    26  // Usage example:
    27  //
    28  //	import "google.golang.org/api/oslogin/v1alpha"
    29  //	...
    30  //	ctx := context.Background()
    31  //	osloginService, err := oslogin.NewService(ctx)
    32  //
    33  // In this example, Google Application Default Credentials are used for
    34  // authentication. For information on how to create and obtain Application
    35  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    36  //
    37  // # Other authentication options
    38  //
    39  // By default, all available scopes (see "Constants") are used to authenticate.
    40  // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
    41  //
    42  //	osloginService, err := oslogin.NewService(ctx, option.WithScopes(oslogin.ComputeReadonlyScope))
    43  //
    44  // To use an API key for authentication (note: some APIs do not support API
    45  // keys), use [google.golang.org/api/option.WithAPIKey]:
    46  //
    47  //	osloginService, err := oslogin.NewService(ctx, option.WithAPIKey("AIza..."))
    48  //
    49  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    50  // flow, use [google.golang.org/api/option.WithTokenSource]:
    51  //
    52  //	config := &oauth2.Config{...}
    53  //	// ...
    54  //	token, err := config.Exchange(ctx, ...)
    55  //	osloginService, err := oslogin.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    56  //
    57  // See [google.golang.org/api/option.ClientOption] for details on options.
    58  package oslogin // import "google.golang.org/api/oslogin/v1alpha"
    59  
    60  import (
    61  	"bytes"
    62  	"context"
    63  	"encoding/json"
    64  	"errors"
    65  	"fmt"
    66  	"io"
    67  	"net/http"
    68  	"net/url"
    69  	"strconv"
    70  	"strings"
    71  
    72  	googleapi "google.golang.org/api/googleapi"
    73  	internal "google.golang.org/api/internal"
    74  	gensupport "google.golang.org/api/internal/gensupport"
    75  	option "google.golang.org/api/option"
    76  	internaloption "google.golang.org/api/option/internaloption"
    77  	htransport "google.golang.org/api/transport/http"
    78  )
    79  
    80  // Always reference these packages, just in case the auto-generated code
    81  // below doesn't.
    82  var _ = bytes.NewBuffer
    83  var _ = strconv.Itoa
    84  var _ = fmt.Sprintf
    85  var _ = json.NewDecoder
    86  var _ = io.Copy
    87  var _ = url.Parse
    88  var _ = gensupport.MarshalJSON
    89  var _ = googleapi.Version
    90  var _ = errors.New
    91  var _ = strings.Replace
    92  var _ = context.Canceled
    93  var _ = internaloption.WithDefaultEndpoint
    94  var _ = internal.Version
    95  
    96  const apiId = "oslogin:v1alpha"
    97  const apiName = "oslogin"
    98  const apiVersion = "v1alpha"
    99  const basePath = "https://oslogin.googleapis.com/"
   100  const basePathTemplate = "https://oslogin.UNIVERSE_DOMAIN/"
   101  const mtlsBasePath = "https://oslogin.mtls.googleapis.com/"
   102  
   103  // OAuth2 scopes used by this API.
   104  const (
   105  	// See, edit, configure, and delete your Google Cloud data and see the email
   106  	// address for your Google Account.
   107  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
   108  
   109  	// View your data across Google Cloud services and see the email address of
   110  	// your Google Account
   111  	CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
   112  
   113  	// View and manage your Google Compute Engine resources
   114  	ComputeScope = "https://www.googleapis.com/auth/compute"
   115  
   116  	// View your Google Compute Engine resources
   117  	ComputeReadonlyScope = "https://www.googleapis.com/auth/compute.readonly"
   118  )
   119  
   120  // NewService creates a new Service.
   121  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   122  	scopesOption := internaloption.WithDefaultScopes(
   123  		"https://www.googleapis.com/auth/cloud-platform",
   124  		"https://www.googleapis.com/auth/cloud-platform.read-only",
   125  		"https://www.googleapis.com/auth/compute",
   126  		"https://www.googleapis.com/auth/compute.readonly",
   127  	)
   128  	// NOTE: prepend, so we don't override user-specified scopes.
   129  	opts = append([]option.ClientOption{scopesOption}, opts...)
   130  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   131  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   132  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   133  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   134  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	s, err := New(client)
   139  	if err != nil {
   140  		return nil, err
   141  	}
   142  	if endpoint != "" {
   143  		s.BasePath = endpoint
   144  	}
   145  	return s, nil
   146  }
   147  
   148  // New creates a new Service. It uses the provided http.Client for requests.
   149  //
   150  // Deprecated: please use NewService instead.
   151  // To provide a custom HTTP client, use option.WithHTTPClient.
   152  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   153  func New(client *http.Client) (*Service, error) {
   154  	if client == nil {
   155  		return nil, errors.New("client is nil")
   156  	}
   157  	s := &Service{client: client, BasePath: basePath}
   158  	s.Users = NewUsersService(s)
   159  	return s, nil
   160  }
   161  
   162  type Service struct {
   163  	client    *http.Client
   164  	BasePath  string // API endpoint base URL
   165  	UserAgent string // optional additional User-Agent fragment
   166  
   167  	Users *UsersService
   168  }
   169  
   170  func (s *Service) userAgent() string {
   171  	if s.UserAgent == "" {
   172  		return googleapi.UserAgent
   173  	}
   174  	return googleapi.UserAgent + " " + s.UserAgent
   175  }
   176  
   177  func NewUsersService(s *Service) *UsersService {
   178  	rs := &UsersService{s: s}
   179  	rs.Projects = NewUsersProjectsService(s)
   180  	rs.SshPublicKeys = NewUsersSshPublicKeysService(s)
   181  	return rs
   182  }
   183  
   184  type UsersService struct {
   185  	s *Service
   186  
   187  	Projects *UsersProjectsService
   188  
   189  	SshPublicKeys *UsersSshPublicKeysService
   190  }
   191  
   192  func NewUsersProjectsService(s *Service) *UsersProjectsService {
   193  	rs := &UsersProjectsService{s: s}
   194  	rs.Locations = NewUsersProjectsLocationsService(s)
   195  	rs.Zones = NewUsersProjectsZonesService(s)
   196  	return rs
   197  }
   198  
   199  type UsersProjectsService struct {
   200  	s *Service
   201  
   202  	Locations *UsersProjectsLocationsService
   203  
   204  	Zones *UsersProjectsZonesService
   205  }
   206  
   207  func NewUsersProjectsLocationsService(s *Service) *UsersProjectsLocationsService {
   208  	rs := &UsersProjectsLocationsService{s: s}
   209  	return rs
   210  }
   211  
   212  type UsersProjectsLocationsService struct {
   213  	s *Service
   214  }
   215  
   216  func NewUsersProjectsZonesService(s *Service) *UsersProjectsZonesService {
   217  	rs := &UsersProjectsZonesService{s: s}
   218  	return rs
   219  }
   220  
   221  type UsersProjectsZonesService struct {
   222  	s *Service
   223  }
   224  
   225  func NewUsersSshPublicKeysService(s *Service) *UsersSshPublicKeysService {
   226  	rs := &UsersSshPublicKeysService{s: s}
   227  	return rs
   228  }
   229  
   230  type UsersSshPublicKeysService struct {
   231  	s *Service
   232  }
   233  
   234  // Empty: A generic empty message that you can re-use to avoid defining
   235  // duplicated empty messages in your APIs. A typical example is to use it as
   236  // the request or the response type of an API method. For instance: service Foo
   237  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   238  type Empty struct {
   239  	// ServerResponse contains the HTTP response code and headers from the server.
   240  	googleapi.ServerResponse `json:"-"`
   241  }
   242  
   243  // ImportSshPublicKeyResponse: A response message for importing an SSH public
   244  // key.
   245  type ImportSshPublicKeyResponse struct {
   246  	// Details: Detailed information about import results.
   247  	Details string `json:"details,omitempty"`
   248  	// LoginProfile: The login profile information for the user.
   249  	LoginProfile *LoginProfile `json:"loginProfile,omitempty"`
   250  
   251  	// ServerResponse contains the HTTP response code and headers from the server.
   252  	googleapi.ServerResponse `json:"-"`
   253  	// ForceSendFields is a list of field names (e.g. "Details") to unconditionally
   254  	// include in API requests. By default, fields with empty or default values are
   255  	// omitted from API requests. See
   256  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   257  	// details.
   258  	ForceSendFields []string `json:"-"`
   259  	// NullFields is a list of field names (e.g. "Details") to include in API
   260  	// requests with the JSON null value. By default, fields with empty values are
   261  	// omitted from API requests. See
   262  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   263  	NullFields []string `json:"-"`
   264  }
   265  
   266  func (s *ImportSshPublicKeyResponse) MarshalJSON() ([]byte, error) {
   267  	type NoMethod ImportSshPublicKeyResponse
   268  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   269  }
   270  
   271  // LoginProfile: The user profile information used for logging in to a virtual
   272  // machine on Google Compute Engine.
   273  type LoginProfile struct {
   274  	// Name: Required. A unique user ID.
   275  	Name string `json:"name,omitempty"`
   276  	// PosixAccounts: The list of POSIX accounts associated with the user.
   277  	PosixAccounts []*PosixAccount `json:"posixAccounts,omitempty"`
   278  	// SecurityKeys: The registered security key credentials for a user.
   279  	SecurityKeys []*SecurityKey `json:"securityKeys,omitempty"`
   280  	// SshPublicKeys: A map from SSH public key fingerprint to the associated key
   281  	// object.
   282  	SshPublicKeys map[string]SshPublicKey `json:"sshPublicKeys,omitempty"`
   283  
   284  	// ServerResponse contains the HTTP response code and headers from the server.
   285  	googleapi.ServerResponse `json:"-"`
   286  	// ForceSendFields is a list of field names (e.g. "Name") to unconditionally
   287  	// include in API requests. By default, fields with empty or default values are
   288  	// omitted from API requests. See
   289  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   290  	// details.
   291  	ForceSendFields []string `json:"-"`
   292  	// NullFields is a list of field names (e.g. "Name") to include in API requests
   293  	// with the JSON null value. By default, fields with empty values are omitted
   294  	// from API requests. See
   295  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   296  	NullFields []string `json:"-"`
   297  }
   298  
   299  func (s *LoginProfile) MarshalJSON() ([]byte, error) {
   300  	type NoMethod LoginProfile
   301  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   302  }
   303  
   304  // PosixAccount: The POSIX account information associated with a Google
   305  // account.
   306  type PosixAccount struct {
   307  	// AccountId: Output only. A POSIX account identifier.
   308  	AccountId string `json:"accountId,omitempty"`
   309  	// Gecos: The GECOS (user information) entry for this account.
   310  	Gecos string `json:"gecos,omitempty"`
   311  	// Gid: The default group ID.
   312  	Gid int64 `json:"gid,omitempty,string"`
   313  	// HomeDirectory: The path to the home directory for this account.
   314  	HomeDirectory string `json:"homeDirectory,omitempty"`
   315  	// Name: Output only. The canonical resource name.
   316  	Name string `json:"name,omitempty"`
   317  	// OperatingSystemType: The operating system type where this account applies.
   318  	//
   319  	// Possible values:
   320  	//   "OPERATING_SYSTEM_TYPE_UNSPECIFIED" - The operating system type associated
   321  	// with the user account information is unspecified.
   322  	//   "LINUX" - Linux user account information.
   323  	//   "WINDOWS" - Windows user account information.
   324  	OperatingSystemType string `json:"operatingSystemType,omitempty"`
   325  	// Primary: Only one POSIX account can be marked as primary.
   326  	Primary bool `json:"primary,omitempty"`
   327  	// Shell: The path to the logic shell for this account.
   328  	Shell string `json:"shell,omitempty"`
   329  	// SystemId: System identifier for which account the username or uid applies
   330  	// to. By default, the empty value is used.
   331  	SystemId string `json:"systemId,omitempty"`
   332  	// Uid: The user ID.
   333  	Uid int64 `json:"uid,omitempty,string"`
   334  	// Username: The username of the POSIX account.
   335  	Username string `json:"username,omitempty"`
   336  	// ForceSendFields is a list of field names (e.g. "AccountId") to
   337  	// unconditionally include in API requests. By default, fields with empty or
   338  	// default values are omitted from API requests. See
   339  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   340  	// details.
   341  	ForceSendFields []string `json:"-"`
   342  	// NullFields is a list of field names (e.g. "AccountId") to include in API
   343  	// requests with the JSON null value. By default, fields with empty values are
   344  	// omitted from API requests. See
   345  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   346  	NullFields []string `json:"-"`
   347  }
   348  
   349  func (s *PosixAccount) MarshalJSON() ([]byte, error) {
   350  	type NoMethod PosixAccount
   351  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   352  }
   353  
   354  // SecurityKey: The credential information for a Google registered security
   355  // key.
   356  type SecurityKey struct {
   357  	// DeviceNickname: The security key nickname explicitly set by the user.
   358  	DeviceNickname string `json:"deviceNickname,omitempty"`
   359  	// PrivateKey: Hardware-backed private key text in SSH format.
   360  	PrivateKey string `json:"privateKey,omitempty"`
   361  	// PublicKey: Public key text in SSH format, defined by RFC4253
   362  	// ("https://www.ietf.org/rfc/rfc4253.txt") section 6.6.
   363  	PublicKey string `json:"publicKey,omitempty"`
   364  	// UniversalTwoFactor: The U2F protocol type.
   365  	UniversalTwoFactor *UniversalTwoFactor `json:"universalTwoFactor,omitempty"`
   366  	// WebAuthn: The Web Authentication protocol type.
   367  	WebAuthn *WebAuthn `json:"webAuthn,omitempty"`
   368  	// ForceSendFields is a list of field names (e.g. "DeviceNickname") to
   369  	// unconditionally include in API requests. By default, fields with empty or
   370  	// default values are omitted from API requests. See
   371  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   372  	// details.
   373  	ForceSendFields []string `json:"-"`
   374  	// NullFields is a list of field names (e.g. "DeviceNickname") to include in
   375  	// API requests with the JSON null value. By default, fields with empty values
   376  	// are omitted from API requests. See
   377  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   378  	NullFields []string `json:"-"`
   379  }
   380  
   381  func (s *SecurityKey) MarshalJSON() ([]byte, error) {
   382  	type NoMethod SecurityKey
   383  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   384  }
   385  
   386  type SignSshPublicKeyRequest struct {
   387  	// SshPublicKey: The SSH public key to sign.
   388  	SshPublicKey string `json:"sshPublicKey,omitempty"`
   389  	// ForceSendFields is a list of field names (e.g. "SshPublicKey") to
   390  	// unconditionally include in API requests. By default, fields with empty or
   391  	// default values are omitted from API requests. See
   392  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   393  	// details.
   394  	ForceSendFields []string `json:"-"`
   395  	// NullFields is a list of field names (e.g. "SshPublicKey") to include in API
   396  	// requests with the JSON null value. By default, fields with empty values are
   397  	// omitted from API requests. See
   398  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   399  	NullFields []string `json:"-"`
   400  }
   401  
   402  func (s *SignSshPublicKeyRequest) MarshalJSON() ([]byte, error) {
   403  	type NoMethod SignSshPublicKeyRequest
   404  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   405  }
   406  
   407  type SignSshPublicKeyResponse struct {
   408  	// SignedSshPublicKey: The signed SSH public key to use in the SSH handshake.
   409  	SignedSshPublicKey string `json:"signedSshPublicKey,omitempty"`
   410  
   411  	// ServerResponse contains the HTTP response code and headers from the server.
   412  	googleapi.ServerResponse `json:"-"`
   413  	// ForceSendFields is a list of field names (e.g. "SignedSshPublicKey") to
   414  	// unconditionally include in API requests. By default, fields with empty or
   415  	// default values are omitted from API requests. See
   416  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   417  	// details.
   418  	ForceSendFields []string `json:"-"`
   419  	// NullFields is a list of field names (e.g. "SignedSshPublicKey") to include
   420  	// in API requests with the JSON null value. By default, fields with empty
   421  	// values are omitted from API requests. See
   422  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   423  	NullFields []string `json:"-"`
   424  }
   425  
   426  func (s *SignSshPublicKeyResponse) MarshalJSON() ([]byte, error) {
   427  	type NoMethod SignSshPublicKeyResponse
   428  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   429  }
   430  
   431  // SshPublicKey: The SSH public key information associated with a Google
   432  // account.
   433  type SshPublicKey struct {
   434  	// ExpirationTimeUsec: An expiration time in microseconds since epoch.
   435  	ExpirationTimeUsec int64 `json:"expirationTimeUsec,omitempty,string"`
   436  	// Fingerprint: Output only. The SHA-256 fingerprint of the SSH public key.
   437  	Fingerprint string `json:"fingerprint,omitempty"`
   438  	// Key: Public key text in SSH format, defined by RFC4253 section 6.6.
   439  	Key string `json:"key,omitempty"`
   440  	// Name: Output only. The canonical resource name.
   441  	Name string `json:"name,omitempty"`
   442  
   443  	// ServerResponse contains the HTTP response code and headers from the server.
   444  	googleapi.ServerResponse `json:"-"`
   445  	// ForceSendFields is a list of field names (e.g. "ExpirationTimeUsec") to
   446  	// unconditionally include in API requests. By default, fields with empty or
   447  	// default values are omitted from API requests. See
   448  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   449  	// details.
   450  	ForceSendFields []string `json:"-"`
   451  	// NullFields is a list of field names (e.g. "ExpirationTimeUsec") to include
   452  	// in API requests with the JSON null value. By default, fields with empty
   453  	// values are omitted from API requests. See
   454  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   455  	NullFields []string `json:"-"`
   456  }
   457  
   458  func (s *SshPublicKey) MarshalJSON() ([]byte, error) {
   459  	type NoMethod SshPublicKey
   460  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   461  }
   462  
   463  // UniversalTwoFactor: Security key information specific to the U2F protocol.
   464  type UniversalTwoFactor struct {
   465  	// AppId: Application ID for the U2F protocol.
   466  	AppId string `json:"appId,omitempty"`
   467  	// ForceSendFields is a list of field names (e.g. "AppId") to unconditionally
   468  	// include in API requests. By default, fields with empty or default values are
   469  	// omitted from API requests. See
   470  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   471  	// details.
   472  	ForceSendFields []string `json:"-"`
   473  	// NullFields is a list of field names (e.g. "AppId") to include in API
   474  	// requests with the JSON null value. By default, fields with empty values are
   475  	// omitted from API requests. See
   476  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   477  	NullFields []string `json:"-"`
   478  }
   479  
   480  func (s *UniversalTwoFactor) MarshalJSON() ([]byte, error) {
   481  	type NoMethod UniversalTwoFactor
   482  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   483  }
   484  
   485  // WebAuthn: Security key information specific to the Web Authentication
   486  // protocol.
   487  type WebAuthn struct {
   488  	// RpId: Relying party ID for Web Authentication.
   489  	RpId string `json:"rpId,omitempty"`
   490  	// ForceSendFields is a list of field names (e.g. "RpId") to unconditionally
   491  	// include in API requests. By default, fields with empty or default values are
   492  	// omitted from API requests. See
   493  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   494  	// details.
   495  	ForceSendFields []string `json:"-"`
   496  	// NullFields is a list of field names (e.g. "RpId") to include in API requests
   497  	// with the JSON null value. By default, fields with empty values are omitted
   498  	// from API requests. See
   499  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   500  	NullFields []string `json:"-"`
   501  }
   502  
   503  func (s *WebAuthn) MarshalJSON() ([]byte, error) {
   504  	type NoMethod WebAuthn
   505  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   506  }
   507  
   508  type UsersGetLoginProfileCall struct {
   509  	s            *Service
   510  	name         string
   511  	urlParams_   gensupport.URLParams
   512  	ifNoneMatch_ string
   513  	ctx_         context.Context
   514  	header_      http.Header
   515  }
   516  
   517  // GetLoginProfile: Retrieves the profile information used for logging in to a
   518  // virtual machine on Google Compute Engine.
   519  //
   520  // - name: The unique ID for the user in format `users/{user}`.
   521  func (r *UsersService) GetLoginProfile(name string) *UsersGetLoginProfileCall {
   522  	c := &UsersGetLoginProfileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   523  	c.name = name
   524  	return c
   525  }
   526  
   527  // OperatingSystemType sets the optional parameter "operatingSystemType": The
   528  // type of operating system associated with the account.
   529  //
   530  // Possible values:
   531  //
   532  //	"OPERATING_SYSTEM_TYPE_UNSPECIFIED" - The operating system type associated
   533  //
   534  // with the user account information is unspecified.
   535  //
   536  //	"LINUX" - Linux user account information.
   537  //	"WINDOWS" - Windows user account information.
   538  func (c *UsersGetLoginProfileCall) OperatingSystemType(operatingSystemType string) *UsersGetLoginProfileCall {
   539  	c.urlParams_.Set("operatingSystemType", operatingSystemType)
   540  	return c
   541  }
   542  
   543  // ProjectId sets the optional parameter "projectId": The project ID of the
   544  // Google Cloud Platform project.
   545  func (c *UsersGetLoginProfileCall) ProjectId(projectId string) *UsersGetLoginProfileCall {
   546  	c.urlParams_.Set("projectId", projectId)
   547  	return c
   548  }
   549  
   550  // SystemId sets the optional parameter "systemId": A system ID for filtering
   551  // the results of the request.
   552  func (c *UsersGetLoginProfileCall) SystemId(systemId string) *UsersGetLoginProfileCall {
   553  	c.urlParams_.Set("systemId", systemId)
   554  	return c
   555  }
   556  
   557  // View sets the optional parameter "view": The view configures whether to
   558  // retrieve security keys information.
   559  //
   560  // Possible values:
   561  //
   562  //	"LOGIN_PROFILE_VIEW_UNSPECIFIED" - The default login profile view. The API
   563  //
   564  // defaults to the BASIC view.
   565  //
   566  //	"BASIC" - Includes POSIX and SSH key information.
   567  //	"SECURITY_KEY" - Include security key information for the user.
   568  func (c *UsersGetLoginProfileCall) View(view string) *UsersGetLoginProfileCall {
   569  	c.urlParams_.Set("view", view)
   570  	return c
   571  }
   572  
   573  // Fields allows partial responses to be retrieved. See
   574  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   575  // details.
   576  func (c *UsersGetLoginProfileCall) Fields(s ...googleapi.Field) *UsersGetLoginProfileCall {
   577  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   578  	return c
   579  }
   580  
   581  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   582  // object's ETag matches the given value. This is useful for getting updates
   583  // only after the object has changed since the last request.
   584  func (c *UsersGetLoginProfileCall) IfNoneMatch(entityTag string) *UsersGetLoginProfileCall {
   585  	c.ifNoneMatch_ = entityTag
   586  	return c
   587  }
   588  
   589  // Context sets the context to be used in this call's Do method.
   590  func (c *UsersGetLoginProfileCall) Context(ctx context.Context) *UsersGetLoginProfileCall {
   591  	c.ctx_ = ctx
   592  	return c
   593  }
   594  
   595  // Header returns a http.Header that can be modified by the caller to add
   596  // headers to the request.
   597  func (c *UsersGetLoginProfileCall) Header() http.Header {
   598  	if c.header_ == nil {
   599  		c.header_ = make(http.Header)
   600  	}
   601  	return c.header_
   602  }
   603  
   604  func (c *UsersGetLoginProfileCall) doRequest(alt string) (*http.Response, error) {
   605  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   606  	if c.ifNoneMatch_ != "" {
   607  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   608  	}
   609  	var body io.Reader = nil
   610  	c.urlParams_.Set("alt", alt)
   611  	c.urlParams_.Set("prettyPrint", "false")
   612  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}/loginProfile")
   613  	urls += "?" + c.urlParams_.Encode()
   614  	req, err := http.NewRequest("GET", urls, body)
   615  	if err != nil {
   616  		return nil, err
   617  	}
   618  	req.Header = reqHeaders
   619  	googleapi.Expand(req.URL, map[string]string{
   620  		"name": c.name,
   621  	})
   622  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   623  }
   624  
   625  // Do executes the "oslogin.users.getLoginProfile" call.
   626  // Any non-2xx status code is an error. Response headers are in either
   627  // *LoginProfile.ServerResponse.Header or (if a response was returned at all)
   628  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   629  // whether the returned error was because http.StatusNotModified was returned.
   630  func (c *UsersGetLoginProfileCall) Do(opts ...googleapi.CallOption) (*LoginProfile, error) {
   631  	gensupport.SetOptions(c.urlParams_, opts...)
   632  	res, err := c.doRequest("json")
   633  	if res != nil && res.StatusCode == http.StatusNotModified {
   634  		if res.Body != nil {
   635  			res.Body.Close()
   636  		}
   637  		return nil, gensupport.WrapError(&googleapi.Error{
   638  			Code:   res.StatusCode,
   639  			Header: res.Header,
   640  		})
   641  	}
   642  	if err != nil {
   643  		return nil, err
   644  	}
   645  	defer googleapi.CloseBody(res)
   646  	if err := googleapi.CheckResponse(res); err != nil {
   647  		return nil, gensupport.WrapError(err)
   648  	}
   649  	ret := &LoginProfile{
   650  		ServerResponse: googleapi.ServerResponse{
   651  			Header:         res.Header,
   652  			HTTPStatusCode: res.StatusCode,
   653  		},
   654  	}
   655  	target := &ret
   656  	if err := gensupport.DecodeResponse(target, res); err != nil {
   657  		return nil, err
   658  	}
   659  	return ret, nil
   660  }
   661  
   662  type UsersImportSshPublicKeyCall struct {
   663  	s            *Service
   664  	parent       string
   665  	sshpublickey *SshPublicKey
   666  	urlParams_   gensupport.URLParams
   667  	ctx_         context.Context
   668  	header_      http.Header
   669  }
   670  
   671  // ImportSshPublicKey: Adds an SSH public key and returns the profile
   672  // information. Default POSIX account information is set when no username and
   673  // UID exist as part of the login profile.
   674  //
   675  // - parent: The unique ID for the user in format `users/{user}`.
   676  func (r *UsersService) ImportSshPublicKey(parent string, sshpublickey *SshPublicKey) *UsersImportSshPublicKeyCall {
   677  	c := &UsersImportSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   678  	c.parent = parent
   679  	c.sshpublickey = sshpublickey
   680  	return c
   681  }
   682  
   683  // ProjectId sets the optional parameter "projectId": The project ID of the
   684  // Google Cloud Platform project.
   685  func (c *UsersImportSshPublicKeyCall) ProjectId(projectId string) *UsersImportSshPublicKeyCall {
   686  	c.urlParams_.Set("projectId", projectId)
   687  	return c
   688  }
   689  
   690  // Regions sets the optional parameter "regions": The regions to which to
   691  // assert that the key was written. If unspecified, defaults to all regions.
   692  // Regions are listed at https://cloud.google.com/about/locations#region.
   693  func (c *UsersImportSshPublicKeyCall) Regions(regions ...string) *UsersImportSshPublicKeyCall {
   694  	c.urlParams_.SetMulti("regions", append([]string{}, regions...))
   695  	return c
   696  }
   697  
   698  // View sets the optional parameter "view": The view configures whether to
   699  // retrieve security keys information.
   700  //
   701  // Possible values:
   702  //
   703  //	"LOGIN_PROFILE_VIEW_UNSPECIFIED" - The default login profile view. The API
   704  //
   705  // defaults to the BASIC view.
   706  //
   707  //	"BASIC" - Includes POSIX and SSH key information.
   708  //	"SECURITY_KEY" - Include security key information for the user.
   709  func (c *UsersImportSshPublicKeyCall) View(view string) *UsersImportSshPublicKeyCall {
   710  	c.urlParams_.Set("view", view)
   711  	return c
   712  }
   713  
   714  // Fields allows partial responses to be retrieved. See
   715  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   716  // details.
   717  func (c *UsersImportSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersImportSshPublicKeyCall {
   718  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   719  	return c
   720  }
   721  
   722  // Context sets the context to be used in this call's Do method.
   723  func (c *UsersImportSshPublicKeyCall) Context(ctx context.Context) *UsersImportSshPublicKeyCall {
   724  	c.ctx_ = ctx
   725  	return c
   726  }
   727  
   728  // Header returns a http.Header that can be modified by the caller to add
   729  // headers to the request.
   730  func (c *UsersImportSshPublicKeyCall) Header() http.Header {
   731  	if c.header_ == nil {
   732  		c.header_ = make(http.Header)
   733  	}
   734  	return c.header_
   735  }
   736  
   737  func (c *UsersImportSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
   738  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   739  	var body io.Reader = nil
   740  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
   741  	if err != nil {
   742  		return nil, err
   743  	}
   744  	c.urlParams_.Set("alt", alt)
   745  	c.urlParams_.Set("prettyPrint", "false")
   746  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}:importSshPublicKey")
   747  	urls += "?" + c.urlParams_.Encode()
   748  	req, err := http.NewRequest("POST", urls, body)
   749  	if err != nil {
   750  		return nil, err
   751  	}
   752  	req.Header = reqHeaders
   753  	googleapi.Expand(req.URL, map[string]string{
   754  		"parent": c.parent,
   755  	})
   756  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   757  }
   758  
   759  // Do executes the "oslogin.users.importSshPublicKey" call.
   760  // Any non-2xx status code is an error. Response headers are in either
   761  // *ImportSshPublicKeyResponse.ServerResponse.Header or (if a response was
   762  // returned at all) in error.(*googleapi.Error).Header. Use
   763  // googleapi.IsNotModified to check whether the returned error was because
   764  // http.StatusNotModified was returned.
   765  func (c *UsersImportSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*ImportSshPublicKeyResponse, error) {
   766  	gensupport.SetOptions(c.urlParams_, opts...)
   767  	res, err := c.doRequest("json")
   768  	if res != nil && res.StatusCode == http.StatusNotModified {
   769  		if res.Body != nil {
   770  			res.Body.Close()
   771  		}
   772  		return nil, gensupport.WrapError(&googleapi.Error{
   773  			Code:   res.StatusCode,
   774  			Header: res.Header,
   775  		})
   776  	}
   777  	if err != nil {
   778  		return nil, err
   779  	}
   780  	defer googleapi.CloseBody(res)
   781  	if err := googleapi.CheckResponse(res); err != nil {
   782  		return nil, gensupport.WrapError(err)
   783  	}
   784  	ret := &ImportSshPublicKeyResponse{
   785  		ServerResponse: googleapi.ServerResponse{
   786  			Header:         res.Header,
   787  			HTTPStatusCode: res.StatusCode,
   788  		},
   789  	}
   790  	target := &ret
   791  	if err := gensupport.DecodeResponse(target, res); err != nil {
   792  		return nil, err
   793  	}
   794  	return ret, nil
   795  }
   796  
   797  type UsersProjectsDeleteCall struct {
   798  	s          *Service
   799  	name       string
   800  	urlParams_ gensupport.URLParams
   801  	ctx_       context.Context
   802  	header_    http.Header
   803  }
   804  
   805  // Delete: Deletes a POSIX account.
   806  //
   807  //   - name: A reference to the POSIX account to update. POSIX accounts are
   808  //     identified by the project ID they are associated with. A reference to the
   809  //     POSIX account is in format `users/{user}/projects/{project}`.
   810  func (r *UsersProjectsService) Delete(name string) *UsersProjectsDeleteCall {
   811  	c := &UsersProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   812  	c.name = name
   813  	return c
   814  }
   815  
   816  // OperatingSystemType sets the optional parameter "operatingSystemType": The
   817  // type of operating system associated with the account.
   818  //
   819  // Possible values:
   820  //
   821  //	"OPERATING_SYSTEM_TYPE_UNSPECIFIED" - The operating system type associated
   822  //
   823  // with the user account information is unspecified.
   824  //
   825  //	"LINUX" - Linux user account information.
   826  //	"WINDOWS" - Windows user account information.
   827  func (c *UsersProjectsDeleteCall) OperatingSystemType(operatingSystemType string) *UsersProjectsDeleteCall {
   828  	c.urlParams_.Set("operatingSystemType", operatingSystemType)
   829  	return c
   830  }
   831  
   832  // Fields allows partial responses to be retrieved. See
   833  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   834  // details.
   835  func (c *UsersProjectsDeleteCall) Fields(s ...googleapi.Field) *UsersProjectsDeleteCall {
   836  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   837  	return c
   838  }
   839  
   840  // Context sets the context to be used in this call's Do method.
   841  func (c *UsersProjectsDeleteCall) Context(ctx context.Context) *UsersProjectsDeleteCall {
   842  	c.ctx_ = ctx
   843  	return c
   844  }
   845  
   846  // Header returns a http.Header that can be modified by the caller to add
   847  // headers to the request.
   848  func (c *UsersProjectsDeleteCall) Header() http.Header {
   849  	if c.header_ == nil {
   850  		c.header_ = make(http.Header)
   851  	}
   852  	return c.header_
   853  }
   854  
   855  func (c *UsersProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
   856  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   857  	var body io.Reader = nil
   858  	c.urlParams_.Set("alt", alt)
   859  	c.urlParams_.Set("prettyPrint", "false")
   860  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
   861  	urls += "?" + c.urlParams_.Encode()
   862  	req, err := http.NewRequest("DELETE", urls, body)
   863  	if err != nil {
   864  		return nil, err
   865  	}
   866  	req.Header = reqHeaders
   867  	googleapi.Expand(req.URL, map[string]string{
   868  		"name": c.name,
   869  	})
   870  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   871  }
   872  
   873  // Do executes the "oslogin.users.projects.delete" call.
   874  // Any non-2xx status code is an error. Response headers are in either
   875  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   876  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   877  // whether the returned error was because http.StatusNotModified was returned.
   878  func (c *UsersProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   879  	gensupport.SetOptions(c.urlParams_, opts...)
   880  	res, err := c.doRequest("json")
   881  	if res != nil && res.StatusCode == http.StatusNotModified {
   882  		if res.Body != nil {
   883  			res.Body.Close()
   884  		}
   885  		return nil, gensupport.WrapError(&googleapi.Error{
   886  			Code:   res.StatusCode,
   887  			Header: res.Header,
   888  		})
   889  	}
   890  	if err != nil {
   891  		return nil, err
   892  	}
   893  	defer googleapi.CloseBody(res)
   894  	if err := googleapi.CheckResponse(res); err != nil {
   895  		return nil, gensupport.WrapError(err)
   896  	}
   897  	ret := &Empty{
   898  		ServerResponse: googleapi.ServerResponse{
   899  			Header:         res.Header,
   900  			HTTPStatusCode: res.StatusCode,
   901  		},
   902  	}
   903  	target := &ret
   904  	if err := gensupport.DecodeResponse(target, res); err != nil {
   905  		return nil, err
   906  	}
   907  	return ret, nil
   908  }
   909  
   910  type UsersProjectsLocationsSignSshPublicKeyCall struct {
   911  	s                       *Service
   912  	parent                  string
   913  	signsshpublickeyrequest *SignSshPublicKeyRequest
   914  	urlParams_              gensupport.URLParams
   915  	ctx_                    context.Context
   916  	header_                 http.Header
   917  }
   918  
   919  // SignSshPublicKey: Signs an SSH public key for a user to authenticate to a
   920  // virtual machine on Google Compute Engine.
   921  //
   922  //   - parent: The parent project and zone for the signing request. This is
   923  //     needed to properly ensure per-organization ISS processing and potentially
   924  //     to provide for the possibility of zone-specific certificates used in the
   925  //     signing process.
   926  func (r *UsersProjectsLocationsService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsLocationsSignSshPublicKeyCall {
   927  	c := &UsersProjectsLocationsSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   928  	c.parent = parent
   929  	c.signsshpublickeyrequest = signsshpublickeyrequest
   930  	return c
   931  }
   932  
   933  // Fields allows partial responses to be retrieved. See
   934  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   935  // details.
   936  func (c *UsersProjectsLocationsSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsLocationsSignSshPublicKeyCall {
   937  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   938  	return c
   939  }
   940  
   941  // Context sets the context to be used in this call's Do method.
   942  func (c *UsersProjectsLocationsSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsLocationsSignSshPublicKeyCall {
   943  	c.ctx_ = ctx
   944  	return c
   945  }
   946  
   947  // Header returns a http.Header that can be modified by the caller to add
   948  // headers to the request.
   949  func (c *UsersProjectsLocationsSignSshPublicKeyCall) Header() http.Header {
   950  	if c.header_ == nil {
   951  		c.header_ = make(http.Header)
   952  	}
   953  	return c.header_
   954  }
   955  
   956  func (c *UsersProjectsLocationsSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
   957  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   958  	var body io.Reader = nil
   959  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.signsshpublickeyrequest)
   960  	if err != nil {
   961  		return nil, err
   962  	}
   963  	c.urlParams_.Set("alt", alt)
   964  	c.urlParams_.Set("prettyPrint", "false")
   965  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}:signSshPublicKey")
   966  	urls += "?" + c.urlParams_.Encode()
   967  	req, err := http.NewRequest("POST", urls, body)
   968  	if err != nil {
   969  		return nil, err
   970  	}
   971  	req.Header = reqHeaders
   972  	googleapi.Expand(req.URL, map[string]string{
   973  		"parent": c.parent,
   974  	})
   975  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   976  }
   977  
   978  // Do executes the "oslogin.users.projects.locations.signSshPublicKey" call.
   979  // Any non-2xx status code is an error. Response headers are in either
   980  // *SignSshPublicKeyResponse.ServerResponse.Header or (if a response was
   981  // returned at all) in error.(*googleapi.Error).Header. Use
   982  // googleapi.IsNotModified to check whether the returned error was because
   983  // http.StatusNotModified was returned.
   984  func (c *UsersProjectsLocationsSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
   985  	gensupport.SetOptions(c.urlParams_, opts...)
   986  	res, err := c.doRequest("json")
   987  	if res != nil && res.StatusCode == http.StatusNotModified {
   988  		if res.Body != nil {
   989  			res.Body.Close()
   990  		}
   991  		return nil, gensupport.WrapError(&googleapi.Error{
   992  			Code:   res.StatusCode,
   993  			Header: res.Header,
   994  		})
   995  	}
   996  	if err != nil {
   997  		return nil, err
   998  	}
   999  	defer googleapi.CloseBody(res)
  1000  	if err := googleapi.CheckResponse(res); err != nil {
  1001  		return nil, gensupport.WrapError(err)
  1002  	}
  1003  	ret := &SignSshPublicKeyResponse{
  1004  		ServerResponse: googleapi.ServerResponse{
  1005  			Header:         res.Header,
  1006  			HTTPStatusCode: res.StatusCode,
  1007  		},
  1008  	}
  1009  	target := &ret
  1010  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1011  		return nil, err
  1012  	}
  1013  	return ret, nil
  1014  }
  1015  
  1016  type UsersProjectsZonesSignSshPublicKeyCall struct {
  1017  	s                       *Service
  1018  	parent                  string
  1019  	signsshpublickeyrequest *SignSshPublicKeyRequest
  1020  	urlParams_              gensupport.URLParams
  1021  	ctx_                    context.Context
  1022  	header_                 http.Header
  1023  }
  1024  
  1025  // SignSshPublicKey: Signs an SSH public key for a user to authenticate to a
  1026  // virtual machine on Google Compute Engine.
  1027  //
  1028  //   - parent: The parent project and zone for the signing request. This is
  1029  //     needed to properly ensure per-organization ISS processing and potentially
  1030  //     to provide for the possibility of zone-specific certificates used in the
  1031  //     signing process.
  1032  func (r *UsersProjectsZonesService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsZonesSignSshPublicKeyCall {
  1033  	c := &UsersProjectsZonesSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1034  	c.parent = parent
  1035  	c.signsshpublickeyrequest = signsshpublickeyrequest
  1036  	return c
  1037  }
  1038  
  1039  // Fields allows partial responses to be retrieved. See
  1040  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1041  // details.
  1042  func (c *UsersProjectsZonesSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsZonesSignSshPublicKeyCall {
  1043  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1044  	return c
  1045  }
  1046  
  1047  // Context sets the context to be used in this call's Do method.
  1048  func (c *UsersProjectsZonesSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsZonesSignSshPublicKeyCall {
  1049  	c.ctx_ = ctx
  1050  	return c
  1051  }
  1052  
  1053  // Header returns a http.Header that can be modified by the caller to add
  1054  // headers to the request.
  1055  func (c *UsersProjectsZonesSignSshPublicKeyCall) Header() http.Header {
  1056  	if c.header_ == nil {
  1057  		c.header_ = make(http.Header)
  1058  	}
  1059  	return c.header_
  1060  }
  1061  
  1062  func (c *UsersProjectsZonesSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
  1063  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1064  	var body io.Reader = nil
  1065  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.signsshpublickeyrequest)
  1066  	if err != nil {
  1067  		return nil, err
  1068  	}
  1069  	c.urlParams_.Set("alt", alt)
  1070  	c.urlParams_.Set("prettyPrint", "false")
  1071  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}:signSshPublicKey")
  1072  	urls += "?" + c.urlParams_.Encode()
  1073  	req, err := http.NewRequest("POST", urls, body)
  1074  	if err != nil {
  1075  		return nil, err
  1076  	}
  1077  	req.Header = reqHeaders
  1078  	googleapi.Expand(req.URL, map[string]string{
  1079  		"parent": c.parent,
  1080  	})
  1081  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1082  }
  1083  
  1084  // Do executes the "oslogin.users.projects.zones.signSshPublicKey" call.
  1085  // Any non-2xx status code is an error. Response headers are in either
  1086  // *SignSshPublicKeyResponse.ServerResponse.Header or (if a response was
  1087  // returned at all) in error.(*googleapi.Error).Header. Use
  1088  // googleapi.IsNotModified to check whether the returned error was because
  1089  // http.StatusNotModified was returned.
  1090  func (c *UsersProjectsZonesSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
  1091  	gensupport.SetOptions(c.urlParams_, opts...)
  1092  	res, err := c.doRequest("json")
  1093  	if res != nil && res.StatusCode == http.StatusNotModified {
  1094  		if res.Body != nil {
  1095  			res.Body.Close()
  1096  		}
  1097  		return nil, gensupport.WrapError(&googleapi.Error{
  1098  			Code:   res.StatusCode,
  1099  			Header: res.Header,
  1100  		})
  1101  	}
  1102  	if err != nil {
  1103  		return nil, err
  1104  	}
  1105  	defer googleapi.CloseBody(res)
  1106  	if err := googleapi.CheckResponse(res); err != nil {
  1107  		return nil, gensupport.WrapError(err)
  1108  	}
  1109  	ret := &SignSshPublicKeyResponse{
  1110  		ServerResponse: googleapi.ServerResponse{
  1111  			Header:         res.Header,
  1112  			HTTPStatusCode: res.StatusCode,
  1113  		},
  1114  	}
  1115  	target := &ret
  1116  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1117  		return nil, err
  1118  	}
  1119  	return ret, nil
  1120  }
  1121  
  1122  type UsersSshPublicKeysCreateCall struct {
  1123  	s            *Service
  1124  	parent       string
  1125  	sshpublickey *SshPublicKey
  1126  	urlParams_   gensupport.URLParams
  1127  	ctx_         context.Context
  1128  	header_      http.Header
  1129  }
  1130  
  1131  // Create: Create an SSH public key
  1132  //
  1133  // - parent: The unique ID for the user in format `users/{user}`.
  1134  func (r *UsersSshPublicKeysService) Create(parent string, sshpublickey *SshPublicKey) *UsersSshPublicKeysCreateCall {
  1135  	c := &UsersSshPublicKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1136  	c.parent = parent
  1137  	c.sshpublickey = sshpublickey
  1138  	return c
  1139  }
  1140  
  1141  // Fields allows partial responses to be retrieved. See
  1142  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1143  // details.
  1144  func (c *UsersSshPublicKeysCreateCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysCreateCall {
  1145  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1146  	return c
  1147  }
  1148  
  1149  // Context sets the context to be used in this call's Do method.
  1150  func (c *UsersSshPublicKeysCreateCall) Context(ctx context.Context) *UsersSshPublicKeysCreateCall {
  1151  	c.ctx_ = ctx
  1152  	return c
  1153  }
  1154  
  1155  // Header returns a http.Header that can be modified by the caller to add
  1156  // headers to the request.
  1157  func (c *UsersSshPublicKeysCreateCall) Header() http.Header {
  1158  	if c.header_ == nil {
  1159  		c.header_ = make(http.Header)
  1160  	}
  1161  	return c.header_
  1162  }
  1163  
  1164  func (c *UsersSshPublicKeysCreateCall) doRequest(alt string) (*http.Response, error) {
  1165  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1166  	var body io.Reader = nil
  1167  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
  1168  	if err != nil {
  1169  		return nil, err
  1170  	}
  1171  	c.urlParams_.Set("alt", alt)
  1172  	c.urlParams_.Set("prettyPrint", "false")
  1173  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}/sshPublicKeys")
  1174  	urls += "?" + c.urlParams_.Encode()
  1175  	req, err := http.NewRequest("POST", urls, body)
  1176  	if err != nil {
  1177  		return nil, err
  1178  	}
  1179  	req.Header = reqHeaders
  1180  	googleapi.Expand(req.URL, map[string]string{
  1181  		"parent": c.parent,
  1182  	})
  1183  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1184  }
  1185  
  1186  // Do executes the "oslogin.users.sshPublicKeys.create" call.
  1187  // Any non-2xx status code is an error. Response headers are in either
  1188  // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
  1189  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1190  // whether the returned error was because http.StatusNotModified was returned.
  1191  func (c *UsersSshPublicKeysCreateCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
  1192  	gensupport.SetOptions(c.urlParams_, opts...)
  1193  	res, err := c.doRequest("json")
  1194  	if res != nil && res.StatusCode == http.StatusNotModified {
  1195  		if res.Body != nil {
  1196  			res.Body.Close()
  1197  		}
  1198  		return nil, gensupport.WrapError(&googleapi.Error{
  1199  			Code:   res.StatusCode,
  1200  			Header: res.Header,
  1201  		})
  1202  	}
  1203  	if err != nil {
  1204  		return nil, err
  1205  	}
  1206  	defer googleapi.CloseBody(res)
  1207  	if err := googleapi.CheckResponse(res); err != nil {
  1208  		return nil, gensupport.WrapError(err)
  1209  	}
  1210  	ret := &SshPublicKey{
  1211  		ServerResponse: googleapi.ServerResponse{
  1212  			Header:         res.Header,
  1213  			HTTPStatusCode: res.StatusCode,
  1214  		},
  1215  	}
  1216  	target := &ret
  1217  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1218  		return nil, err
  1219  	}
  1220  	return ret, nil
  1221  }
  1222  
  1223  type UsersSshPublicKeysDeleteCall struct {
  1224  	s          *Service
  1225  	name       string
  1226  	urlParams_ gensupport.URLParams
  1227  	ctx_       context.Context
  1228  	header_    http.Header
  1229  }
  1230  
  1231  // Delete: Deletes an SSH public key.
  1232  //
  1233  //   - name: The fingerprint of the public key to update. Public keys are
  1234  //     identified by their SHA-256 fingerprint. The fingerprint of the public key
  1235  //     is in format `users/{user}/sshPublicKeys/{fingerprint}`.
  1236  func (r *UsersSshPublicKeysService) Delete(name string) *UsersSshPublicKeysDeleteCall {
  1237  	c := &UsersSshPublicKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1238  	c.name = name
  1239  	return c
  1240  }
  1241  
  1242  // Fields allows partial responses to be retrieved. See
  1243  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1244  // details.
  1245  func (c *UsersSshPublicKeysDeleteCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysDeleteCall {
  1246  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1247  	return c
  1248  }
  1249  
  1250  // Context sets the context to be used in this call's Do method.
  1251  func (c *UsersSshPublicKeysDeleteCall) Context(ctx context.Context) *UsersSshPublicKeysDeleteCall {
  1252  	c.ctx_ = ctx
  1253  	return c
  1254  }
  1255  
  1256  // Header returns a http.Header that can be modified by the caller to add
  1257  // headers to the request.
  1258  func (c *UsersSshPublicKeysDeleteCall) Header() http.Header {
  1259  	if c.header_ == nil {
  1260  		c.header_ = make(http.Header)
  1261  	}
  1262  	return c.header_
  1263  }
  1264  
  1265  func (c *UsersSshPublicKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
  1266  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1267  	var body io.Reader = nil
  1268  	c.urlParams_.Set("alt", alt)
  1269  	c.urlParams_.Set("prettyPrint", "false")
  1270  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
  1271  	urls += "?" + c.urlParams_.Encode()
  1272  	req, err := http.NewRequest("DELETE", urls, body)
  1273  	if err != nil {
  1274  		return nil, err
  1275  	}
  1276  	req.Header = reqHeaders
  1277  	googleapi.Expand(req.URL, map[string]string{
  1278  		"name": c.name,
  1279  	})
  1280  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1281  }
  1282  
  1283  // Do executes the "oslogin.users.sshPublicKeys.delete" call.
  1284  // Any non-2xx status code is an error. Response headers are in either
  1285  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  1286  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1287  // whether the returned error was because http.StatusNotModified was returned.
  1288  func (c *UsersSshPublicKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1289  	gensupport.SetOptions(c.urlParams_, opts...)
  1290  	res, err := c.doRequest("json")
  1291  	if res != nil && res.StatusCode == http.StatusNotModified {
  1292  		if res.Body != nil {
  1293  			res.Body.Close()
  1294  		}
  1295  		return nil, gensupport.WrapError(&googleapi.Error{
  1296  			Code:   res.StatusCode,
  1297  			Header: res.Header,
  1298  		})
  1299  	}
  1300  	if err != nil {
  1301  		return nil, err
  1302  	}
  1303  	defer googleapi.CloseBody(res)
  1304  	if err := googleapi.CheckResponse(res); err != nil {
  1305  		return nil, gensupport.WrapError(err)
  1306  	}
  1307  	ret := &Empty{
  1308  		ServerResponse: googleapi.ServerResponse{
  1309  			Header:         res.Header,
  1310  			HTTPStatusCode: res.StatusCode,
  1311  		},
  1312  	}
  1313  	target := &ret
  1314  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1315  		return nil, err
  1316  	}
  1317  	return ret, nil
  1318  }
  1319  
  1320  type UsersSshPublicKeysGetCall struct {
  1321  	s            *Service
  1322  	name         string
  1323  	urlParams_   gensupport.URLParams
  1324  	ifNoneMatch_ string
  1325  	ctx_         context.Context
  1326  	header_      http.Header
  1327  }
  1328  
  1329  // Get: Retrieves an SSH public key.
  1330  //
  1331  //   - name: The fingerprint of the public key to retrieve. Public keys are
  1332  //     identified by their SHA-256 fingerprint. The fingerprint of the public key
  1333  //     is in format `users/{user}/sshPublicKeys/{fingerprint}`.
  1334  func (r *UsersSshPublicKeysService) Get(name string) *UsersSshPublicKeysGetCall {
  1335  	c := &UsersSshPublicKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1336  	c.name = name
  1337  	return c
  1338  }
  1339  
  1340  // Fields allows partial responses to be retrieved. See
  1341  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1342  // details.
  1343  func (c *UsersSshPublicKeysGetCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysGetCall {
  1344  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1345  	return c
  1346  }
  1347  
  1348  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1349  // object's ETag matches the given value. This is useful for getting updates
  1350  // only after the object has changed since the last request.
  1351  func (c *UsersSshPublicKeysGetCall) IfNoneMatch(entityTag string) *UsersSshPublicKeysGetCall {
  1352  	c.ifNoneMatch_ = entityTag
  1353  	return c
  1354  }
  1355  
  1356  // Context sets the context to be used in this call's Do method.
  1357  func (c *UsersSshPublicKeysGetCall) Context(ctx context.Context) *UsersSshPublicKeysGetCall {
  1358  	c.ctx_ = ctx
  1359  	return c
  1360  }
  1361  
  1362  // Header returns a http.Header that can be modified by the caller to add
  1363  // headers to the request.
  1364  func (c *UsersSshPublicKeysGetCall) Header() http.Header {
  1365  	if c.header_ == nil {
  1366  		c.header_ = make(http.Header)
  1367  	}
  1368  	return c.header_
  1369  }
  1370  
  1371  func (c *UsersSshPublicKeysGetCall) doRequest(alt string) (*http.Response, error) {
  1372  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1373  	if c.ifNoneMatch_ != "" {
  1374  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1375  	}
  1376  	var body io.Reader = nil
  1377  	c.urlParams_.Set("alt", alt)
  1378  	c.urlParams_.Set("prettyPrint", "false")
  1379  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
  1380  	urls += "?" + c.urlParams_.Encode()
  1381  	req, err := http.NewRequest("GET", urls, body)
  1382  	if err != nil {
  1383  		return nil, err
  1384  	}
  1385  	req.Header = reqHeaders
  1386  	googleapi.Expand(req.URL, map[string]string{
  1387  		"name": c.name,
  1388  	})
  1389  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1390  }
  1391  
  1392  // Do executes the "oslogin.users.sshPublicKeys.get" call.
  1393  // Any non-2xx status code is an error. Response headers are in either
  1394  // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
  1395  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1396  // whether the returned error was because http.StatusNotModified was returned.
  1397  func (c *UsersSshPublicKeysGetCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
  1398  	gensupport.SetOptions(c.urlParams_, opts...)
  1399  	res, err := c.doRequest("json")
  1400  	if res != nil && res.StatusCode == http.StatusNotModified {
  1401  		if res.Body != nil {
  1402  			res.Body.Close()
  1403  		}
  1404  		return nil, gensupport.WrapError(&googleapi.Error{
  1405  			Code:   res.StatusCode,
  1406  			Header: res.Header,
  1407  		})
  1408  	}
  1409  	if err != nil {
  1410  		return nil, err
  1411  	}
  1412  	defer googleapi.CloseBody(res)
  1413  	if err := googleapi.CheckResponse(res); err != nil {
  1414  		return nil, gensupport.WrapError(err)
  1415  	}
  1416  	ret := &SshPublicKey{
  1417  		ServerResponse: googleapi.ServerResponse{
  1418  			Header:         res.Header,
  1419  			HTTPStatusCode: res.StatusCode,
  1420  		},
  1421  	}
  1422  	target := &ret
  1423  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1424  		return nil, err
  1425  	}
  1426  	return ret, nil
  1427  }
  1428  
  1429  type UsersSshPublicKeysPatchCall struct {
  1430  	s            *Service
  1431  	name         string
  1432  	sshpublickey *SshPublicKey
  1433  	urlParams_   gensupport.URLParams
  1434  	ctx_         context.Context
  1435  	header_      http.Header
  1436  }
  1437  
  1438  // Patch: Updates an SSH public key and returns the profile information. This
  1439  // method supports patch semantics.
  1440  //
  1441  //   - name: The fingerprint of the public key to update. Public keys are
  1442  //     identified by their SHA-256 fingerprint. The fingerprint of the public key
  1443  //     is in format `users/{user}/sshPublicKeys/{fingerprint}`.
  1444  func (r *UsersSshPublicKeysService) Patch(name string, sshpublickey *SshPublicKey) *UsersSshPublicKeysPatchCall {
  1445  	c := &UsersSshPublicKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1446  	c.name = name
  1447  	c.sshpublickey = sshpublickey
  1448  	return c
  1449  }
  1450  
  1451  // UpdateMask sets the optional parameter "updateMask": Mask to control which
  1452  // fields get updated. Updates all if not present.
  1453  func (c *UsersSshPublicKeysPatchCall) UpdateMask(updateMask string) *UsersSshPublicKeysPatchCall {
  1454  	c.urlParams_.Set("updateMask", updateMask)
  1455  	return c
  1456  }
  1457  
  1458  // Fields allows partial responses to be retrieved. See
  1459  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1460  // details.
  1461  func (c *UsersSshPublicKeysPatchCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysPatchCall {
  1462  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1463  	return c
  1464  }
  1465  
  1466  // Context sets the context to be used in this call's Do method.
  1467  func (c *UsersSshPublicKeysPatchCall) Context(ctx context.Context) *UsersSshPublicKeysPatchCall {
  1468  	c.ctx_ = ctx
  1469  	return c
  1470  }
  1471  
  1472  // Header returns a http.Header that can be modified by the caller to add
  1473  // headers to the request.
  1474  func (c *UsersSshPublicKeysPatchCall) Header() http.Header {
  1475  	if c.header_ == nil {
  1476  		c.header_ = make(http.Header)
  1477  	}
  1478  	return c.header_
  1479  }
  1480  
  1481  func (c *UsersSshPublicKeysPatchCall) doRequest(alt string) (*http.Response, error) {
  1482  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1483  	var body io.Reader = nil
  1484  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
  1485  	if err != nil {
  1486  		return nil, err
  1487  	}
  1488  	c.urlParams_.Set("alt", alt)
  1489  	c.urlParams_.Set("prettyPrint", "false")
  1490  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
  1491  	urls += "?" + c.urlParams_.Encode()
  1492  	req, err := http.NewRequest("PATCH", urls, body)
  1493  	if err != nil {
  1494  		return nil, err
  1495  	}
  1496  	req.Header = reqHeaders
  1497  	googleapi.Expand(req.URL, map[string]string{
  1498  		"name": c.name,
  1499  	})
  1500  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1501  }
  1502  
  1503  // Do executes the "oslogin.users.sshPublicKeys.patch" call.
  1504  // Any non-2xx status code is an error. Response headers are in either
  1505  // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
  1506  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1507  // whether the returned error was because http.StatusNotModified was returned.
  1508  func (c *UsersSshPublicKeysPatchCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
  1509  	gensupport.SetOptions(c.urlParams_, opts...)
  1510  	res, err := c.doRequest("json")
  1511  	if res != nil && res.StatusCode == http.StatusNotModified {
  1512  		if res.Body != nil {
  1513  			res.Body.Close()
  1514  		}
  1515  		return nil, gensupport.WrapError(&googleapi.Error{
  1516  			Code:   res.StatusCode,
  1517  			Header: res.Header,
  1518  		})
  1519  	}
  1520  	if err != nil {
  1521  		return nil, err
  1522  	}
  1523  	defer googleapi.CloseBody(res)
  1524  	if err := googleapi.CheckResponse(res); err != nil {
  1525  		return nil, gensupport.WrapError(err)
  1526  	}
  1527  	ret := &SshPublicKey{
  1528  		ServerResponse: googleapi.ServerResponse{
  1529  			Header:         res.Header,
  1530  			HTTPStatusCode: res.StatusCode,
  1531  		},
  1532  	}
  1533  	target := &ret
  1534  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1535  		return nil, err
  1536  	}
  1537  	return ret, nil
  1538  }
  1539  

View as plain text