...

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

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

     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/v1beta"
    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/v1beta"
    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:v1beta"
    97  const apiName = "oslogin"
    98  const apiVersion = "v1beta"
    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  // ProjectId sets the optional parameter "projectId": The project ID of the
   528  // Google Cloud Platform project.
   529  func (c *UsersGetLoginProfileCall) ProjectId(projectId string) *UsersGetLoginProfileCall {
   530  	c.urlParams_.Set("projectId", projectId)
   531  	return c
   532  }
   533  
   534  // SystemId sets the optional parameter "systemId": A system ID for filtering
   535  // the results of the request.
   536  func (c *UsersGetLoginProfileCall) SystemId(systemId string) *UsersGetLoginProfileCall {
   537  	c.urlParams_.Set("systemId", systemId)
   538  	return c
   539  }
   540  
   541  // View sets the optional parameter "view": The view configures whether to
   542  // retrieve security keys information.
   543  //
   544  // Possible values:
   545  //
   546  //	"LOGIN_PROFILE_VIEW_UNSPECIFIED" - The default login profile view. The API
   547  //
   548  // defaults to the BASIC view.
   549  //
   550  //	"BASIC" - Includes POSIX and SSH key information.
   551  //	"SECURITY_KEY" - Include security key information for the user.
   552  func (c *UsersGetLoginProfileCall) View(view string) *UsersGetLoginProfileCall {
   553  	c.urlParams_.Set("view", view)
   554  	return c
   555  }
   556  
   557  // Fields allows partial responses to be retrieved. See
   558  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   559  // details.
   560  func (c *UsersGetLoginProfileCall) Fields(s ...googleapi.Field) *UsersGetLoginProfileCall {
   561  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   562  	return c
   563  }
   564  
   565  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   566  // object's ETag matches the given value. This is useful for getting updates
   567  // only after the object has changed since the last request.
   568  func (c *UsersGetLoginProfileCall) IfNoneMatch(entityTag string) *UsersGetLoginProfileCall {
   569  	c.ifNoneMatch_ = entityTag
   570  	return c
   571  }
   572  
   573  // Context sets the context to be used in this call's Do method.
   574  func (c *UsersGetLoginProfileCall) Context(ctx context.Context) *UsersGetLoginProfileCall {
   575  	c.ctx_ = ctx
   576  	return c
   577  }
   578  
   579  // Header returns a http.Header that can be modified by the caller to add
   580  // headers to the request.
   581  func (c *UsersGetLoginProfileCall) Header() http.Header {
   582  	if c.header_ == nil {
   583  		c.header_ = make(http.Header)
   584  	}
   585  	return c.header_
   586  }
   587  
   588  func (c *UsersGetLoginProfileCall) doRequest(alt string) (*http.Response, error) {
   589  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   590  	if c.ifNoneMatch_ != "" {
   591  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   592  	}
   593  	var body io.Reader = nil
   594  	c.urlParams_.Set("alt", alt)
   595  	c.urlParams_.Set("prettyPrint", "false")
   596  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}/loginProfile")
   597  	urls += "?" + c.urlParams_.Encode()
   598  	req, err := http.NewRequest("GET", urls, body)
   599  	if err != nil {
   600  		return nil, err
   601  	}
   602  	req.Header = reqHeaders
   603  	googleapi.Expand(req.URL, map[string]string{
   604  		"name": c.name,
   605  	})
   606  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   607  }
   608  
   609  // Do executes the "oslogin.users.getLoginProfile" call.
   610  // Any non-2xx status code is an error. Response headers are in either
   611  // *LoginProfile.ServerResponse.Header or (if a response was returned at all)
   612  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   613  // whether the returned error was because http.StatusNotModified was returned.
   614  func (c *UsersGetLoginProfileCall) Do(opts ...googleapi.CallOption) (*LoginProfile, error) {
   615  	gensupport.SetOptions(c.urlParams_, opts...)
   616  	res, err := c.doRequest("json")
   617  	if res != nil && res.StatusCode == http.StatusNotModified {
   618  		if res.Body != nil {
   619  			res.Body.Close()
   620  		}
   621  		return nil, gensupport.WrapError(&googleapi.Error{
   622  			Code:   res.StatusCode,
   623  			Header: res.Header,
   624  		})
   625  	}
   626  	if err != nil {
   627  		return nil, err
   628  	}
   629  	defer googleapi.CloseBody(res)
   630  	if err := googleapi.CheckResponse(res); err != nil {
   631  		return nil, gensupport.WrapError(err)
   632  	}
   633  	ret := &LoginProfile{
   634  		ServerResponse: googleapi.ServerResponse{
   635  			Header:         res.Header,
   636  			HTTPStatusCode: res.StatusCode,
   637  		},
   638  	}
   639  	target := &ret
   640  	if err := gensupport.DecodeResponse(target, res); err != nil {
   641  		return nil, err
   642  	}
   643  	return ret, nil
   644  }
   645  
   646  type UsersImportSshPublicKeyCall struct {
   647  	s            *Service
   648  	parent       string
   649  	sshpublickey *SshPublicKey
   650  	urlParams_   gensupport.URLParams
   651  	ctx_         context.Context
   652  	header_      http.Header
   653  }
   654  
   655  // ImportSshPublicKey: Adds an SSH public key and returns the profile
   656  // information. Default POSIX account information is set when no username and
   657  // UID exist as part of the login profile.
   658  //
   659  // - parent: The unique ID for the user in format `users/{user}`.
   660  func (r *UsersService) ImportSshPublicKey(parent string, sshpublickey *SshPublicKey) *UsersImportSshPublicKeyCall {
   661  	c := &UsersImportSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   662  	c.parent = parent
   663  	c.sshpublickey = sshpublickey
   664  	return c
   665  }
   666  
   667  // ProjectId sets the optional parameter "projectId": The project ID of the
   668  // Google Cloud Platform project.
   669  func (c *UsersImportSshPublicKeyCall) ProjectId(projectId string) *UsersImportSshPublicKeyCall {
   670  	c.urlParams_.Set("projectId", projectId)
   671  	return c
   672  }
   673  
   674  // Regions sets the optional parameter "regions": The regions to which to
   675  // assert that the key was written. If unspecified, defaults to all regions.
   676  // Regions are listed at https://cloud.google.com/about/locations#region.
   677  func (c *UsersImportSshPublicKeyCall) Regions(regions ...string) *UsersImportSshPublicKeyCall {
   678  	c.urlParams_.SetMulti("regions", append([]string{}, regions...))
   679  	return c
   680  }
   681  
   682  // View sets the optional parameter "view": The view configures whether to
   683  // retrieve security keys information.
   684  //
   685  // Possible values:
   686  //
   687  //	"LOGIN_PROFILE_VIEW_UNSPECIFIED" - The default login profile view. The API
   688  //
   689  // defaults to the BASIC view.
   690  //
   691  //	"BASIC" - Includes POSIX and SSH key information.
   692  //	"SECURITY_KEY" - Include security key information for the user.
   693  func (c *UsersImportSshPublicKeyCall) View(view string) *UsersImportSshPublicKeyCall {
   694  	c.urlParams_.Set("view", view)
   695  	return c
   696  }
   697  
   698  // Fields allows partial responses to be retrieved. See
   699  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   700  // details.
   701  func (c *UsersImportSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersImportSshPublicKeyCall {
   702  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   703  	return c
   704  }
   705  
   706  // Context sets the context to be used in this call's Do method.
   707  func (c *UsersImportSshPublicKeyCall) Context(ctx context.Context) *UsersImportSshPublicKeyCall {
   708  	c.ctx_ = ctx
   709  	return c
   710  }
   711  
   712  // Header returns a http.Header that can be modified by the caller to add
   713  // headers to the request.
   714  func (c *UsersImportSshPublicKeyCall) Header() http.Header {
   715  	if c.header_ == nil {
   716  		c.header_ = make(http.Header)
   717  	}
   718  	return c.header_
   719  }
   720  
   721  func (c *UsersImportSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
   722  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   723  	var body io.Reader = nil
   724  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
   725  	if err != nil {
   726  		return nil, err
   727  	}
   728  	c.urlParams_.Set("alt", alt)
   729  	c.urlParams_.Set("prettyPrint", "false")
   730  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:importSshPublicKey")
   731  	urls += "?" + c.urlParams_.Encode()
   732  	req, err := http.NewRequest("POST", urls, body)
   733  	if err != nil {
   734  		return nil, err
   735  	}
   736  	req.Header = reqHeaders
   737  	googleapi.Expand(req.URL, map[string]string{
   738  		"parent": c.parent,
   739  	})
   740  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   741  }
   742  
   743  // Do executes the "oslogin.users.importSshPublicKey" call.
   744  // Any non-2xx status code is an error. Response headers are in either
   745  // *ImportSshPublicKeyResponse.ServerResponse.Header or (if a response was
   746  // returned at all) in error.(*googleapi.Error).Header. Use
   747  // googleapi.IsNotModified to check whether the returned error was because
   748  // http.StatusNotModified was returned.
   749  func (c *UsersImportSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*ImportSshPublicKeyResponse, error) {
   750  	gensupport.SetOptions(c.urlParams_, opts...)
   751  	res, err := c.doRequest("json")
   752  	if res != nil && res.StatusCode == http.StatusNotModified {
   753  		if res.Body != nil {
   754  			res.Body.Close()
   755  		}
   756  		return nil, gensupport.WrapError(&googleapi.Error{
   757  			Code:   res.StatusCode,
   758  			Header: res.Header,
   759  		})
   760  	}
   761  	if err != nil {
   762  		return nil, err
   763  	}
   764  	defer googleapi.CloseBody(res)
   765  	if err := googleapi.CheckResponse(res); err != nil {
   766  		return nil, gensupport.WrapError(err)
   767  	}
   768  	ret := &ImportSshPublicKeyResponse{
   769  		ServerResponse: googleapi.ServerResponse{
   770  			Header:         res.Header,
   771  			HTTPStatusCode: res.StatusCode,
   772  		},
   773  	}
   774  	target := &ret
   775  	if err := gensupport.DecodeResponse(target, res); err != nil {
   776  		return nil, err
   777  	}
   778  	return ret, nil
   779  }
   780  
   781  type UsersProjectsDeleteCall struct {
   782  	s          *Service
   783  	name       string
   784  	urlParams_ gensupport.URLParams
   785  	ctx_       context.Context
   786  	header_    http.Header
   787  }
   788  
   789  // Delete: Deletes a POSIX account.
   790  //
   791  //   - name: A reference to the POSIX account to update. POSIX accounts are
   792  //     identified by the project ID they are associated with. A reference to the
   793  //     POSIX account is in format `users/{user}/projects/{project}`.
   794  func (r *UsersProjectsService) Delete(name string) *UsersProjectsDeleteCall {
   795  	c := &UsersProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   796  	c.name = name
   797  	return c
   798  }
   799  
   800  // Fields allows partial responses to be retrieved. See
   801  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   802  // details.
   803  func (c *UsersProjectsDeleteCall) Fields(s ...googleapi.Field) *UsersProjectsDeleteCall {
   804  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   805  	return c
   806  }
   807  
   808  // Context sets the context to be used in this call's Do method.
   809  func (c *UsersProjectsDeleteCall) Context(ctx context.Context) *UsersProjectsDeleteCall {
   810  	c.ctx_ = ctx
   811  	return c
   812  }
   813  
   814  // Header returns a http.Header that can be modified by the caller to add
   815  // headers to the request.
   816  func (c *UsersProjectsDeleteCall) Header() http.Header {
   817  	if c.header_ == nil {
   818  		c.header_ = make(http.Header)
   819  	}
   820  	return c.header_
   821  }
   822  
   823  func (c *UsersProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
   824  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   825  	var body io.Reader = nil
   826  	c.urlParams_.Set("alt", alt)
   827  	c.urlParams_.Set("prettyPrint", "false")
   828  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
   829  	urls += "?" + c.urlParams_.Encode()
   830  	req, err := http.NewRequest("DELETE", urls, body)
   831  	if err != nil {
   832  		return nil, err
   833  	}
   834  	req.Header = reqHeaders
   835  	googleapi.Expand(req.URL, map[string]string{
   836  		"name": c.name,
   837  	})
   838  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   839  }
   840  
   841  // Do executes the "oslogin.users.projects.delete" call.
   842  // Any non-2xx status code is an error. Response headers are in either
   843  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   844  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   845  // whether the returned error was because http.StatusNotModified was returned.
   846  func (c *UsersProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   847  	gensupport.SetOptions(c.urlParams_, opts...)
   848  	res, err := c.doRequest("json")
   849  	if res != nil && res.StatusCode == http.StatusNotModified {
   850  		if res.Body != nil {
   851  			res.Body.Close()
   852  		}
   853  		return nil, gensupport.WrapError(&googleapi.Error{
   854  			Code:   res.StatusCode,
   855  			Header: res.Header,
   856  		})
   857  	}
   858  	if err != nil {
   859  		return nil, err
   860  	}
   861  	defer googleapi.CloseBody(res)
   862  	if err := googleapi.CheckResponse(res); err != nil {
   863  		return nil, gensupport.WrapError(err)
   864  	}
   865  	ret := &Empty{
   866  		ServerResponse: googleapi.ServerResponse{
   867  			Header:         res.Header,
   868  			HTTPStatusCode: res.StatusCode,
   869  		},
   870  	}
   871  	target := &ret
   872  	if err := gensupport.DecodeResponse(target, res); err != nil {
   873  		return nil, err
   874  	}
   875  	return ret, nil
   876  }
   877  
   878  type UsersProjectsLocationsSignSshPublicKeyCall struct {
   879  	s                       *Service
   880  	parent                  string
   881  	signsshpublickeyrequest *SignSshPublicKeyRequest
   882  	urlParams_              gensupport.URLParams
   883  	ctx_                    context.Context
   884  	header_                 http.Header
   885  }
   886  
   887  // SignSshPublicKey: Signs an SSH public key for a user to authenticate to an
   888  // instance.
   889  //
   890  //   - parent: The parent project and zone for the signing request. This is
   891  //     needed to properly ensure per-organization ISS processing and potentially
   892  //     to provide for the possibility of zone-specific certificates used in the
   893  //     signing process.
   894  func (r *UsersProjectsLocationsService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsLocationsSignSshPublicKeyCall {
   895  	c := &UsersProjectsLocationsSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   896  	c.parent = parent
   897  	c.signsshpublickeyrequest = signsshpublickeyrequest
   898  	return c
   899  }
   900  
   901  // Fields allows partial responses to be retrieved. See
   902  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   903  // details.
   904  func (c *UsersProjectsLocationsSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsLocationsSignSshPublicKeyCall {
   905  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   906  	return c
   907  }
   908  
   909  // Context sets the context to be used in this call's Do method.
   910  func (c *UsersProjectsLocationsSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsLocationsSignSshPublicKeyCall {
   911  	c.ctx_ = ctx
   912  	return c
   913  }
   914  
   915  // Header returns a http.Header that can be modified by the caller to add
   916  // headers to the request.
   917  func (c *UsersProjectsLocationsSignSshPublicKeyCall) Header() http.Header {
   918  	if c.header_ == nil {
   919  		c.header_ = make(http.Header)
   920  	}
   921  	return c.header_
   922  }
   923  
   924  func (c *UsersProjectsLocationsSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
   925  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   926  	var body io.Reader = nil
   927  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.signsshpublickeyrequest)
   928  	if err != nil {
   929  		return nil, err
   930  	}
   931  	c.urlParams_.Set("alt", alt)
   932  	c.urlParams_.Set("prettyPrint", "false")
   933  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:signSshPublicKey")
   934  	urls += "?" + c.urlParams_.Encode()
   935  	req, err := http.NewRequest("POST", urls, body)
   936  	if err != nil {
   937  		return nil, err
   938  	}
   939  	req.Header = reqHeaders
   940  	googleapi.Expand(req.URL, map[string]string{
   941  		"parent": c.parent,
   942  	})
   943  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   944  }
   945  
   946  // Do executes the "oslogin.users.projects.locations.signSshPublicKey" call.
   947  // Any non-2xx status code is an error. Response headers are in either
   948  // *SignSshPublicKeyResponse.ServerResponse.Header or (if a response was
   949  // returned at all) in error.(*googleapi.Error).Header. Use
   950  // googleapi.IsNotModified to check whether the returned error was because
   951  // http.StatusNotModified was returned.
   952  func (c *UsersProjectsLocationsSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
   953  	gensupport.SetOptions(c.urlParams_, opts...)
   954  	res, err := c.doRequest("json")
   955  	if res != nil && res.StatusCode == http.StatusNotModified {
   956  		if res.Body != nil {
   957  			res.Body.Close()
   958  		}
   959  		return nil, gensupport.WrapError(&googleapi.Error{
   960  			Code:   res.StatusCode,
   961  			Header: res.Header,
   962  		})
   963  	}
   964  	if err != nil {
   965  		return nil, err
   966  	}
   967  	defer googleapi.CloseBody(res)
   968  	if err := googleapi.CheckResponse(res); err != nil {
   969  		return nil, gensupport.WrapError(err)
   970  	}
   971  	ret := &SignSshPublicKeyResponse{
   972  		ServerResponse: googleapi.ServerResponse{
   973  			Header:         res.Header,
   974  			HTTPStatusCode: res.StatusCode,
   975  		},
   976  	}
   977  	target := &ret
   978  	if err := gensupport.DecodeResponse(target, res); err != nil {
   979  		return nil, err
   980  	}
   981  	return ret, nil
   982  }
   983  
   984  type UsersProjectsZonesSignSshPublicKeyCall struct {
   985  	s                       *Service
   986  	parent                  string
   987  	signsshpublickeyrequest *SignSshPublicKeyRequest
   988  	urlParams_              gensupport.URLParams
   989  	ctx_                    context.Context
   990  	header_                 http.Header
   991  }
   992  
   993  // SignSshPublicKey: Signs an SSH public key for a user to authenticate to an
   994  // instance.
   995  //
   996  //   - parent: The parent project and zone for the signing request. This is
   997  //     needed to properly ensure per-organization ISS processing and potentially
   998  //     to provide for the possibility of zone-specific certificates used in the
   999  //     signing process.
  1000  func (r *UsersProjectsZonesService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsZonesSignSshPublicKeyCall {
  1001  	c := &UsersProjectsZonesSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1002  	c.parent = parent
  1003  	c.signsshpublickeyrequest = signsshpublickeyrequest
  1004  	return c
  1005  }
  1006  
  1007  // Fields allows partial responses to be retrieved. See
  1008  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1009  // details.
  1010  func (c *UsersProjectsZonesSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsZonesSignSshPublicKeyCall {
  1011  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1012  	return c
  1013  }
  1014  
  1015  // Context sets the context to be used in this call's Do method.
  1016  func (c *UsersProjectsZonesSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsZonesSignSshPublicKeyCall {
  1017  	c.ctx_ = ctx
  1018  	return c
  1019  }
  1020  
  1021  // Header returns a http.Header that can be modified by the caller to add
  1022  // headers to the request.
  1023  func (c *UsersProjectsZonesSignSshPublicKeyCall) Header() http.Header {
  1024  	if c.header_ == nil {
  1025  		c.header_ = make(http.Header)
  1026  	}
  1027  	return c.header_
  1028  }
  1029  
  1030  func (c *UsersProjectsZonesSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
  1031  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1032  	var body io.Reader = nil
  1033  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.signsshpublickeyrequest)
  1034  	if err != nil {
  1035  		return nil, err
  1036  	}
  1037  	c.urlParams_.Set("alt", alt)
  1038  	c.urlParams_.Set("prettyPrint", "false")
  1039  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:signSshPublicKey")
  1040  	urls += "?" + c.urlParams_.Encode()
  1041  	req, err := http.NewRequest("POST", urls, body)
  1042  	if err != nil {
  1043  		return nil, err
  1044  	}
  1045  	req.Header = reqHeaders
  1046  	googleapi.Expand(req.URL, map[string]string{
  1047  		"parent": c.parent,
  1048  	})
  1049  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1050  }
  1051  
  1052  // Do executes the "oslogin.users.projects.zones.signSshPublicKey" call.
  1053  // Any non-2xx status code is an error. Response headers are in either
  1054  // *SignSshPublicKeyResponse.ServerResponse.Header or (if a response was
  1055  // returned at all) in error.(*googleapi.Error).Header. Use
  1056  // googleapi.IsNotModified to check whether the returned error was because
  1057  // http.StatusNotModified was returned.
  1058  func (c *UsersProjectsZonesSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
  1059  	gensupport.SetOptions(c.urlParams_, opts...)
  1060  	res, err := c.doRequest("json")
  1061  	if res != nil && res.StatusCode == http.StatusNotModified {
  1062  		if res.Body != nil {
  1063  			res.Body.Close()
  1064  		}
  1065  		return nil, gensupport.WrapError(&googleapi.Error{
  1066  			Code:   res.StatusCode,
  1067  			Header: res.Header,
  1068  		})
  1069  	}
  1070  	if err != nil {
  1071  		return nil, err
  1072  	}
  1073  	defer googleapi.CloseBody(res)
  1074  	if err := googleapi.CheckResponse(res); err != nil {
  1075  		return nil, gensupport.WrapError(err)
  1076  	}
  1077  	ret := &SignSshPublicKeyResponse{
  1078  		ServerResponse: googleapi.ServerResponse{
  1079  			Header:         res.Header,
  1080  			HTTPStatusCode: res.StatusCode,
  1081  		},
  1082  	}
  1083  	target := &ret
  1084  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1085  		return nil, err
  1086  	}
  1087  	return ret, nil
  1088  }
  1089  
  1090  type UsersSshPublicKeysCreateCall struct {
  1091  	s            *Service
  1092  	parent       string
  1093  	sshpublickey *SshPublicKey
  1094  	urlParams_   gensupport.URLParams
  1095  	ctx_         context.Context
  1096  	header_      http.Header
  1097  }
  1098  
  1099  // Create: Create an SSH public key
  1100  //
  1101  // - parent: The unique ID for the user in format `users/{user}`.
  1102  func (r *UsersSshPublicKeysService) Create(parent string, sshpublickey *SshPublicKey) *UsersSshPublicKeysCreateCall {
  1103  	c := &UsersSshPublicKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1104  	c.parent = parent
  1105  	c.sshpublickey = sshpublickey
  1106  	return c
  1107  }
  1108  
  1109  // Fields allows partial responses to be retrieved. See
  1110  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1111  // details.
  1112  func (c *UsersSshPublicKeysCreateCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysCreateCall {
  1113  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1114  	return c
  1115  }
  1116  
  1117  // Context sets the context to be used in this call's Do method.
  1118  func (c *UsersSshPublicKeysCreateCall) Context(ctx context.Context) *UsersSshPublicKeysCreateCall {
  1119  	c.ctx_ = ctx
  1120  	return c
  1121  }
  1122  
  1123  // Header returns a http.Header that can be modified by the caller to add
  1124  // headers to the request.
  1125  func (c *UsersSshPublicKeysCreateCall) Header() http.Header {
  1126  	if c.header_ == nil {
  1127  		c.header_ = make(http.Header)
  1128  	}
  1129  	return c.header_
  1130  }
  1131  
  1132  func (c *UsersSshPublicKeysCreateCall) doRequest(alt string) (*http.Response, error) {
  1133  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1134  	var body io.Reader = nil
  1135  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
  1136  	if err != nil {
  1137  		return nil, err
  1138  	}
  1139  	c.urlParams_.Set("alt", alt)
  1140  	c.urlParams_.Set("prettyPrint", "false")
  1141  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/sshPublicKeys")
  1142  	urls += "?" + c.urlParams_.Encode()
  1143  	req, err := http.NewRequest("POST", urls, body)
  1144  	if err != nil {
  1145  		return nil, err
  1146  	}
  1147  	req.Header = reqHeaders
  1148  	googleapi.Expand(req.URL, map[string]string{
  1149  		"parent": c.parent,
  1150  	})
  1151  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1152  }
  1153  
  1154  // Do executes the "oslogin.users.sshPublicKeys.create" call.
  1155  // Any non-2xx status code is an error. Response headers are in either
  1156  // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
  1157  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1158  // whether the returned error was because http.StatusNotModified was returned.
  1159  func (c *UsersSshPublicKeysCreateCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
  1160  	gensupport.SetOptions(c.urlParams_, opts...)
  1161  	res, err := c.doRequest("json")
  1162  	if res != nil && res.StatusCode == http.StatusNotModified {
  1163  		if res.Body != nil {
  1164  			res.Body.Close()
  1165  		}
  1166  		return nil, gensupport.WrapError(&googleapi.Error{
  1167  			Code:   res.StatusCode,
  1168  			Header: res.Header,
  1169  		})
  1170  	}
  1171  	if err != nil {
  1172  		return nil, err
  1173  	}
  1174  	defer googleapi.CloseBody(res)
  1175  	if err := googleapi.CheckResponse(res); err != nil {
  1176  		return nil, gensupport.WrapError(err)
  1177  	}
  1178  	ret := &SshPublicKey{
  1179  		ServerResponse: googleapi.ServerResponse{
  1180  			Header:         res.Header,
  1181  			HTTPStatusCode: res.StatusCode,
  1182  		},
  1183  	}
  1184  	target := &ret
  1185  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1186  		return nil, err
  1187  	}
  1188  	return ret, nil
  1189  }
  1190  
  1191  type UsersSshPublicKeysDeleteCall struct {
  1192  	s          *Service
  1193  	name       string
  1194  	urlParams_ gensupport.URLParams
  1195  	ctx_       context.Context
  1196  	header_    http.Header
  1197  }
  1198  
  1199  // Delete: Deletes an SSH public key.
  1200  //
  1201  //   - name: The fingerprint of the public key to update. Public keys are
  1202  //     identified by their SHA-256 fingerprint. The fingerprint of the public key
  1203  //     is in format `users/{user}/sshPublicKeys/{fingerprint}`.
  1204  func (r *UsersSshPublicKeysService) Delete(name string) *UsersSshPublicKeysDeleteCall {
  1205  	c := &UsersSshPublicKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1206  	c.name = name
  1207  	return c
  1208  }
  1209  
  1210  // Fields allows partial responses to be retrieved. See
  1211  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1212  // details.
  1213  func (c *UsersSshPublicKeysDeleteCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysDeleteCall {
  1214  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1215  	return c
  1216  }
  1217  
  1218  // Context sets the context to be used in this call's Do method.
  1219  func (c *UsersSshPublicKeysDeleteCall) Context(ctx context.Context) *UsersSshPublicKeysDeleteCall {
  1220  	c.ctx_ = ctx
  1221  	return c
  1222  }
  1223  
  1224  // Header returns a http.Header that can be modified by the caller to add
  1225  // headers to the request.
  1226  func (c *UsersSshPublicKeysDeleteCall) Header() http.Header {
  1227  	if c.header_ == nil {
  1228  		c.header_ = make(http.Header)
  1229  	}
  1230  	return c.header_
  1231  }
  1232  
  1233  func (c *UsersSshPublicKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
  1234  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1235  	var body io.Reader = nil
  1236  	c.urlParams_.Set("alt", alt)
  1237  	c.urlParams_.Set("prettyPrint", "false")
  1238  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
  1239  	urls += "?" + c.urlParams_.Encode()
  1240  	req, err := http.NewRequest("DELETE", urls, body)
  1241  	if err != nil {
  1242  		return nil, err
  1243  	}
  1244  	req.Header = reqHeaders
  1245  	googleapi.Expand(req.URL, map[string]string{
  1246  		"name": c.name,
  1247  	})
  1248  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1249  }
  1250  
  1251  // Do executes the "oslogin.users.sshPublicKeys.delete" call.
  1252  // Any non-2xx status code is an error. Response headers are in either
  1253  // *Empty.ServerResponse.Header or (if a response was returned at all) in
  1254  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1255  // whether the returned error was because http.StatusNotModified was returned.
  1256  func (c *UsersSshPublicKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1257  	gensupport.SetOptions(c.urlParams_, opts...)
  1258  	res, err := c.doRequest("json")
  1259  	if res != nil && res.StatusCode == http.StatusNotModified {
  1260  		if res.Body != nil {
  1261  			res.Body.Close()
  1262  		}
  1263  		return nil, gensupport.WrapError(&googleapi.Error{
  1264  			Code:   res.StatusCode,
  1265  			Header: res.Header,
  1266  		})
  1267  	}
  1268  	if err != nil {
  1269  		return nil, err
  1270  	}
  1271  	defer googleapi.CloseBody(res)
  1272  	if err := googleapi.CheckResponse(res); err != nil {
  1273  		return nil, gensupport.WrapError(err)
  1274  	}
  1275  	ret := &Empty{
  1276  		ServerResponse: googleapi.ServerResponse{
  1277  			Header:         res.Header,
  1278  			HTTPStatusCode: res.StatusCode,
  1279  		},
  1280  	}
  1281  	target := &ret
  1282  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1283  		return nil, err
  1284  	}
  1285  	return ret, nil
  1286  }
  1287  
  1288  type UsersSshPublicKeysGetCall struct {
  1289  	s            *Service
  1290  	name         string
  1291  	urlParams_   gensupport.URLParams
  1292  	ifNoneMatch_ string
  1293  	ctx_         context.Context
  1294  	header_      http.Header
  1295  }
  1296  
  1297  // Get: Retrieves an SSH public key.
  1298  //
  1299  //   - name: The fingerprint of the public key to retrieve. Public keys are
  1300  //     identified by their SHA-256 fingerprint. The fingerprint of the public key
  1301  //     is in format `users/{user}/sshPublicKeys/{fingerprint}`.
  1302  func (r *UsersSshPublicKeysService) Get(name string) *UsersSshPublicKeysGetCall {
  1303  	c := &UsersSshPublicKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1304  	c.name = name
  1305  	return c
  1306  }
  1307  
  1308  // Fields allows partial responses to be retrieved. See
  1309  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1310  // details.
  1311  func (c *UsersSshPublicKeysGetCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysGetCall {
  1312  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1313  	return c
  1314  }
  1315  
  1316  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1317  // object's ETag matches the given value. This is useful for getting updates
  1318  // only after the object has changed since the last request.
  1319  func (c *UsersSshPublicKeysGetCall) IfNoneMatch(entityTag string) *UsersSshPublicKeysGetCall {
  1320  	c.ifNoneMatch_ = entityTag
  1321  	return c
  1322  }
  1323  
  1324  // Context sets the context to be used in this call's Do method.
  1325  func (c *UsersSshPublicKeysGetCall) Context(ctx context.Context) *UsersSshPublicKeysGetCall {
  1326  	c.ctx_ = ctx
  1327  	return c
  1328  }
  1329  
  1330  // Header returns a http.Header that can be modified by the caller to add
  1331  // headers to the request.
  1332  func (c *UsersSshPublicKeysGetCall) Header() http.Header {
  1333  	if c.header_ == nil {
  1334  		c.header_ = make(http.Header)
  1335  	}
  1336  	return c.header_
  1337  }
  1338  
  1339  func (c *UsersSshPublicKeysGetCall) doRequest(alt string) (*http.Response, error) {
  1340  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1341  	if c.ifNoneMatch_ != "" {
  1342  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1343  	}
  1344  	var body io.Reader = nil
  1345  	c.urlParams_.Set("alt", alt)
  1346  	c.urlParams_.Set("prettyPrint", "false")
  1347  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
  1348  	urls += "?" + c.urlParams_.Encode()
  1349  	req, err := http.NewRequest("GET", urls, body)
  1350  	if err != nil {
  1351  		return nil, err
  1352  	}
  1353  	req.Header = reqHeaders
  1354  	googleapi.Expand(req.URL, map[string]string{
  1355  		"name": c.name,
  1356  	})
  1357  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1358  }
  1359  
  1360  // Do executes the "oslogin.users.sshPublicKeys.get" call.
  1361  // Any non-2xx status code is an error. Response headers are in either
  1362  // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
  1363  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1364  // whether the returned error was because http.StatusNotModified was returned.
  1365  func (c *UsersSshPublicKeysGetCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
  1366  	gensupport.SetOptions(c.urlParams_, opts...)
  1367  	res, err := c.doRequest("json")
  1368  	if res != nil && res.StatusCode == http.StatusNotModified {
  1369  		if res.Body != nil {
  1370  			res.Body.Close()
  1371  		}
  1372  		return nil, gensupport.WrapError(&googleapi.Error{
  1373  			Code:   res.StatusCode,
  1374  			Header: res.Header,
  1375  		})
  1376  	}
  1377  	if err != nil {
  1378  		return nil, err
  1379  	}
  1380  	defer googleapi.CloseBody(res)
  1381  	if err := googleapi.CheckResponse(res); err != nil {
  1382  		return nil, gensupport.WrapError(err)
  1383  	}
  1384  	ret := &SshPublicKey{
  1385  		ServerResponse: googleapi.ServerResponse{
  1386  			Header:         res.Header,
  1387  			HTTPStatusCode: res.StatusCode,
  1388  		},
  1389  	}
  1390  	target := &ret
  1391  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1392  		return nil, err
  1393  	}
  1394  	return ret, nil
  1395  }
  1396  
  1397  type UsersSshPublicKeysPatchCall struct {
  1398  	s            *Service
  1399  	name         string
  1400  	sshpublickey *SshPublicKey
  1401  	urlParams_   gensupport.URLParams
  1402  	ctx_         context.Context
  1403  	header_      http.Header
  1404  }
  1405  
  1406  // Patch: Updates an SSH public key and returns the profile information. This
  1407  // method supports patch semantics.
  1408  //
  1409  //   - name: The fingerprint of the public key to update. Public keys are
  1410  //     identified by their SHA-256 fingerprint. The fingerprint of the public key
  1411  //     is in format `users/{user}/sshPublicKeys/{fingerprint}`.
  1412  func (r *UsersSshPublicKeysService) Patch(name string, sshpublickey *SshPublicKey) *UsersSshPublicKeysPatchCall {
  1413  	c := &UsersSshPublicKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1414  	c.name = name
  1415  	c.sshpublickey = sshpublickey
  1416  	return c
  1417  }
  1418  
  1419  // UpdateMask sets the optional parameter "updateMask": Mask to control which
  1420  // fields get updated. Updates all if not present.
  1421  func (c *UsersSshPublicKeysPatchCall) UpdateMask(updateMask string) *UsersSshPublicKeysPatchCall {
  1422  	c.urlParams_.Set("updateMask", updateMask)
  1423  	return c
  1424  }
  1425  
  1426  // Fields allows partial responses to be retrieved. See
  1427  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1428  // details.
  1429  func (c *UsersSshPublicKeysPatchCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysPatchCall {
  1430  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1431  	return c
  1432  }
  1433  
  1434  // Context sets the context to be used in this call's Do method.
  1435  func (c *UsersSshPublicKeysPatchCall) Context(ctx context.Context) *UsersSshPublicKeysPatchCall {
  1436  	c.ctx_ = ctx
  1437  	return c
  1438  }
  1439  
  1440  // Header returns a http.Header that can be modified by the caller to add
  1441  // headers to the request.
  1442  func (c *UsersSshPublicKeysPatchCall) Header() http.Header {
  1443  	if c.header_ == nil {
  1444  		c.header_ = make(http.Header)
  1445  	}
  1446  	return c.header_
  1447  }
  1448  
  1449  func (c *UsersSshPublicKeysPatchCall) doRequest(alt string) (*http.Response, error) {
  1450  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1451  	var body io.Reader = nil
  1452  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
  1453  	if err != nil {
  1454  		return nil, err
  1455  	}
  1456  	c.urlParams_.Set("alt", alt)
  1457  	c.urlParams_.Set("prettyPrint", "false")
  1458  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
  1459  	urls += "?" + c.urlParams_.Encode()
  1460  	req, err := http.NewRequest("PATCH", urls, body)
  1461  	if err != nil {
  1462  		return nil, err
  1463  	}
  1464  	req.Header = reqHeaders
  1465  	googleapi.Expand(req.URL, map[string]string{
  1466  		"name": c.name,
  1467  	})
  1468  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1469  }
  1470  
  1471  // Do executes the "oslogin.users.sshPublicKeys.patch" call.
  1472  // Any non-2xx status code is an error. Response headers are in either
  1473  // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
  1474  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1475  // whether the returned error was because http.StatusNotModified was returned.
  1476  func (c *UsersSshPublicKeysPatchCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
  1477  	gensupport.SetOptions(c.urlParams_, opts...)
  1478  	res, err := c.doRequest("json")
  1479  	if res != nil && res.StatusCode == http.StatusNotModified {
  1480  		if res.Body != nil {
  1481  			res.Body.Close()
  1482  		}
  1483  		return nil, gensupport.WrapError(&googleapi.Error{
  1484  			Code:   res.StatusCode,
  1485  			Header: res.Header,
  1486  		})
  1487  	}
  1488  	if err != nil {
  1489  		return nil, err
  1490  	}
  1491  	defer googleapi.CloseBody(res)
  1492  	if err := googleapi.CheckResponse(res); err != nil {
  1493  		return nil, gensupport.WrapError(err)
  1494  	}
  1495  	ret := &SshPublicKey{
  1496  		ServerResponse: googleapi.ServerResponse{
  1497  			Header:         res.Header,
  1498  			HTTPStatusCode: res.StatusCode,
  1499  		},
  1500  	}
  1501  	target := &ret
  1502  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1503  		return nil, err
  1504  	}
  1505  	return ret, nil
  1506  }
  1507  

View as plain text