Debian Codegraph @

oslogin/v1beta/oslogin-gen.go

raw symbols SCIP
1 // Copyright 2026 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 "log/slog"
68 "net/http"
69 "net/url"
70 "strconv"
71 "strings"
72
73 "github.com/googleapis/gax-go/v2/internallog"
74 googleapi "google.golang.org/api/googleapi"
75 internal "google.golang.org/api/internal"
76 gensupport "google.golang.org/api/internal/gensupport"
77 option "google.golang.org/api/option"
78 internaloption "google.golang.org/api/option/internaloption"
79 htransport "google.golang.org/api/transport/http"
80 )
81
82 // Always reference these packages, just in case the auto-generated code
83 // below doesn't.
84 var _ = bytes.NewBuffer
85 var _ = strconv.Itoa
86 var _ = fmt.Sprintf
87 var _ = json.NewDecoder
88 var _ = io.Copy
89 var _ = url.Parse
90 var _ = gensupport.MarshalJSON
91 var _ = googleapi.Version
92 var _ = errors.New
93 var _ = strings.Replace
94 var _ = context.Canceled
95 var _ = internaloption.WithDefaultEndpoint
96 var _ = internal.Version
97 var _ = internallog.New
98
99 const apiId = "oslogin:v1beta"
100 const apiName = "oslogin"
101 const apiVersion = "v1beta"
102 const basePath = "https://oslogin.googleapis.com/"
103 const basePathTemplate = "https://oslogin.UNIVERSE_DOMAIN/"
104 const mtlsBasePath = "https://oslogin.mtls.googleapis.com/"
105
106 // OAuth2 scopes used by this API.
107 const (
108 // See, edit, configure, and delete your Google Cloud data and see the email
109 // address for your Google Account.
110 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
111
112 // View your data across Google Cloud services and see the email address of
113 // your Google Account
114 CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
115
116 // View and manage your Google Compute Engine resources
117 ComputeScope = "https://www.googleapis.com/auth/compute"
118
119 // View your Google Compute Engine resources
120 ComputeReadonlyScope = "https://www.googleapis.com/auth/compute.readonly"
121 )
122
123 // NewService creates a new Service.
124 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
125 scopesOption := internaloption.WithDefaultScopes(
126 "https://www.googleapis.com/auth/cloud-platform",
127 "https://www.googleapis.com/auth/cloud-platform.read-only",
128 "https://www.googleapis.com/auth/compute",
129 "https://www.googleapis.com/auth/compute.readonly",
130 )
131 // NOTE: prepend, so we don't override user-specified scopes.
132 opts = append([]option.ClientOption{scopesOption}, opts...)
133 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
134 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
135 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
136 opts = append(opts, internaloption.EnableNewAuthLibrary())
137 client, endpoint, err := htransport.NewClient(ctx, opts...)
138 if err != nil {
139 return nil, err
140 }
141 s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)}
142 s.Projects = NewProjectsService(s)
143 s.Users = NewUsersService(s)
144 if endpoint != "" {
145 s.BasePath = endpoint
146 }
147 return s, nil
148 }
149
150 // New creates a new Service. It uses the provided http.Client for requests.
151 //
152 // Deprecated: please use NewService instead.
153 // To provide a custom HTTP client, use option.WithHTTPClient.
154 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
155 func New(client *http.Client) (*Service, error) {
156 if client == nil {
157 return nil, errors.New("client is nil")
158 }
159 return NewService(context.TODO(), option.WithHTTPClient(client))
160 }
161
162 type Service struct {
163 client *http.Client
164 logger *slog.Logger
165 BasePath string // API endpoint base URL
166 UserAgent string // optional additional User-Agent fragment
167
168 Projects *ProjectsService
169
170 Users *UsersService
171 }
172
173 func (s *Service) userAgent() string {
174 if s.UserAgent == "" {
175 return googleapi.UserAgent
176 }
177 return googleapi.UserAgent + " " + s.UserAgent
178 }
179
180 func NewProjectsService(s *Service) *ProjectsService {
181 rs := &ProjectsService{s: s}
182 rs.Locations = NewProjectsLocationsService(s)
183 return rs
184 }
185
186 type ProjectsService struct {
187 s *Service
188
189 Locations *ProjectsLocationsService
190 }
191
192 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
193 rs := &ProjectsLocationsService{s: s}
194 return rs
195 }
196
197 type ProjectsLocationsService struct {
198 s *Service
199 }
200
201 func NewUsersService(s *Service) *UsersService {
202 rs := &UsersService{s: s}
203 rs.Projects = NewUsersProjectsService(s)
204 rs.SshPublicKeys = NewUsersSshPublicKeysService(s)
205 return rs
206 }
207
208 type UsersService struct {
209 s *Service
210
211 Projects *UsersProjectsService
212
213 SshPublicKeys *UsersSshPublicKeysService
214 }
215
216 func NewUsersProjectsService(s *Service) *UsersProjectsService {
217 rs := &UsersProjectsService{s: s}
218 rs.Locations = NewUsersProjectsLocationsService(s)
219 rs.Zones = NewUsersProjectsZonesService(s)
220 return rs
221 }
222
223 type UsersProjectsService struct {
224 s *Service
225
226 Locations *UsersProjectsLocationsService
227
228 Zones *UsersProjectsZonesService
229 }
230
231 func NewUsersProjectsLocationsService(s *Service) *UsersProjectsLocationsService {
232 rs := &UsersProjectsLocationsService{s: s}
233 return rs
234 }
235
236 type UsersProjectsLocationsService struct {
237 s *Service
238 }
239
240 func NewUsersProjectsZonesService(s *Service) *UsersProjectsZonesService {
241 rs := &UsersProjectsZonesService{s: s}
242 return rs
243 }
244
245 type UsersProjectsZonesService struct {
246 s *Service
247 }
248
249 func NewUsersSshPublicKeysService(s *Service) *UsersSshPublicKeysService {
250 rs := &UsersSshPublicKeysService{s: s}
251 return rs
252 }
253
254 type UsersSshPublicKeysService struct {
255 s *Service
256 }
257
258 // Empty: A generic empty message that you can re-use to avoid defining
259 // duplicated empty messages in your APIs. A typical example is to use it as
260 // the request or the response type of an API method. For instance: service Foo
261 // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
262 type Empty struct {
263 // ServerResponse contains the HTTP response code and headers from the server.
264 googleapi.ServerResponse `json:"-"`
265 }
266
267 // GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyRequest: A
268 // request message for signing an SSH public key.
269 type GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyRequest struct {
270 // AppEngineInstance: The App Engine instance to sign the SSH public key for.
271 // Expected format:
272 // apps/{app}/services/{service}/versions/{version}/instances/{instance}
273 AppEngineInstance string `json:"appEngineInstance,omitempty"`
274 // ComputeInstance: The Compute instance to sign the SSH public key for.
275 // Expected format:
276 // projects/{project}/zones/{zone}/instances/{numeric_instance_id}
277 ComputeInstance string `json:"computeInstance,omitempty"`
278 // ServiceAccount: Optional. The service account for the instance. If the
279 // instance in question does not have a service account, this field should be
280 // left empty. If the wrong service account is provided, this operation will
281 // return a signed certificate that will not be accepted by the VM.
282 ServiceAccount string `json:"serviceAccount,omitempty"`
283 // SshPublicKey: Required. The SSH public key to sign.
284 SshPublicKey string `json:"sshPublicKey,omitempty"`
285 // ForceSendFields is a list of field names (e.g. "AppEngineInstance") to
286 // unconditionally include in API requests. By default, fields with empty or
287 // default values are omitted from API requests. See
288 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
289 // details.
290 ForceSendFields []string `json:"-"`
291 // NullFields is a list of field names (e.g. "AppEngineInstance") to include in
292 // API requests with the JSON null value. By default, fields with empty values
293 // are omitted from API requests. See
294 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
295 NullFields []string `json:"-"`
296 }
297
298 func (s GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyRequest) MarshalJSON() ([]byte, error) {
299 type NoMethod GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyRequest
300 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
301 }
302
303 // GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyResponse: The
304 // response message for signing an SSH public key.
305 type GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyResponse struct {
306 // SignedSshPublicKey: The signed SSH public key to use in the SSH handshake.
307 SignedSshPublicKey string `json:"signedSshPublicKey,omitempty"`
308
309 // ServerResponse contains the HTTP response code and headers from the server.
310 googleapi.ServerResponse `json:"-"`
311 // ForceSendFields is a list of field names (e.g. "SignedSshPublicKey") to
312 // unconditionally include in API requests. By default, fields with empty or
313 // default values are omitted from API requests. See
314 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
315 // details.
316 ForceSendFields []string `json:"-"`
317 // NullFields is a list of field names (e.g. "SignedSshPublicKey") to include
318 // in API requests with the JSON null value. By default, fields with empty
319 // values are omitted from API requests. See
320 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
321 NullFields []string `json:"-"`
322 }
323
324 func (s GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyResponse) MarshalJSON() ([]byte, error) {
325 type NoMethod GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyResponse
326 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
327 }
328
329 // ImportSshPublicKeyResponse: A response message for importing an SSH public
330 // key.
331 type ImportSshPublicKeyResponse struct {
332 // Details: Detailed information about import results.
333 Details string `json:"details,omitempty"`
334 // LoginProfile: The login profile information for the user.
335 LoginProfile *LoginProfile `json:"loginProfile,omitempty"`
336
337 // ServerResponse contains the HTTP response code and headers from the server.
338 googleapi.ServerResponse `json:"-"`
339 // ForceSendFields is a list of field names (e.g. "Details") to unconditionally
340 // include in API requests. By default, fields with empty or default values are
341 // omitted from API requests. See
342 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
343 // details.
344 ForceSendFields []string `json:"-"`
345 // NullFields is a list of field names (e.g. "Details") to include in API
346 // requests with the JSON null value. By default, fields with empty values are
347 // omitted from API requests. See
348 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
349 NullFields []string `json:"-"`
350 }
351
352 func (s ImportSshPublicKeyResponse) MarshalJSON() ([]byte, error) {
353 type NoMethod ImportSshPublicKeyResponse
354 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
355 }
356
357 // LoginProfile: The user profile information used for logging in to a virtual
358 // machine on Google Compute Engine.
359 type LoginProfile struct {
360 // Name: Required. A unique user ID.
361 Name string `json:"name,omitempty"`
362 // PosixAccounts: The list of POSIX accounts associated with the user.
363 PosixAccounts []*PosixAccount `json:"posixAccounts,omitempty"`
364 // SecurityKeys: The registered security key credentials for a user.
365 SecurityKeys []*SecurityKey `json:"securityKeys,omitempty"`
366 // SshPublicKeys: A map from SSH public key fingerprint to the associated key
367 // object.
368 SshPublicKeys map[string]SshPublicKey `json:"sshPublicKeys,omitempty"`
369
370 // ServerResponse contains the HTTP response code and headers from the server.
371 googleapi.ServerResponse `json:"-"`
372 // ForceSendFields is a list of field names (e.g. "Name") to unconditionally
373 // include in API requests. By default, fields with empty or default values are
374 // omitted from API requests. See
375 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
376 // details.
377 ForceSendFields []string `json:"-"`
378 // NullFields is a list of field names (e.g. "Name") to include in API requests
379 // with the JSON null value. By default, fields with empty values are omitted
380 // from API requests. See
381 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
382 NullFields []string `json:"-"`
383 }
384
385 func (s LoginProfile) MarshalJSON() ([]byte, error) {
386 type NoMethod LoginProfile
387 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
388 }
389
390 // PosixAccount: The POSIX account information associated with a Google
391 // account.
392 type PosixAccount struct {
393 // AccountId: Output only. A POSIX account identifier.
394 AccountId string `json:"accountId,omitempty"`
395 // Gecos: The GECOS (user information) entry for this account.
396 Gecos string `json:"gecos,omitempty"`
397 // Gid: The default group ID.
398 Gid int64 `json:"gid,omitempty,string"`
399 // HomeDirectory: The path to the home directory for this account.
400 HomeDirectory string `json:"homeDirectory,omitempty"`
401 // Name: Output only. The canonical resource name.
402 Name string `json:"name,omitempty"`
403 // OperatingSystemType: The operating system type where this account applies.
404 //
405 // Possible values:
406 // "OPERATING_SYSTEM_TYPE_UNSPECIFIED" - The operating system type associated
407 // with the user account information is unspecified.
408 // "LINUX" - Linux user account information.
409 // "WINDOWS" - Windows user account information.
410 OperatingSystemType string `json:"operatingSystemType,omitempty"`
411 // Primary: Only one POSIX account can be marked as primary.
412 Primary bool `json:"primary,omitempty"`
413 // Shell: The path to the logic shell for this account.
414 Shell string `json:"shell,omitempty"`
415 // SystemId: System identifier for which account the username or uid applies
416 // to. By default, the empty value is used.
417 SystemId string `json:"systemId,omitempty"`
418 // Uid: The user ID.
419 Uid int64 `json:"uid,omitempty,string"`
420 // Username: The username of the POSIX account.
421 Username string `json:"username,omitempty"`
422
423 // ServerResponse contains the HTTP response code and headers from the server.
424 googleapi.ServerResponse `json:"-"`
425 // ForceSendFields is a list of field names (e.g. "AccountId") to
426 // unconditionally include in API requests. By default, fields with empty or
427 // default values are omitted from API requests. See
428 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
429 // details.
430 ForceSendFields []string `json:"-"`
431 // NullFields is a list of field names (e.g. "AccountId") to include in API
432 // requests with the JSON null value. By default, fields with empty values are
433 // omitted from API requests. See
434 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
435 NullFields []string `json:"-"`
436 }
437
438 func (s PosixAccount) MarshalJSON() ([]byte, error) {
439 type NoMethod PosixAccount
440 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
441 }
442
443 // ProvisionPosixAccountRequest: A request message for creating a POSIX account
444 // entry.
445 type ProvisionPosixAccountRequest struct {
446 // Regions: Optional. The regions to wait for a POSIX account to be written to
447 // before returning a response. If unspecified, defaults to all regions.
448 // Regions are listed at https://cloud.google.com/about/locations#region.
449 Regions []string `json:"regions,omitempty"`
450 // ForceSendFields is a list of field names (e.g. "Regions") to unconditionally
451 // include in API requests. By default, fields with empty or default values are
452 // omitted from API requests. See
453 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
454 // details.
455 ForceSendFields []string `json:"-"`
456 // NullFields is a list of field names (e.g. "Regions") to include in API
457 // requests with the JSON null value. By default, fields with empty values are
458 // omitted from API requests. See
459 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
460 NullFields []string `json:"-"`
461 }
462
463 func (s ProvisionPosixAccountRequest) MarshalJSON() ([]byte, error) {
464 type NoMethod ProvisionPosixAccountRequest
465 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
466 }
467
468 // SecurityKey: The credential information for a Google registered security
469 // key.
470 type SecurityKey struct {
471 // DeviceNickname: The security key nickname explicitly set by the user.
472 DeviceNickname string `json:"deviceNickname,omitempty"`
473 // PrivateKey: Hardware-backed private key text in SSH format.
474 PrivateKey string `json:"privateKey,omitempty"`
475 // PublicKey: Public key text in SSH format, defined by RFC4253
476 // ("https://www.ietf.org/rfc/rfc4253.txt") section 6.6.
477 PublicKey string `json:"publicKey,omitempty"`
478 // UniversalTwoFactor: The U2F protocol type.
479 UniversalTwoFactor *UniversalTwoFactor `json:"universalTwoFactor,omitempty"`
480 // WebAuthn: The Web Authentication protocol type.
481 WebAuthn *WebAuthn `json:"webAuthn,omitempty"`
482 // ForceSendFields is a list of field names (e.g. "DeviceNickname") to
483 // unconditionally include in API requests. By default, fields with empty or
484 // default values are omitted from API requests. See
485 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
486 // details.
487 ForceSendFields []string `json:"-"`
488 // NullFields is a list of field names (e.g. "DeviceNickname") to include in
489 // API requests with the JSON null value. By default, fields with empty values
490 // are omitted from API requests. See
491 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
492 NullFields []string `json:"-"`
493 }
494
495 func (s SecurityKey) MarshalJSON() ([]byte, error) {
496 type NoMethod SecurityKey
497 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
498 }
499
500 type SignSshPublicKeyRequest struct {
501 // SshPublicKey: Required. The SSH public key to sign.
502 SshPublicKey string `json:"sshPublicKey,omitempty"`
503 // ForceSendFields is a list of field names (e.g. "SshPublicKey") to
504 // unconditionally include in API requests. By default, fields with empty or
505 // default values are omitted from API requests. See
506 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
507 // details.
508 ForceSendFields []string `json:"-"`
509 // NullFields is a list of field names (e.g. "SshPublicKey") to include in API
510 // requests with the JSON null value. By default, fields with empty values are
511 // omitted from API requests. See
512 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
513 NullFields []string `json:"-"`
514 }
515
516 func (s SignSshPublicKeyRequest) MarshalJSON() ([]byte, error) {
517 type NoMethod SignSshPublicKeyRequest
518 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
519 }
520
521 type SignSshPublicKeyResponse struct {
522 // SignedSshPublicKey: The signed SSH public key to use in the SSH handshake.
523 SignedSshPublicKey string `json:"signedSshPublicKey,omitempty"`
524
525 // ServerResponse contains the HTTP response code and headers from the server.
526 googleapi.ServerResponse `json:"-"`
527 // ForceSendFields is a list of field names (e.g. "SignedSshPublicKey") to
528 // unconditionally include in API requests. By default, fields with empty or
529 // default values are omitted from API requests. See
530 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
531 // details.
532 ForceSendFields []string `json:"-"`
533 // NullFields is a list of field names (e.g. "SignedSshPublicKey") to include
534 // in API requests with the JSON null value. By default, fields with empty
535 // values are omitted from API requests. See
536 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
537 NullFields []string `json:"-"`
538 }
539
540 func (s SignSshPublicKeyResponse) MarshalJSON() ([]byte, error) {
541 type NoMethod SignSshPublicKeyResponse
542 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
543 }
544
545 // SshPublicKey: The SSH public key information associated with a Google
546 // account.
547 type SshPublicKey struct {
548 // ExpirationTimeUsec: An expiration time in microseconds since epoch.
549 ExpirationTimeUsec int64 `json:"expirationTimeUsec,omitempty,string"`
550 // Fingerprint: Output only. The SHA-256 fingerprint of the SSH public key.
551 Fingerprint string `json:"fingerprint,omitempty"`
552 // Key: Required. Public key text in SSH format, defined by RFC4253
553 // (https://www.ietf.org/rfc/rfc4253.txt) section 6.6.
554 Key string `json:"key,omitempty"`
555 // Name: Output only. The canonical resource name.
556 Name string `json:"name,omitempty"`
557
558 // ServerResponse contains the HTTP response code and headers from the server.
559 googleapi.ServerResponse `json:"-"`
560 // ForceSendFields is a list of field names (e.g. "ExpirationTimeUsec") to
561 // unconditionally include in API requests. By default, fields with empty or
562 // default values are omitted from API requests. See
563 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
564 // details.
565 ForceSendFields []string `json:"-"`
566 // NullFields is a list of field names (e.g. "ExpirationTimeUsec") to include
567 // in API requests with the JSON null value. By default, fields with empty
568 // values are omitted from API requests. See
569 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
570 NullFields []string `json:"-"`
571 }
572
573 func (s SshPublicKey) MarshalJSON() ([]byte, error) {
574 type NoMethod SshPublicKey
575 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
576 }
577
578 // UniversalTwoFactor: Security key information specific to the U2F protocol.
579 type UniversalTwoFactor struct {
580 // AppId: Application ID for the U2F protocol.
581 AppId string `json:"appId,omitempty"`
582 // ForceSendFields is a list of field names (e.g. "AppId") to unconditionally
583 // include in API requests. By default, fields with empty or default values are
584 // omitted from API requests. See
585 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
586 // details.
587 ForceSendFields []string `json:"-"`
588 // NullFields is a list of field names (e.g. "AppId") to include in API
589 // requests with the JSON null value. By default, fields with empty values are
590 // omitted from API requests. See
591 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
592 NullFields []string `json:"-"`
593 }
594
595 func (s UniversalTwoFactor) MarshalJSON() ([]byte, error) {
596 type NoMethod UniversalTwoFactor
597 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
598 }
599
600 // WebAuthn: Security key information specific to the Web Authentication
601 // protocol.
602 type WebAuthn struct {
603 // RpId: Relying party ID for Web Authentication.
604 RpId string `json:"rpId,omitempty"`
605 // ForceSendFields is a list of field names (e.g. "RpId") to unconditionally
606 // include in API requests. By default, fields with empty or default values are
607 // omitted from API requests. See
608 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
609 // details.
610 ForceSendFields []string `json:"-"`
611 // NullFields is a list of field names (e.g. "RpId") to include in API requests
612 // with the JSON null value. By default, fields with empty values are omitted
613 // from API requests. See
614 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
615 NullFields []string `json:"-"`
616 }
617
618 func (s WebAuthn) MarshalJSON() ([]byte, error) {
619 type NoMethod WebAuthn
620 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
621 }
622
623 type ProjectsLocationsSignSshPublicKeyCall struct {
624 s *Service
625 parent string
626 googlecloudoslogincontrolplaneregionalv1betasignsshpublickeyrequest *GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyRequest
627 urlParams_ gensupport.URLParams
628 ctx_ context.Context
629 header_ http.Header
630 }
631
632 // SignSshPublicKey: Signs an SSH public key for a user to authenticate to a
633 // virtual machine on Google Compute Engine.
634 //
635 // - parent: The parent for the signing request. Format:
636 // projects/{project}/locations/{location}.
637 func (r *ProjectsLocationsService) SignSshPublicKey(parent string, googlecloudoslogincontrolplaneregionalv1betasignsshpublickeyrequest *GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyRequest) *ProjectsLocationsSignSshPublicKeyCall {
638 c := &ProjectsLocationsSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
639 c.parent = parent
640 c.googlecloudoslogincontrolplaneregionalv1betasignsshpublickeyrequest = googlecloudoslogincontrolplaneregionalv1betasignsshpublickeyrequest
641 return c
642 }
643
644 // Fields allows partial responses to be retrieved. See
645 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
646 // details.
647 func (c *ProjectsLocationsSignSshPublicKeyCall) Fields(s ...googleapi.Field) *ProjectsLocationsSignSshPublicKeyCall {
648 c.urlParams_.Set("fields", googleapi.CombineFields(s))
649 return c
650 }
651
652 // Context sets the context to be used in this call's Do method.
653 func (c *ProjectsLocationsSignSshPublicKeyCall) Context(ctx context.Context) *ProjectsLocationsSignSshPublicKeyCall {
654 c.ctx_ = ctx
655 return c
656 }
657
658 // Header returns a http.Header that can be modified by the caller to add
659 // headers to the request.
660 func (c *ProjectsLocationsSignSshPublicKeyCall) Header() http.Header {
661 if c.header_ == nil {
662 c.header_ = make(http.Header)
663 }
664 return c.header_
665 }
666
667 func (c *ProjectsLocationsSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
668 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
669 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.googlecloudoslogincontrolplaneregionalv1betasignsshpublickeyrequest)
670 if err != nil {
671 return nil, err
672 }
673 c.urlParams_.Set("alt", alt)
674 c.urlParams_.Set("prettyPrint", "false")
675 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:signSshPublicKey")
676 urls += "?" + c.urlParams_.Encode()
677 req, err := http.NewRequest("POST", urls, body)
678 if err != nil {
679 return nil, err
680 }
681 req.Header = reqHeaders
682 googleapi.Expand(req.URL, map[string]string{
683 "parent": c.parent,
684 })
685 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.projects.locations.signSshPublicKey", "request", internallog.HTTPRequest(req, body.Bytes()))
686 return gensupport.SendRequest(c.ctx_, c.s.client, req)
687 }
688
689 // Do executes the "oslogin.projects.locations.signSshPublicKey" call.
690 // Any non-2xx status code is an error. Response headers are in either
691 // *GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyResponse.ServerR
692 // esponse.Header or (if a response was returned at all) in
693 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
694 // whether the returned error was because http.StatusNotModified was returned.
695 func (c *ProjectsLocationsSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyResponse, error) {
696 gensupport.SetOptions(c.urlParams_, opts...)
697 res, err := c.doRequest("json")
698 if res != nil && res.StatusCode == http.StatusNotModified {
699 if res.Body != nil {
700 res.Body.Close()
701 }
702 return nil, gensupport.WrapError(&googleapi.Error{
703 Code: res.StatusCode,
704 Header: res.Header,
705 })
706 }
707 if err != nil {
708 return nil, err
709 }
710 defer googleapi.CloseBody(res)
711 if err := googleapi.CheckResponse(res); err != nil {
712 return nil, gensupport.WrapError(err)
713 }
714 ret := &GoogleCloudOsloginControlplaneRegionalV1betaSignSshPublicKeyResponse{
715 ServerResponse: googleapi.ServerResponse{
716 Header: res.Header,
717 HTTPStatusCode: res.StatusCode,
718 },
719 }
720 target := &ret
721 b, err := gensupport.DecodeResponseBytes(target, res)
722 if err != nil {
723 return nil, err
724 }
725 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.projects.locations.signSshPublicKey", "response", internallog.HTTPResponse(res, b))
726 return ret, nil
727 }
728
729 type UsersGetLoginProfileCall struct {
730 s *Service
731 name string
732 urlParams_ gensupport.URLParams
733 ifNoneMatch_ string
734 ctx_ context.Context
735 header_ http.Header
736 }
737
738 // GetLoginProfile: Retrieves the profile information used for logging in to a
739 // virtual machine on Google Compute Engine.
740 //
741 // - name: The unique ID for the user in format `users/{user}`.
742 func (r *UsersService) GetLoginProfile(name string) *UsersGetLoginProfileCall {
743 c := &UsersGetLoginProfileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
744 c.name = name
745 return c
746 }
747
748 // ProjectId sets the optional parameter "projectId": Required. The project ID
749 // of the Google Cloud Platform project.
750 func (c *UsersGetLoginProfileCall) ProjectId(projectId string) *UsersGetLoginProfileCall {
751 c.urlParams_.Set("projectId", projectId)
752 return c
753 }
754
755 // SystemId sets the optional parameter "systemId": A system ID for filtering
756 // the results of the request.
757 func (c *UsersGetLoginProfileCall) SystemId(systemId string) *UsersGetLoginProfileCall {
758 c.urlParams_.Set("systemId", systemId)
759 return c
760 }
761
762 // View sets the optional parameter "view": The view configures whether to
763 // retrieve security keys information.
764 //
765 // Possible values:
766 //
767 // "LOGIN_PROFILE_VIEW_UNSPECIFIED" - The default login profile view. The API
768 //
769 // defaults to the BASIC view.
770 //
771 // "BASIC" - Includes POSIX and SSH key information.
772 // "SECURITY_KEY" - Include security key information for the user.
773 func (c *UsersGetLoginProfileCall) View(view string) *UsersGetLoginProfileCall {
774 c.urlParams_.Set("view", view)
775 return c
776 }
777
778 // Fields allows partial responses to be retrieved. See
779 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
780 // details.
781 func (c *UsersGetLoginProfileCall) Fields(s ...googleapi.Field) *UsersGetLoginProfileCall {
782 c.urlParams_.Set("fields", googleapi.CombineFields(s))
783 return c
784 }
785
786 // IfNoneMatch sets an optional parameter which makes the operation fail if the
787 // object's ETag matches the given value. This is useful for getting updates
788 // only after the object has changed since the last request.
789 func (c *UsersGetLoginProfileCall) IfNoneMatch(entityTag string) *UsersGetLoginProfileCall {
790 c.ifNoneMatch_ = entityTag
791 return c
792 }
793
794 // Context sets the context to be used in this call's Do method.
795 func (c *UsersGetLoginProfileCall) Context(ctx context.Context) *UsersGetLoginProfileCall {
796 c.ctx_ = ctx
797 return c
798 }
799
800 // Header returns a http.Header that can be modified by the caller to add
801 // headers to the request.
802 func (c *UsersGetLoginProfileCall) Header() http.Header {
803 if c.header_ == nil {
804 c.header_ = make(http.Header)
805 }
806 return c.header_
807 }
808
809 func (c *UsersGetLoginProfileCall) doRequest(alt string) (*http.Response, error) {
810 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
811 if c.ifNoneMatch_ != "" {
812 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
813 }
814 c.urlParams_.Set("alt", alt)
815 c.urlParams_.Set("prettyPrint", "false")
816 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}/loginProfile")
817 urls += "?" + c.urlParams_.Encode()
818 req, err := http.NewRequest("GET", urls, nil)
819 if err != nil {
820 return nil, err
821 }
822 req.Header = reqHeaders
823 googleapi.Expand(req.URL, map[string]string{
824 "name": c.name,
825 })
826 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.getLoginProfile", "request", internallog.HTTPRequest(req, nil))
827 return gensupport.SendRequest(c.ctx_, c.s.client, req)
828 }
829
830 // Do executes the "oslogin.users.getLoginProfile" call.
831 // Any non-2xx status code is an error. Response headers are in either
832 // *LoginProfile.ServerResponse.Header or (if a response was returned at all)
833 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
834 // whether the returned error was because http.StatusNotModified was returned.
835 func (c *UsersGetLoginProfileCall) Do(opts ...googleapi.CallOption) (*LoginProfile, error) {
836 gensupport.SetOptions(c.urlParams_, opts...)
837 res, err := c.doRequest("json")
838 if res != nil && res.StatusCode == http.StatusNotModified {
839 if res.Body != nil {
840 res.Body.Close()
841 }
842 return nil, gensupport.WrapError(&googleapi.Error{
843 Code: res.StatusCode,
844 Header: res.Header,
845 })
846 }
847 if err != nil {
848 return nil, err
849 }
850 defer googleapi.CloseBody(res)
851 if err := googleapi.CheckResponse(res); err != nil {
852 return nil, gensupport.WrapError(err)
853 }
854 ret := &LoginProfile{
855 ServerResponse: googleapi.ServerResponse{
856 Header: res.Header,
857 HTTPStatusCode: res.StatusCode,
858 },
859 }
860 target := &ret
861 b, err := gensupport.DecodeResponseBytes(target, res)
862 if err != nil {
863 return nil, err
864 }
865 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.getLoginProfile", "response", internallog.HTTPResponse(res, b))
866 return ret, nil
867 }
868
869 type UsersImportSshPublicKeyCall struct {
870 s *Service
871 parent string
872 sshpublickey *SshPublicKey
873 urlParams_ gensupport.URLParams
874 ctx_ context.Context
875 header_ http.Header
876 }
877
878 // ImportSshPublicKey: Adds an SSH public key and returns the profile
879 // information. Default POSIX account information is set when no username and
880 // UID exist as part of the login profile.
881 //
882 // - parent: The unique ID for the user in format `users/{user}`.
883 func (r *UsersService) ImportSshPublicKey(parent string, sshpublickey *SshPublicKey) *UsersImportSshPublicKeyCall {
884 c := &UsersImportSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
885 c.parent = parent
886 c.sshpublickey = sshpublickey
887 return c
888 }
889
890 // ProjectId sets the optional parameter "projectId": The project ID of the
891 // Google Cloud Platform project.
892 func (c *UsersImportSshPublicKeyCall) ProjectId(projectId string) *UsersImportSshPublicKeyCall {
893 c.urlParams_.Set("projectId", projectId)
894 return c
895 }
896
897 // Regions sets the optional parameter "regions": The regions to which to
898 // assert that the key was written. If unspecified, defaults to all regions.
899 // Regions are listed at https://cloud.google.com/about/locations#region.
900 func (c *UsersImportSshPublicKeyCall) Regions(regions ...string) *UsersImportSshPublicKeyCall {
901 c.urlParams_.SetMulti("regions", append([]string{}, regions...))
902 return c
903 }
904
905 // View sets the optional parameter "view": The view configures whether to
906 // retrieve security keys information.
907 //
908 // Possible values:
909 //
910 // "LOGIN_PROFILE_VIEW_UNSPECIFIED" - The default login profile view. The API
911 //
912 // defaults to the BASIC view.
913 //
914 // "BASIC" - Includes POSIX and SSH key information.
915 // "SECURITY_KEY" - Include security key information for the user.
916 func (c *UsersImportSshPublicKeyCall) View(view string) *UsersImportSshPublicKeyCall {
917 c.urlParams_.Set("view", view)
918 return c
919 }
920
921 // Fields allows partial responses to be retrieved. See
922 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
923 // details.
924 func (c *UsersImportSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersImportSshPublicKeyCall {
925 c.urlParams_.Set("fields", googleapi.CombineFields(s))
926 return c
927 }
928
929 // Context sets the context to be used in this call's Do method.
930 func (c *UsersImportSshPublicKeyCall) Context(ctx context.Context) *UsersImportSshPublicKeyCall {
931 c.ctx_ = ctx
932 return c
933 }
934
935 // Header returns a http.Header that can be modified by the caller to add
936 // headers to the request.
937 func (c *UsersImportSshPublicKeyCall) Header() http.Header {
938 if c.header_ == nil {
939 c.header_ = make(http.Header)
940 }
941 return c.header_
942 }
943
944 func (c *UsersImportSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
945 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
946 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.sshpublickey)
947 if err != nil {
948 return nil, err
949 }
950 c.urlParams_.Set("alt", alt)
951 c.urlParams_.Set("prettyPrint", "false")
952 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:importSshPublicKey")
953 urls += "?" + c.urlParams_.Encode()
954 req, err := http.NewRequest("POST", urls, body)
955 if err != nil {
956 return nil, err
957 }
958 req.Header = reqHeaders
959 googleapi.Expand(req.URL, map[string]string{
960 "parent": c.parent,
961 })
962 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.importSshPublicKey", "request", internallog.HTTPRequest(req, body.Bytes()))
963 return gensupport.SendRequest(c.ctx_, c.s.client, req)
964 }
965
966 // Do executes the "oslogin.users.importSshPublicKey" call.
967 // Any non-2xx status code is an error. Response headers are in either
968 // *ImportSshPublicKeyResponse.ServerResponse.Header or (if a response was
969 // returned at all) in error.(*googleapi.Error).Header. Use
970 // googleapi.IsNotModified to check whether the returned error was because
971 // http.StatusNotModified was returned.
972 func (c *UsersImportSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*ImportSshPublicKeyResponse, error) {
973 gensupport.SetOptions(c.urlParams_, opts...)
974 res, err := c.doRequest("json")
975 if res != nil && res.StatusCode == http.StatusNotModified {
976 if res.Body != nil {
977 res.Body.Close()
978 }
979 return nil, gensupport.WrapError(&googleapi.Error{
980 Code: res.StatusCode,
981 Header: res.Header,
982 })
983 }
984 if err != nil {
985 return nil, err
986 }
987 defer googleapi.CloseBody(res)
988 if err := googleapi.CheckResponse(res); err != nil {
989 return nil, gensupport.WrapError(err)
990 }
991 ret := &ImportSshPublicKeyResponse{
992 ServerResponse: googleapi.ServerResponse{
993 Header: res.Header,
994 HTTPStatusCode: res.StatusCode,
995 },
996 }
997 target := &ret
998 b, err := gensupport.DecodeResponseBytes(target, res)
999 if err != nil {
1000 return nil, err
1001 }
1002 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.importSshPublicKey", "response", internallog.HTTPResponse(res, b))
1003 return ret, nil
1004 }
1005
1006 type UsersProjectsDeleteCall struct {
1007 s *Service
1008 name string
1009 urlParams_ gensupport.URLParams
1010 ctx_ context.Context
1011 header_ http.Header
1012 }
1013
1014 // Delete: Deletes a POSIX account.
1015 //
1016 // - name: A reference to the POSIX account to update. POSIX accounts are
1017 // identified by the project ID they are associated with. A reference to the
1018 // POSIX account is in format `users/{user}/projects/{project}`.
1019 func (r *UsersProjectsService) Delete(name string) *UsersProjectsDeleteCall {
1020 c := &UsersProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1021 c.name = name
1022 return c
1023 }
1024
1025 // Fields allows partial responses to be retrieved. See
1026 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1027 // details.
1028 func (c *UsersProjectsDeleteCall) Fields(s ...googleapi.Field) *UsersProjectsDeleteCall {
1029 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1030 return c
1031 }
1032
1033 // Context sets the context to be used in this call's Do method.
1034 func (c *UsersProjectsDeleteCall) Context(ctx context.Context) *UsersProjectsDeleteCall {
1035 c.ctx_ = ctx
1036 return c
1037 }
1038
1039 // Header returns a http.Header that can be modified by the caller to add
1040 // headers to the request.
1041 func (c *UsersProjectsDeleteCall) Header() http.Header {
1042 if c.header_ == nil {
1043 c.header_ = make(http.Header)
1044 }
1045 return c.header_
1046 }
1047
1048 func (c *UsersProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
1049 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1050 c.urlParams_.Set("alt", alt)
1051 c.urlParams_.Set("prettyPrint", "false")
1052 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
1053 urls += "?" + c.urlParams_.Encode()
1054 req, err := http.NewRequest("DELETE", urls, nil)
1055 if err != nil {
1056 return nil, err
1057 }
1058 req.Header = reqHeaders
1059 googleapi.Expand(req.URL, map[string]string{
1060 "name": c.name,
1061 })
1062 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.projects.delete", "request", internallog.HTTPRequest(req, nil))
1063 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1064 }
1065
1066 // Do executes the "oslogin.users.projects.delete" call.
1067 // Any non-2xx status code is an error. Response headers are in either
1068 // *Empty.ServerResponse.Header or (if a response was returned at all) in
1069 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1070 // whether the returned error was because http.StatusNotModified was returned.
1071 func (c *UsersProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1072 gensupport.SetOptions(c.urlParams_, opts...)
1073 res, err := c.doRequest("json")
1074 if res != nil && res.StatusCode == http.StatusNotModified {
1075 if res.Body != nil {
1076 res.Body.Close()
1077 }
1078 return nil, gensupport.WrapError(&googleapi.Error{
1079 Code: res.StatusCode,
1080 Header: res.Header,
1081 })
1082 }
1083 if err != nil {
1084 return nil, err
1085 }
1086 defer googleapi.CloseBody(res)
1087 if err := googleapi.CheckResponse(res); err != nil {
1088 return nil, gensupport.WrapError(err)
1089 }
1090 ret := &Empty{
1091 ServerResponse: googleapi.ServerResponse{
1092 Header: res.Header,
1093 HTTPStatusCode: res.StatusCode,
1094 },
1095 }
1096 target := &ret
1097 b, err := gensupport.DecodeResponseBytes(target, res)
1098 if err != nil {
1099 return nil, err
1100 }
1101 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.projects.delete", "response", internallog.HTTPResponse(res, b))
1102 return ret, nil
1103 }
1104
1105 type UsersProjectsProvisionPosixAccountCall struct {
1106 s *Service
1107 name string
1108 provisionposixaccountrequest *ProvisionPosixAccountRequest
1109 urlParams_ gensupport.URLParams
1110 ctx_ context.Context
1111 header_ http.Header
1112 }
1113
1114 // ProvisionPosixAccount: Create a POSIX account if it doesn't exist.
1115 //
1116 // - name: The unique ID for the user in format
1117 // `users/{user}/projects/{project}`.
1118 func (r *UsersProjectsService) ProvisionPosixAccount(name string, provisionposixaccountrequest *ProvisionPosixAccountRequest) *UsersProjectsProvisionPosixAccountCall {
1119 c := &UsersProjectsProvisionPosixAccountCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1120 c.name = name
1121 c.provisionposixaccountrequest = provisionposixaccountrequest
1122 return c
1123 }
1124
1125 // Fields allows partial responses to be retrieved. See
1126 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1127 // details.
1128 func (c *UsersProjectsProvisionPosixAccountCall) Fields(s ...googleapi.Field) *UsersProjectsProvisionPosixAccountCall {
1129 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1130 return c
1131 }
1132
1133 // Context sets the context to be used in this call's Do method.
1134 func (c *UsersProjectsProvisionPosixAccountCall) Context(ctx context.Context) *UsersProjectsProvisionPosixAccountCall {
1135 c.ctx_ = ctx
1136 return c
1137 }
1138
1139 // Header returns a http.Header that can be modified by the caller to add
1140 // headers to the request.
1141 func (c *UsersProjectsProvisionPosixAccountCall) Header() http.Header {
1142 if c.header_ == nil {
1143 c.header_ = make(http.Header)
1144 }
1145 return c.header_
1146 }
1147
1148 func (c *UsersProjectsProvisionPosixAccountCall) doRequest(alt string) (*http.Response, error) {
1149 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1150 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.provisionposixaccountrequest)
1151 if err != nil {
1152 return nil, err
1153 }
1154 c.urlParams_.Set("alt", alt)
1155 c.urlParams_.Set("prettyPrint", "false")
1156 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
1157 urls += "?" + c.urlParams_.Encode()
1158 req, err := http.NewRequest("POST", urls, body)
1159 if err != nil {
1160 return nil, err
1161 }
1162 req.Header = reqHeaders
1163 googleapi.Expand(req.URL, map[string]string{
1164 "name": c.name,
1165 })
1166 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.projects.provisionPosixAccount", "request", internallog.HTTPRequest(req, body.Bytes()))
1167 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1168 }
1169
1170 // Do executes the "oslogin.users.projects.provisionPosixAccount" call.
1171 // Any non-2xx status code is an error. Response headers are in either
1172 // *PosixAccount.ServerResponse.Header or (if a response was returned at all)
1173 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1174 // whether the returned error was because http.StatusNotModified was returned.
1175 func (c *UsersProjectsProvisionPosixAccountCall) Do(opts ...googleapi.CallOption) (*PosixAccount, error) {
1176 gensupport.SetOptions(c.urlParams_, opts...)
1177 res, err := c.doRequest("json")
1178 if res != nil && res.StatusCode == http.StatusNotModified {
1179 if res.Body != nil {
1180 res.Body.Close()
1181 }
1182 return nil, gensupport.WrapError(&googleapi.Error{
1183 Code: res.StatusCode,
1184 Header: res.Header,
1185 })
1186 }
1187 if err != nil {
1188 return nil, err
1189 }
1190 defer googleapi.CloseBody(res)
1191 if err := googleapi.CheckResponse(res); err != nil {
1192 return nil, gensupport.WrapError(err)
1193 }
1194 ret := &PosixAccount{
1195 ServerResponse: googleapi.ServerResponse{
1196 Header: res.Header,
1197 HTTPStatusCode: res.StatusCode,
1198 },
1199 }
1200 target := &ret
1201 b, err := gensupport.DecodeResponseBytes(target, res)
1202 if err != nil {
1203 return nil, err
1204 }
1205 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.projects.provisionPosixAccount", "response", internallog.HTTPResponse(res, b))
1206 return ret, nil
1207 }
1208
1209 type UsersProjectsLocationsSignSshPublicKeyCall struct {
1210 s *Service
1211 parent string
1212 signsshpublickeyrequest *SignSshPublicKeyRequest
1213 urlParams_ gensupport.URLParams
1214 ctx_ context.Context
1215 header_ http.Header
1216 }
1217
1218 // SignSshPublicKey: Signs an SSH public key for a user to authenticate to an
1219 // instance.
1220 //
1221 // - parent: The parent project and region for the signing request.
1222 func (r *UsersProjectsLocationsService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsLocationsSignSshPublicKeyCall {
1223 c := &UsersProjectsLocationsSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1224 c.parent = parent
1225 c.signsshpublickeyrequest = signsshpublickeyrequest
1226 return c
1227 }
1228
1229 // Fields allows partial responses to be retrieved. See
1230 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1231 // details.
1232 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsLocationsSignSshPublicKeyCall {
1233 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1234 return c
1235 }
1236
1237 // Context sets the context to be used in this call's Do method.
1238 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsLocationsSignSshPublicKeyCall {
1239 c.ctx_ = ctx
1240 return c
1241 }
1242
1243 // Header returns a http.Header that can be modified by the caller to add
1244 // headers to the request.
1245 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Header() http.Header {
1246 if c.header_ == nil {
1247 c.header_ = make(http.Header)
1248 }
1249 return c.header_
1250 }
1251
1252 func (c *UsersProjectsLocationsSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
1253 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1254 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.signsshpublickeyrequest)
1255 if err != nil {
1256 return nil, err
1257 }
1258 c.urlParams_.Set("alt", alt)
1259 c.urlParams_.Set("prettyPrint", "false")
1260 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:signSshPublicKey")
1261 urls += "?" + c.urlParams_.Encode()
1262 req, err := http.NewRequest("POST", urls, body)
1263 if err != nil {
1264 return nil, err
1265 }
1266 req.Header = reqHeaders
1267 googleapi.Expand(req.URL, map[string]string{
1268 "parent": c.parent,
1269 })
1270 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.projects.locations.signSshPublicKey", "request", internallog.HTTPRequest(req, body.Bytes()))
1271 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1272 }
1273
1274 // Do executes the "oslogin.users.projects.locations.signSshPublicKey" call.
1275 // Any non-2xx status code is an error. Response headers are in either
1276 // *SignSshPublicKeyResponse.ServerResponse.Header or (if a response was
1277 // returned at all) in error.(*googleapi.Error).Header. Use
1278 // googleapi.IsNotModified to check whether the returned error was because
1279 // http.StatusNotModified was returned.
1280 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
1281 gensupport.SetOptions(c.urlParams_, opts...)
1282 res, err := c.doRequest("json")
1283 if res != nil && res.StatusCode == http.StatusNotModified {
1284 if res.Body != nil {
1285 res.Body.Close()
1286 }
1287 return nil, gensupport.WrapError(&googleapi.Error{
1288 Code: res.StatusCode,
1289 Header: res.Header,
1290 })
1291 }
1292 if err != nil {
1293 return nil, err
1294 }
1295 defer googleapi.CloseBody(res)
1296 if err := googleapi.CheckResponse(res); err != nil {
1297 return nil, gensupport.WrapError(err)
1298 }
1299 ret := &SignSshPublicKeyResponse{
1300 ServerResponse: googleapi.ServerResponse{
1301 Header: res.Header,
1302 HTTPStatusCode: res.StatusCode,
1303 },
1304 }
1305 target := &ret
1306 b, err := gensupport.DecodeResponseBytes(target, res)
1307 if err != nil {
1308 return nil, err
1309 }
1310 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.projects.locations.signSshPublicKey", "response", internallog.HTTPResponse(res, b))
1311 return ret, nil
1312 }
1313
1314 type UsersProjectsZonesSignSshPublicKeyCall struct {
1315 s *Service
1316 parent string
1317 signsshpublickeyrequest *SignSshPublicKeyRequest
1318 urlParams_ gensupport.URLParams
1319 ctx_ context.Context
1320 header_ http.Header
1321 }
1322
1323 // SignSshPublicKey: Signs an SSH public key for a user to authenticate to an
1324 // instance.
1325 //
1326 // - parent: The parent project and region for the signing request.
1327 func (r *UsersProjectsZonesService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsZonesSignSshPublicKeyCall {
1328 c := &UsersProjectsZonesSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1329 c.parent = parent
1330 c.signsshpublickeyrequest = signsshpublickeyrequest
1331 return c
1332 }
1333
1334 // Fields allows partial responses to be retrieved. See
1335 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1336 // details.
1337 func (c *UsersProjectsZonesSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsZonesSignSshPublicKeyCall {
1338 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1339 return c
1340 }
1341
1342 // Context sets the context to be used in this call's Do method.
1343 func (c *UsersProjectsZonesSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsZonesSignSshPublicKeyCall {
1344 c.ctx_ = ctx
1345 return c
1346 }
1347
1348 // Header returns a http.Header that can be modified by the caller to add
1349 // headers to the request.
1350 func (c *UsersProjectsZonesSignSshPublicKeyCall) Header() http.Header {
1351 if c.header_ == nil {
1352 c.header_ = make(http.Header)
1353 }
1354 return c.header_
1355 }
1356
1357 func (c *UsersProjectsZonesSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
1358 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1359 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.signsshpublickeyrequest)
1360 if err != nil {
1361 return nil, err
1362 }
1363 c.urlParams_.Set("alt", alt)
1364 c.urlParams_.Set("prettyPrint", "false")
1365 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}:signSshPublicKey")
1366 urls += "?" + c.urlParams_.Encode()
1367 req, err := http.NewRequest("POST", urls, body)
1368 if err != nil {
1369 return nil, err
1370 }
1371 req.Header = reqHeaders
1372 googleapi.Expand(req.URL, map[string]string{
1373 "parent": c.parent,
1374 })
1375 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.projects.zones.signSshPublicKey", "request", internallog.HTTPRequest(req, body.Bytes()))
1376 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1377 }
1378
1379 // Do executes the "oslogin.users.projects.zones.signSshPublicKey" call.
1380 // Any non-2xx status code is an error. Response headers are in either
1381 // *SignSshPublicKeyResponse.ServerResponse.Header or (if a response was
1382 // returned at all) in error.(*googleapi.Error).Header. Use
1383 // googleapi.IsNotModified to check whether the returned error was because
1384 // http.StatusNotModified was returned.
1385 func (c *UsersProjectsZonesSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
1386 gensupport.SetOptions(c.urlParams_, opts...)
1387 res, err := c.doRequest("json")
1388 if res != nil && res.StatusCode == http.StatusNotModified {
1389 if res.Body != nil {
1390 res.Body.Close()
1391 }
1392 return nil, gensupport.WrapError(&googleapi.Error{
1393 Code: res.StatusCode,
1394 Header: res.Header,
1395 })
1396 }
1397 if err != nil {
1398 return nil, err
1399 }
1400 defer googleapi.CloseBody(res)
1401 if err := googleapi.CheckResponse(res); err != nil {
1402 return nil, gensupport.WrapError(err)
1403 }
1404 ret := &SignSshPublicKeyResponse{
1405 ServerResponse: googleapi.ServerResponse{
1406 Header: res.Header,
1407 HTTPStatusCode: res.StatusCode,
1408 },
1409 }
1410 target := &ret
1411 b, err := gensupport.DecodeResponseBytes(target, res)
1412 if err != nil {
1413 return nil, err
1414 }
1415 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.projects.zones.signSshPublicKey", "response", internallog.HTTPResponse(res, b))
1416 return ret, nil
1417 }
1418
1419 type UsersSshPublicKeysCreateCall struct {
1420 s *Service
1421 parent string
1422 sshpublickey *SshPublicKey
1423 urlParams_ gensupport.URLParams
1424 ctx_ context.Context
1425 header_ http.Header
1426 }
1427
1428 // Create: Create an SSH public key
1429 //
1430 // - parent: The unique ID for the user in format `users/{user}`.
1431 func (r *UsersSshPublicKeysService) Create(parent string, sshpublickey *SshPublicKey) *UsersSshPublicKeysCreateCall {
1432 c := &UsersSshPublicKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1433 c.parent = parent
1434 c.sshpublickey = sshpublickey
1435 return c
1436 }
1437
1438 // Fields allows partial responses to be retrieved. See
1439 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1440 // details.
1441 func (c *UsersSshPublicKeysCreateCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysCreateCall {
1442 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1443 return c
1444 }
1445
1446 // Context sets the context to be used in this call's Do method.
1447 func (c *UsersSshPublicKeysCreateCall) Context(ctx context.Context) *UsersSshPublicKeysCreateCall {
1448 c.ctx_ = ctx
1449 return c
1450 }
1451
1452 // Header returns a http.Header that can be modified by the caller to add
1453 // headers to the request.
1454 func (c *UsersSshPublicKeysCreateCall) Header() http.Header {
1455 if c.header_ == nil {
1456 c.header_ = make(http.Header)
1457 }
1458 return c.header_
1459 }
1460
1461 func (c *UsersSshPublicKeysCreateCall) doRequest(alt string) (*http.Response, error) {
1462 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1463 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.sshpublickey)
1464 if err != nil {
1465 return nil, err
1466 }
1467 c.urlParams_.Set("alt", alt)
1468 c.urlParams_.Set("prettyPrint", "false")
1469 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+parent}/sshPublicKeys")
1470 urls += "?" + c.urlParams_.Encode()
1471 req, err := http.NewRequest("POST", urls, body)
1472 if err != nil {
1473 return nil, err
1474 }
1475 req.Header = reqHeaders
1476 googleapi.Expand(req.URL, map[string]string{
1477 "parent": c.parent,
1478 })
1479 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.create", "request", internallog.HTTPRequest(req, body.Bytes()))
1480 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1481 }
1482
1483 // Do executes the "oslogin.users.sshPublicKeys.create" call.
1484 // Any non-2xx status code is an error. Response headers are in either
1485 // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
1486 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1487 // whether the returned error was because http.StatusNotModified was returned.
1488 func (c *UsersSshPublicKeysCreateCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1489 gensupport.SetOptions(c.urlParams_, opts...)
1490 res, err := c.doRequest("json")
1491 if res != nil && res.StatusCode == http.StatusNotModified {
1492 if res.Body != nil {
1493 res.Body.Close()
1494 }
1495 return nil, gensupport.WrapError(&googleapi.Error{
1496 Code: res.StatusCode,
1497 Header: res.Header,
1498 })
1499 }
1500 if err != nil {
1501 return nil, err
1502 }
1503 defer googleapi.CloseBody(res)
1504 if err := googleapi.CheckResponse(res); err != nil {
1505 return nil, gensupport.WrapError(err)
1506 }
1507 ret := &SshPublicKey{
1508 ServerResponse: googleapi.ServerResponse{
1509 Header: res.Header,
1510 HTTPStatusCode: res.StatusCode,
1511 },
1512 }
1513 target := &ret
1514 b, err := gensupport.DecodeResponseBytes(target, res)
1515 if err != nil {
1516 return nil, err
1517 }
1518 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.create", "response", internallog.HTTPResponse(res, b))
1519 return ret, nil
1520 }
1521
1522 type UsersSshPublicKeysDeleteCall struct {
1523 s *Service
1524 name string
1525 urlParams_ gensupport.URLParams
1526 ctx_ context.Context
1527 header_ http.Header
1528 }
1529
1530 // Delete: Deletes an SSH public key.
1531 //
1532 // - name: The fingerprint of the public key to update. Public keys are
1533 // identified by their SHA-256 fingerprint. The fingerprint of the public key
1534 // is in format `users/{user}/sshPublicKeys/{fingerprint}`.
1535 func (r *UsersSshPublicKeysService) Delete(name string) *UsersSshPublicKeysDeleteCall {
1536 c := &UsersSshPublicKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1537 c.name = name
1538 return c
1539 }
1540
1541 // Fields allows partial responses to be retrieved. See
1542 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1543 // details.
1544 func (c *UsersSshPublicKeysDeleteCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysDeleteCall {
1545 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1546 return c
1547 }
1548
1549 // Context sets the context to be used in this call's Do method.
1550 func (c *UsersSshPublicKeysDeleteCall) Context(ctx context.Context) *UsersSshPublicKeysDeleteCall {
1551 c.ctx_ = ctx
1552 return c
1553 }
1554
1555 // Header returns a http.Header that can be modified by the caller to add
1556 // headers to the request.
1557 func (c *UsersSshPublicKeysDeleteCall) Header() http.Header {
1558 if c.header_ == nil {
1559 c.header_ = make(http.Header)
1560 }
1561 return c.header_
1562 }
1563
1564 func (c *UsersSshPublicKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
1565 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1566 c.urlParams_.Set("alt", alt)
1567 c.urlParams_.Set("prettyPrint", "false")
1568 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
1569 urls += "?" + c.urlParams_.Encode()
1570 req, err := http.NewRequest("DELETE", urls, nil)
1571 if err != nil {
1572 return nil, err
1573 }
1574 req.Header = reqHeaders
1575 googleapi.Expand(req.URL, map[string]string{
1576 "name": c.name,
1577 })
1578 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.delete", "request", internallog.HTTPRequest(req, nil))
1579 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1580 }
1581
1582 // Do executes the "oslogin.users.sshPublicKeys.delete" call.
1583 // Any non-2xx status code is an error. Response headers are in either
1584 // *Empty.ServerResponse.Header or (if a response was returned at all) in
1585 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1586 // whether the returned error was because http.StatusNotModified was returned.
1587 func (c *UsersSshPublicKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1588 gensupport.SetOptions(c.urlParams_, opts...)
1589 res, err := c.doRequest("json")
1590 if res != nil && res.StatusCode == http.StatusNotModified {
1591 if res.Body != nil {
1592 res.Body.Close()
1593 }
1594 return nil, gensupport.WrapError(&googleapi.Error{
1595 Code: res.StatusCode,
1596 Header: res.Header,
1597 })
1598 }
1599 if err != nil {
1600 return nil, err
1601 }
1602 defer googleapi.CloseBody(res)
1603 if err := googleapi.CheckResponse(res); err != nil {
1604 return nil, gensupport.WrapError(err)
1605 }
1606 ret := &Empty{
1607 ServerResponse: googleapi.ServerResponse{
1608 Header: res.Header,
1609 HTTPStatusCode: res.StatusCode,
1610 },
1611 }
1612 target := &ret
1613 b, err := gensupport.DecodeResponseBytes(target, res)
1614 if err != nil {
1615 return nil, err
1616 }
1617 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.delete", "response", internallog.HTTPResponse(res, b))
1618 return ret, nil
1619 }
1620
1621 type UsersSshPublicKeysGetCall struct {
1622 s *Service
1623 name string
1624 urlParams_ gensupport.URLParams
1625 ifNoneMatch_ string
1626 ctx_ context.Context
1627 header_ http.Header
1628 }
1629
1630 // Get: Retrieves an SSH public key.
1631 //
1632 // - name: The fingerprint of the public key to retrieve. Public keys are
1633 // identified by their SHA-256 fingerprint. The fingerprint of the public key
1634 // is in format `users/{user}/sshPublicKeys/{fingerprint}`.
1635 func (r *UsersSshPublicKeysService) Get(name string) *UsersSshPublicKeysGetCall {
1636 c := &UsersSshPublicKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1637 c.name = name
1638 return c
1639 }
1640
1641 // Fields allows partial responses to be retrieved. See
1642 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1643 // details.
1644 func (c *UsersSshPublicKeysGetCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysGetCall {
1645 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1646 return c
1647 }
1648
1649 // IfNoneMatch sets an optional parameter which makes the operation fail if the
1650 // object's ETag matches the given value. This is useful for getting updates
1651 // only after the object has changed since the last request.
1652 func (c *UsersSshPublicKeysGetCall) IfNoneMatch(entityTag string) *UsersSshPublicKeysGetCall {
1653 c.ifNoneMatch_ = entityTag
1654 return c
1655 }
1656
1657 // Context sets the context to be used in this call's Do method.
1658 func (c *UsersSshPublicKeysGetCall) Context(ctx context.Context) *UsersSshPublicKeysGetCall {
1659 c.ctx_ = ctx
1660 return c
1661 }
1662
1663 // Header returns a http.Header that can be modified by the caller to add
1664 // headers to the request.
1665 func (c *UsersSshPublicKeysGetCall) Header() http.Header {
1666 if c.header_ == nil {
1667 c.header_ = make(http.Header)
1668 }
1669 return c.header_
1670 }
1671
1672 func (c *UsersSshPublicKeysGetCall) doRequest(alt string) (*http.Response, error) {
1673 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1674 if c.ifNoneMatch_ != "" {
1675 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1676 }
1677 c.urlParams_.Set("alt", alt)
1678 c.urlParams_.Set("prettyPrint", "false")
1679 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
1680 urls += "?" + c.urlParams_.Encode()
1681 req, err := http.NewRequest("GET", urls, nil)
1682 if err != nil {
1683 return nil, err
1684 }
1685 req.Header = reqHeaders
1686 googleapi.Expand(req.URL, map[string]string{
1687 "name": c.name,
1688 })
1689 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.get", "request", internallog.HTTPRequest(req, nil))
1690 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1691 }
1692
1693 // Do executes the "oslogin.users.sshPublicKeys.get" call.
1694 // Any non-2xx status code is an error. Response headers are in either
1695 // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
1696 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1697 // whether the returned error was because http.StatusNotModified was returned.
1698 func (c *UsersSshPublicKeysGetCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1699 gensupport.SetOptions(c.urlParams_, opts...)
1700 res, err := c.doRequest("json")
1701 if res != nil && res.StatusCode == http.StatusNotModified {
1702 if res.Body != nil {
1703 res.Body.Close()
1704 }
1705 return nil, gensupport.WrapError(&googleapi.Error{
1706 Code: res.StatusCode,
1707 Header: res.Header,
1708 })
1709 }
1710 if err != nil {
1711 return nil, err
1712 }
1713 defer googleapi.CloseBody(res)
1714 if err := googleapi.CheckResponse(res); err != nil {
1715 return nil, gensupport.WrapError(err)
1716 }
1717 ret := &SshPublicKey{
1718 ServerResponse: googleapi.ServerResponse{
1719 Header: res.Header,
1720 HTTPStatusCode: res.StatusCode,
1721 },
1722 }
1723 target := &ret
1724 b, err := gensupport.DecodeResponseBytes(target, res)
1725 if err != nil {
1726 return nil, err
1727 }
1728 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.get", "response", internallog.HTTPResponse(res, b))
1729 return ret, nil
1730 }
1731
1732 type UsersSshPublicKeysPatchCall struct {
1733 s *Service
1734 name string
1735 sshpublickey *SshPublicKey
1736 urlParams_ gensupport.URLParams
1737 ctx_ context.Context
1738 header_ http.Header
1739 }
1740
1741 // Patch: Updates an SSH public key and returns the profile information. This
1742 // method supports patch semantics.
1743 //
1744 // - name: The fingerprint of the public key to update. Public keys are
1745 // identified by their SHA-256 fingerprint. The fingerprint of the public key
1746 // is in format `users/{user}/sshPublicKeys/{fingerprint}`.
1747 func (r *UsersSshPublicKeysService) Patch(name string, sshpublickey *SshPublicKey) *UsersSshPublicKeysPatchCall {
1748 c := &UsersSshPublicKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1749 c.name = name
1750 c.sshpublickey = sshpublickey
1751 return c
1752 }
1753
1754 // UpdateMask sets the optional parameter "updateMask": Mask to control which
1755 // fields get updated. Updates all if not present.
1756 func (c *UsersSshPublicKeysPatchCall) UpdateMask(updateMask string) *UsersSshPublicKeysPatchCall {
1757 c.urlParams_.Set("updateMask", updateMask)
1758 return c
1759 }
1760
1761 // Fields allows partial responses to be retrieved. See
1762 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1763 // details.
1764 func (c *UsersSshPublicKeysPatchCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysPatchCall {
1765 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1766 return c
1767 }
1768
1769 // Context sets the context to be used in this call's Do method.
1770 func (c *UsersSshPublicKeysPatchCall) Context(ctx context.Context) *UsersSshPublicKeysPatchCall {
1771 c.ctx_ = ctx
1772 return c
1773 }
1774
1775 // Header returns a http.Header that can be modified by the caller to add
1776 // headers to the request.
1777 func (c *UsersSshPublicKeysPatchCall) Header() http.Header {
1778 if c.header_ == nil {
1779 c.header_ = make(http.Header)
1780 }
1781 return c.header_
1782 }
1783
1784 func (c *UsersSshPublicKeysPatchCall) doRequest(alt string) (*http.Response, error) {
1785 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1786 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.sshpublickey)
1787 if err != nil {
1788 return nil, err
1789 }
1790 c.urlParams_.Set("alt", alt)
1791 c.urlParams_.Set("prettyPrint", "false")
1792 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta/{+name}")
1793 urls += "?" + c.urlParams_.Encode()
1794 req, err := http.NewRequest("PATCH", urls, body)
1795 if err != nil {
1796 return nil, err
1797 }
1798 req.Header = reqHeaders
1799 googleapi.Expand(req.URL, map[string]string{
1800 "name": c.name,
1801 })
1802 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.patch", "request", internallog.HTTPRequest(req, body.Bytes()))
1803 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1804 }
1805
1806 // Do executes the "oslogin.users.sshPublicKeys.patch" call.
1807 // Any non-2xx status code is an error. Response headers are in either
1808 // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
1809 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1810 // whether the returned error was because http.StatusNotModified was returned.
1811 func (c *UsersSshPublicKeysPatchCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1812 gensupport.SetOptions(c.urlParams_, opts...)
1813 res, err := c.doRequest("json")
1814 if res != nil && res.StatusCode == http.StatusNotModified {
1815 if res.Body != nil {
1816 res.Body.Close()
1817 }
1818 return nil, gensupport.WrapError(&googleapi.Error{
1819 Code: res.StatusCode,
1820 Header: res.Header,
1821 })
1822 }
1823 if err != nil {
1824 return nil, err
1825 }
1826 defer googleapi.CloseBody(res)
1827 if err := googleapi.CheckResponse(res); err != nil {
1828 return nil, gensupport.WrapError(err)
1829 }
1830 ret := &SshPublicKey{
1831 ServerResponse: googleapi.ServerResponse{
1832 Header: res.Header,
1833 HTTPStatusCode: res.StatusCode,
1834 },
1835 }
1836 target := &ret
1837 b, err := gensupport.DecodeResponseBytes(target, res)
1838 if err != nil {
1839 return nil, err
1840 }
1841 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.patch", "response", internallog.HTTPResponse(res, b))
1842 return ret, nil
1843 }