Debian Codegraph @

oslogin/v1alpha/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/v1alpha"
29 // ...
30 // ctx := context.Background()
31 // osloginService, err := oslogin.NewService(ctx)
32 //
33 // In this example, Google Application Default Credentials are used for
34 // authentication. For information on how to create and obtain Application
35 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
36 //
37 // # Other authentication options
38 //
39 // By default, all available scopes (see "Constants") are used to authenticate.
40 // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
41 //
42 // osloginService, err := oslogin.NewService(ctx, option.WithScopes(oslogin.ComputeReadonlyScope))
43 //
44 // To use an API key for authentication (note: some APIs do not support API
45 // keys), use [google.golang.org/api/option.WithAPIKey]:
46 //
47 // osloginService, err := oslogin.NewService(ctx, option.WithAPIKey("AIza..."))
48 //
49 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
50 // flow, use [google.golang.org/api/option.WithTokenSource]:
51 //
52 // config := &oauth2.Config{...}
53 // // ...
54 // token, err := config.Exchange(ctx, ...)
55 // osloginService, err := oslogin.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
56 //
57 // See [google.golang.org/api/option.ClientOption] for details on options.
58 package oslogin // import "google.golang.org/api/oslogin/v1alpha"
59
60 import (
61 "bytes"
62 "context"
63 "encoding/json"
64 "errors"
65 "fmt"
66 "io"
67 "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:v1alpha"
100 const apiName = "oslogin"
101 const apiVersion = "v1alpha"
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 // GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyRequest: A
268 // request message for signing an SSH public key.
269 type GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyRequest 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 GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyRequest) MarshalJSON() ([]byte, error) {
299 type NoMethod GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyRequest
300 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
301 }
302
303 // GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyResponse: The
304 // response message for signing an SSH public key.
305 type GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyResponse 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 GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyResponse) MarshalJSON() ([]byte, error) {
325 type NoMethod GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyResponse
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 googlecloudoslogincontrolplaneregionalv1alphasignsshpublickeyrequest *GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyRequest
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, googlecloudoslogincontrolplaneregionalv1alphasignsshpublickeyrequest *GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyRequest) *ProjectsLocationsSignSshPublicKeyCall {
638 c := &ProjectsLocationsSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
639 c.parent = parent
640 c.googlecloudoslogincontrolplaneregionalv1alphasignsshpublickeyrequest = googlecloudoslogincontrolplaneregionalv1alphasignsshpublickeyrequest
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.googlecloudoslogincontrolplaneregionalv1alphasignsshpublickeyrequest)
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, "v1alpha/{+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 // *GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyResponse.Server
692 // Response.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) (*GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyResponse, 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 := &GoogleCloudOsloginControlplaneRegionalV1alphaSignSshPublicKeyResponse{
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 // OperatingSystemType sets the optional parameter "operatingSystemType": The
749 // type of operating system associated with the account.
750 //
751 // Possible values:
752 //
753 // "OPERATING_SYSTEM_TYPE_UNSPECIFIED" - The operating system type associated
754 //
755 // with the user account information is unspecified.
756 //
757 // "LINUX" - Linux user account information.
758 // "WINDOWS" - Windows user account information.
759 func (c *UsersGetLoginProfileCall) OperatingSystemType(operatingSystemType string) *UsersGetLoginProfileCall {
760 c.urlParams_.Set("operatingSystemType", operatingSystemType)
761 return c
762 }
763
764 // ProjectId sets the optional parameter "projectId": Required. The project ID
765 // of the Google Cloud Platform project.
766 func (c *UsersGetLoginProfileCall) ProjectId(projectId string) *UsersGetLoginProfileCall {
767 c.urlParams_.Set("projectId", projectId)
768 return c
769 }
770
771 // SystemId sets the optional parameter "systemId": A system ID for filtering
772 // the results of the request.
773 func (c *UsersGetLoginProfileCall) SystemId(systemId string) *UsersGetLoginProfileCall {
774 c.urlParams_.Set("systemId", systemId)
775 return c
776 }
777
778 // View sets the optional parameter "view": The view configures whether to
779 // retrieve security keys information.
780 //
781 // Possible values:
782 //
783 // "LOGIN_PROFILE_VIEW_UNSPECIFIED" - The default login profile view. The API
784 //
785 // defaults to the BASIC view.
786 //
787 // "BASIC" - Includes POSIX and SSH key information.
788 // "SECURITY_KEY" - Include security key information for the user.
789 func (c *UsersGetLoginProfileCall) View(view string) *UsersGetLoginProfileCall {
790 c.urlParams_.Set("view", view)
791 return c
792 }
793
794 // Fields allows partial responses to be retrieved. See
795 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
796 // details.
797 func (c *UsersGetLoginProfileCall) Fields(s ...googleapi.Field) *UsersGetLoginProfileCall {
798 c.urlParams_.Set("fields", googleapi.CombineFields(s))
799 return c
800 }
801
802 // IfNoneMatch sets an optional parameter which makes the operation fail if the
803 // object's ETag matches the given value. This is useful for getting updates
804 // only after the object has changed since the last request.
805 func (c *UsersGetLoginProfileCall) IfNoneMatch(entityTag string) *UsersGetLoginProfileCall {
806 c.ifNoneMatch_ = entityTag
807 return c
808 }
809
810 // Context sets the context to be used in this call's Do method.
811 func (c *UsersGetLoginProfileCall) Context(ctx context.Context) *UsersGetLoginProfileCall {
812 c.ctx_ = ctx
813 return c
814 }
815
816 // Header returns a http.Header that can be modified by the caller to add
817 // headers to the request.
818 func (c *UsersGetLoginProfileCall) Header() http.Header {
819 if c.header_ == nil {
820 c.header_ = make(http.Header)
821 }
822 return c.header_
823 }
824
825 func (c *UsersGetLoginProfileCall) doRequest(alt string) (*http.Response, error) {
826 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
827 if c.ifNoneMatch_ != "" {
828 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
829 }
830 c.urlParams_.Set("alt", alt)
831 c.urlParams_.Set("prettyPrint", "false")
832 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}/loginProfile")
833 urls += "?" + c.urlParams_.Encode()
834 req, err := http.NewRequest("GET", urls, nil)
835 if err != nil {
836 return nil, err
837 }
838 req.Header = reqHeaders
839 googleapi.Expand(req.URL, map[string]string{
840 "name": c.name,
841 })
842 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.getLoginProfile", "request", internallog.HTTPRequest(req, nil))
843 return gensupport.SendRequest(c.ctx_, c.s.client, req)
844 }
845
846 // Do executes the "oslogin.users.getLoginProfile" call.
847 // Any non-2xx status code is an error. Response headers are in either
848 // *LoginProfile.ServerResponse.Header or (if a response was returned at all)
849 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
850 // whether the returned error was because http.StatusNotModified was returned.
851 func (c *UsersGetLoginProfileCall) Do(opts ...googleapi.CallOption) (*LoginProfile, error) {
852 gensupport.SetOptions(c.urlParams_, opts...)
853 res, err := c.doRequest("json")
854 if res != nil && res.StatusCode == http.StatusNotModified {
855 if res.Body != nil {
856 res.Body.Close()
857 }
858 return nil, gensupport.WrapError(&googleapi.Error{
859 Code: res.StatusCode,
860 Header: res.Header,
861 })
862 }
863 if err != nil {
864 return nil, err
865 }
866 defer googleapi.CloseBody(res)
867 if err := googleapi.CheckResponse(res); err != nil {
868 return nil, gensupport.WrapError(err)
869 }
870 ret := &LoginProfile{
871 ServerResponse: googleapi.ServerResponse{
872 Header: res.Header,
873 HTTPStatusCode: res.StatusCode,
874 },
875 }
876 target := &ret
877 b, err := gensupport.DecodeResponseBytes(target, res)
878 if err != nil {
879 return nil, err
880 }
881 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.getLoginProfile", "response", internallog.HTTPResponse(res, b))
882 return ret, nil
883 }
884
885 type UsersImportSshPublicKeyCall struct {
886 s *Service
887 parent string
888 sshpublickey *SshPublicKey
889 urlParams_ gensupport.URLParams
890 ctx_ context.Context
891 header_ http.Header
892 }
893
894 // ImportSshPublicKey: Adds an SSH public key and returns the profile
895 // information. Default POSIX account information is set when no username and
896 // UID exist as part of the login profile.
897 //
898 // - parent: The unique ID for the user in format `users/{user}`.
899 func (r *UsersService) ImportSshPublicKey(parent string, sshpublickey *SshPublicKey) *UsersImportSshPublicKeyCall {
900 c := &UsersImportSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
901 c.parent = parent
902 c.sshpublickey = sshpublickey
903 return c
904 }
905
906 // ProjectId sets the optional parameter "projectId": The project ID of the
907 // Google Cloud Platform project.
908 func (c *UsersImportSshPublicKeyCall) ProjectId(projectId string) *UsersImportSshPublicKeyCall {
909 c.urlParams_.Set("projectId", projectId)
910 return c
911 }
912
913 // Regions sets the optional parameter "regions": The regions to wait for a
914 // POSIX account to be written to before returning a response. If unspecified,
915 // defaults to all regions. Regions are listed at
916 // https://cloud.google.com/about/locations#region.
917 func (c *UsersImportSshPublicKeyCall) Regions(regions ...string) *UsersImportSshPublicKeyCall {
918 c.urlParams_.SetMulti("regions", append([]string{}, regions...))
919 return c
920 }
921
922 // View sets the optional parameter "view": The view configures whether to
923 // retrieve security keys information.
924 //
925 // Possible values:
926 //
927 // "LOGIN_PROFILE_VIEW_UNSPECIFIED" - The default login profile view. The API
928 //
929 // defaults to the BASIC view.
930 //
931 // "BASIC" - Includes POSIX and SSH key information.
932 // "SECURITY_KEY" - Include security key information for the user.
933 func (c *UsersImportSshPublicKeyCall) View(view string) *UsersImportSshPublicKeyCall {
934 c.urlParams_.Set("view", view)
935 return c
936 }
937
938 // Fields allows partial responses to be retrieved. See
939 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
940 // details.
941 func (c *UsersImportSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersImportSshPublicKeyCall {
942 c.urlParams_.Set("fields", googleapi.CombineFields(s))
943 return c
944 }
945
946 // Context sets the context to be used in this call's Do method.
947 func (c *UsersImportSshPublicKeyCall) Context(ctx context.Context) *UsersImportSshPublicKeyCall {
948 c.ctx_ = ctx
949 return c
950 }
951
952 // Header returns a http.Header that can be modified by the caller to add
953 // headers to the request.
954 func (c *UsersImportSshPublicKeyCall) Header() http.Header {
955 if c.header_ == nil {
956 c.header_ = make(http.Header)
957 }
958 return c.header_
959 }
960
961 func (c *UsersImportSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
962 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
963 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.sshpublickey)
964 if err != nil {
965 return nil, err
966 }
967 c.urlParams_.Set("alt", alt)
968 c.urlParams_.Set("prettyPrint", "false")
969 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}:importSshPublicKey")
970 urls += "?" + c.urlParams_.Encode()
971 req, err := http.NewRequest("POST", urls, body)
972 if err != nil {
973 return nil, err
974 }
975 req.Header = reqHeaders
976 googleapi.Expand(req.URL, map[string]string{
977 "parent": c.parent,
978 })
979 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.importSshPublicKey", "request", internallog.HTTPRequest(req, body.Bytes()))
980 return gensupport.SendRequest(c.ctx_, c.s.client, req)
981 }
982
983 // Do executes the "oslogin.users.importSshPublicKey" call.
984 // Any non-2xx status code is an error. Response headers are in either
985 // *ImportSshPublicKeyResponse.ServerResponse.Header or (if a response was
986 // returned at all) in error.(*googleapi.Error).Header. Use
987 // googleapi.IsNotModified to check whether the returned error was because
988 // http.StatusNotModified was returned.
989 func (c *UsersImportSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*ImportSshPublicKeyResponse, error) {
990 gensupport.SetOptions(c.urlParams_, opts...)
991 res, err := c.doRequest("json")
992 if res != nil && res.StatusCode == http.StatusNotModified {
993 if res.Body != nil {
994 res.Body.Close()
995 }
996 return nil, gensupport.WrapError(&googleapi.Error{
997 Code: res.StatusCode,
998 Header: res.Header,
999 })
1000 }
1001 if err != nil {
1002 return nil, err
1003 }
1004 defer googleapi.CloseBody(res)
1005 if err := googleapi.CheckResponse(res); err != nil {
1006 return nil, gensupport.WrapError(err)
1007 }
1008 ret := &ImportSshPublicKeyResponse{
1009 ServerResponse: googleapi.ServerResponse{
1010 Header: res.Header,
1011 HTTPStatusCode: res.StatusCode,
1012 },
1013 }
1014 target := &ret
1015 b, err := gensupport.DecodeResponseBytes(target, res)
1016 if err != nil {
1017 return nil, err
1018 }
1019 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.importSshPublicKey", "response", internallog.HTTPResponse(res, b))
1020 return ret, nil
1021 }
1022
1023 type UsersProjectsDeleteCall struct {
1024 s *Service
1025 name string
1026 urlParams_ gensupport.URLParams
1027 ctx_ context.Context
1028 header_ http.Header
1029 }
1030
1031 // Delete: Deletes a POSIX account.
1032 //
1033 // - name: A reference to the POSIX account to update. POSIX accounts are
1034 // identified by the project ID they are associated with. A reference to the
1035 // POSIX account is in format `users/{user}/projects/{project}`.
1036 func (r *UsersProjectsService) Delete(name string) *UsersProjectsDeleteCall {
1037 c := &UsersProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1038 c.name = name
1039 return c
1040 }
1041
1042 // OperatingSystemType sets the optional parameter "operatingSystemType": The
1043 // type of operating system associated with the account.
1044 //
1045 // Possible values:
1046 //
1047 // "OPERATING_SYSTEM_TYPE_UNSPECIFIED" - The operating system type associated
1048 //
1049 // with the user account information is unspecified.
1050 //
1051 // "LINUX" - Linux user account information.
1052 // "WINDOWS" - Windows user account information.
1053 func (c *UsersProjectsDeleteCall) OperatingSystemType(operatingSystemType string) *UsersProjectsDeleteCall {
1054 c.urlParams_.Set("operatingSystemType", operatingSystemType)
1055 return c
1056 }
1057
1058 // Fields allows partial responses to be retrieved. See
1059 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1060 // details.
1061 func (c *UsersProjectsDeleteCall) Fields(s ...googleapi.Field) *UsersProjectsDeleteCall {
1062 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1063 return c
1064 }
1065
1066 // Context sets the context to be used in this call's Do method.
1067 func (c *UsersProjectsDeleteCall) Context(ctx context.Context) *UsersProjectsDeleteCall {
1068 c.ctx_ = ctx
1069 return c
1070 }
1071
1072 // Header returns a http.Header that can be modified by the caller to add
1073 // headers to the request.
1074 func (c *UsersProjectsDeleteCall) Header() http.Header {
1075 if c.header_ == nil {
1076 c.header_ = make(http.Header)
1077 }
1078 return c.header_
1079 }
1080
1081 func (c *UsersProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
1082 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1083 c.urlParams_.Set("alt", alt)
1084 c.urlParams_.Set("prettyPrint", "false")
1085 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
1086 urls += "?" + c.urlParams_.Encode()
1087 req, err := http.NewRequest("DELETE", urls, nil)
1088 if err != nil {
1089 return nil, err
1090 }
1091 req.Header = reqHeaders
1092 googleapi.Expand(req.URL, map[string]string{
1093 "name": c.name,
1094 })
1095 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.projects.delete", "request", internallog.HTTPRequest(req, nil))
1096 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1097 }
1098
1099 // Do executes the "oslogin.users.projects.delete" call.
1100 // Any non-2xx status code is an error. Response headers are in either
1101 // *Empty.ServerResponse.Header or (if a response was returned at all) in
1102 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1103 // whether the returned error was because http.StatusNotModified was returned.
1104 func (c *UsersProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1105 gensupport.SetOptions(c.urlParams_, opts...)
1106 res, err := c.doRequest("json")
1107 if res != nil && res.StatusCode == http.StatusNotModified {
1108 if res.Body != nil {
1109 res.Body.Close()
1110 }
1111 return nil, gensupport.WrapError(&googleapi.Error{
1112 Code: res.StatusCode,
1113 Header: res.Header,
1114 })
1115 }
1116 if err != nil {
1117 return nil, err
1118 }
1119 defer googleapi.CloseBody(res)
1120 if err := googleapi.CheckResponse(res); err != nil {
1121 return nil, gensupport.WrapError(err)
1122 }
1123 ret := &Empty{
1124 ServerResponse: googleapi.ServerResponse{
1125 Header: res.Header,
1126 HTTPStatusCode: res.StatusCode,
1127 },
1128 }
1129 target := &ret
1130 b, err := gensupport.DecodeResponseBytes(target, res)
1131 if err != nil {
1132 return nil, err
1133 }
1134 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.projects.delete", "response", internallog.HTTPResponse(res, b))
1135 return ret, nil
1136 }
1137
1138 type UsersProjectsProvisionPosixAccountCall struct {
1139 s *Service
1140 name string
1141 provisionposixaccountrequest *ProvisionPosixAccountRequest
1142 urlParams_ gensupport.URLParams
1143 ctx_ context.Context
1144 header_ http.Header
1145 }
1146
1147 // ProvisionPosixAccount: Create a POSIX account if it doesn't exist.
1148 //
1149 // - name: The unique ID for the user in format
1150 // `users/{user}/projects/{project}`.
1151 func (r *UsersProjectsService) ProvisionPosixAccount(name string, provisionposixaccountrequest *ProvisionPosixAccountRequest) *UsersProjectsProvisionPosixAccountCall {
1152 c := &UsersProjectsProvisionPosixAccountCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1153 c.name = name
1154 c.provisionposixaccountrequest = provisionposixaccountrequest
1155 return c
1156 }
1157
1158 // Fields allows partial responses to be retrieved. See
1159 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1160 // details.
1161 func (c *UsersProjectsProvisionPosixAccountCall) Fields(s ...googleapi.Field) *UsersProjectsProvisionPosixAccountCall {
1162 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1163 return c
1164 }
1165
1166 // Context sets the context to be used in this call's Do method.
1167 func (c *UsersProjectsProvisionPosixAccountCall) Context(ctx context.Context) *UsersProjectsProvisionPosixAccountCall {
1168 c.ctx_ = ctx
1169 return c
1170 }
1171
1172 // Header returns a http.Header that can be modified by the caller to add
1173 // headers to the request.
1174 func (c *UsersProjectsProvisionPosixAccountCall) Header() http.Header {
1175 if c.header_ == nil {
1176 c.header_ = make(http.Header)
1177 }
1178 return c.header_
1179 }
1180
1181 func (c *UsersProjectsProvisionPosixAccountCall) doRequest(alt string) (*http.Response, error) {
1182 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1183 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.provisionposixaccountrequest)
1184 if err != nil {
1185 return nil, err
1186 }
1187 c.urlParams_.Set("alt", alt)
1188 c.urlParams_.Set("prettyPrint", "false")
1189 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
1190 urls += "?" + c.urlParams_.Encode()
1191 req, err := http.NewRequest("POST", urls, body)
1192 if err != nil {
1193 return nil, err
1194 }
1195 req.Header = reqHeaders
1196 googleapi.Expand(req.URL, map[string]string{
1197 "name": c.name,
1198 })
1199 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.projects.provisionPosixAccount", "request", internallog.HTTPRequest(req, body.Bytes()))
1200 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1201 }
1202
1203 // Do executes the "oslogin.users.projects.provisionPosixAccount" call.
1204 // Any non-2xx status code is an error. Response headers are in either
1205 // *PosixAccount.ServerResponse.Header or (if a response was returned at all)
1206 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1207 // whether the returned error was because http.StatusNotModified was returned.
1208 func (c *UsersProjectsProvisionPosixAccountCall) Do(opts ...googleapi.CallOption) (*PosixAccount, error) {
1209 gensupport.SetOptions(c.urlParams_, opts...)
1210 res, err := c.doRequest("json")
1211 if res != nil && res.StatusCode == http.StatusNotModified {
1212 if res.Body != nil {
1213 res.Body.Close()
1214 }
1215 return nil, gensupport.WrapError(&googleapi.Error{
1216 Code: res.StatusCode,
1217 Header: res.Header,
1218 })
1219 }
1220 if err != nil {
1221 return nil, err
1222 }
1223 defer googleapi.CloseBody(res)
1224 if err := googleapi.CheckResponse(res); err != nil {
1225 return nil, gensupport.WrapError(err)
1226 }
1227 ret := &PosixAccount{
1228 ServerResponse: googleapi.ServerResponse{
1229 Header: res.Header,
1230 HTTPStatusCode: res.StatusCode,
1231 },
1232 }
1233 target := &ret
1234 b, err := gensupport.DecodeResponseBytes(target, res)
1235 if err != nil {
1236 return nil, err
1237 }
1238 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.projects.provisionPosixAccount", "response", internallog.HTTPResponse(res, b))
1239 return ret, nil
1240 }
1241
1242 type UsersProjectsLocationsSignSshPublicKeyCall struct {
1243 s *Service
1244 parent string
1245 signsshpublickeyrequest *SignSshPublicKeyRequest
1246 urlParams_ gensupport.URLParams
1247 ctx_ context.Context
1248 header_ http.Header
1249 }
1250
1251 // SignSshPublicKey: Signs an SSH public key for a user to authenticate to a
1252 // virtual machine on Google Compute Engine.
1253 //
1254 // - parent: The parent project and region for the signing request.
1255 func (r *UsersProjectsLocationsService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsLocationsSignSshPublicKeyCall {
1256 c := &UsersProjectsLocationsSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1257 c.parent = parent
1258 c.signsshpublickeyrequest = signsshpublickeyrequest
1259 return c
1260 }
1261
1262 // Fields allows partial responses to be retrieved. See
1263 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1264 // details.
1265 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsLocationsSignSshPublicKeyCall {
1266 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1267 return c
1268 }
1269
1270 // Context sets the context to be used in this call's Do method.
1271 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsLocationsSignSshPublicKeyCall {
1272 c.ctx_ = ctx
1273 return c
1274 }
1275
1276 // Header returns a http.Header that can be modified by the caller to add
1277 // headers to the request.
1278 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Header() http.Header {
1279 if c.header_ == nil {
1280 c.header_ = make(http.Header)
1281 }
1282 return c.header_
1283 }
1284
1285 func (c *UsersProjectsLocationsSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
1286 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1287 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.signsshpublickeyrequest)
1288 if err != nil {
1289 return nil, err
1290 }
1291 c.urlParams_.Set("alt", alt)
1292 c.urlParams_.Set("prettyPrint", "false")
1293 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}:signSshPublicKey")
1294 urls += "?" + c.urlParams_.Encode()
1295 req, err := http.NewRequest("POST", urls, body)
1296 if err != nil {
1297 return nil, err
1298 }
1299 req.Header = reqHeaders
1300 googleapi.Expand(req.URL, map[string]string{
1301 "parent": c.parent,
1302 })
1303 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.projects.locations.signSshPublicKey", "request", internallog.HTTPRequest(req, body.Bytes()))
1304 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1305 }
1306
1307 // Do executes the "oslogin.users.projects.locations.signSshPublicKey" call.
1308 // Any non-2xx status code is an error. Response headers are in either
1309 // *SignSshPublicKeyResponse.ServerResponse.Header or (if a response was
1310 // returned at all) in error.(*googleapi.Error).Header. Use
1311 // googleapi.IsNotModified to check whether the returned error was because
1312 // http.StatusNotModified was returned.
1313 func (c *UsersProjectsLocationsSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
1314 gensupport.SetOptions(c.urlParams_, opts...)
1315 res, err := c.doRequest("json")
1316 if res != nil && res.StatusCode == http.StatusNotModified {
1317 if res.Body != nil {
1318 res.Body.Close()
1319 }
1320 return nil, gensupport.WrapError(&googleapi.Error{
1321 Code: res.StatusCode,
1322 Header: res.Header,
1323 })
1324 }
1325 if err != nil {
1326 return nil, err
1327 }
1328 defer googleapi.CloseBody(res)
1329 if err := googleapi.CheckResponse(res); err != nil {
1330 return nil, gensupport.WrapError(err)
1331 }
1332 ret := &SignSshPublicKeyResponse{
1333 ServerResponse: googleapi.ServerResponse{
1334 Header: res.Header,
1335 HTTPStatusCode: res.StatusCode,
1336 },
1337 }
1338 target := &ret
1339 b, err := gensupport.DecodeResponseBytes(target, res)
1340 if err != nil {
1341 return nil, err
1342 }
1343 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.projects.locations.signSshPublicKey", "response", internallog.HTTPResponse(res, b))
1344 return ret, nil
1345 }
1346
1347 type UsersProjectsZonesSignSshPublicKeyCall struct {
1348 s *Service
1349 parent string
1350 signsshpublickeyrequest *SignSshPublicKeyRequest
1351 urlParams_ gensupport.URLParams
1352 ctx_ context.Context
1353 header_ http.Header
1354 }
1355
1356 // SignSshPublicKey: Signs an SSH public key for a user to authenticate to a
1357 // virtual machine on Google Compute Engine.
1358 //
1359 // - parent: The parent project and region for the signing request.
1360 func (r *UsersProjectsZonesService) SignSshPublicKey(parent string, signsshpublickeyrequest *SignSshPublicKeyRequest) *UsersProjectsZonesSignSshPublicKeyCall {
1361 c := &UsersProjectsZonesSignSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1362 c.parent = parent
1363 c.signsshpublickeyrequest = signsshpublickeyrequest
1364 return c
1365 }
1366
1367 // Fields allows partial responses to be retrieved. See
1368 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1369 // details.
1370 func (c *UsersProjectsZonesSignSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersProjectsZonesSignSshPublicKeyCall {
1371 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1372 return c
1373 }
1374
1375 // Context sets the context to be used in this call's Do method.
1376 func (c *UsersProjectsZonesSignSshPublicKeyCall) Context(ctx context.Context) *UsersProjectsZonesSignSshPublicKeyCall {
1377 c.ctx_ = ctx
1378 return c
1379 }
1380
1381 // Header returns a http.Header that can be modified by the caller to add
1382 // headers to the request.
1383 func (c *UsersProjectsZonesSignSshPublicKeyCall) Header() http.Header {
1384 if c.header_ == nil {
1385 c.header_ = make(http.Header)
1386 }
1387 return c.header_
1388 }
1389
1390 func (c *UsersProjectsZonesSignSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
1391 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1392 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.signsshpublickeyrequest)
1393 if err != nil {
1394 return nil, err
1395 }
1396 c.urlParams_.Set("alt", alt)
1397 c.urlParams_.Set("prettyPrint", "false")
1398 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}:signSshPublicKey")
1399 urls += "?" + c.urlParams_.Encode()
1400 req, err := http.NewRequest("POST", urls, body)
1401 if err != nil {
1402 return nil, err
1403 }
1404 req.Header = reqHeaders
1405 googleapi.Expand(req.URL, map[string]string{
1406 "parent": c.parent,
1407 })
1408 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.projects.zones.signSshPublicKey", "request", internallog.HTTPRequest(req, body.Bytes()))
1409 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1410 }
1411
1412 // Do executes the "oslogin.users.projects.zones.signSshPublicKey" call.
1413 // Any non-2xx status code is an error. Response headers are in either
1414 // *SignSshPublicKeyResponse.ServerResponse.Header or (if a response was
1415 // returned at all) in error.(*googleapi.Error).Header. Use
1416 // googleapi.IsNotModified to check whether the returned error was because
1417 // http.StatusNotModified was returned.
1418 func (c *UsersProjectsZonesSignSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*SignSshPublicKeyResponse, error) {
1419 gensupport.SetOptions(c.urlParams_, opts...)
1420 res, err := c.doRequest("json")
1421 if res != nil && res.StatusCode == http.StatusNotModified {
1422 if res.Body != nil {
1423 res.Body.Close()
1424 }
1425 return nil, gensupport.WrapError(&googleapi.Error{
1426 Code: res.StatusCode,
1427 Header: res.Header,
1428 })
1429 }
1430 if err != nil {
1431 return nil, err
1432 }
1433 defer googleapi.CloseBody(res)
1434 if err := googleapi.CheckResponse(res); err != nil {
1435 return nil, gensupport.WrapError(err)
1436 }
1437 ret := &SignSshPublicKeyResponse{
1438 ServerResponse: googleapi.ServerResponse{
1439 Header: res.Header,
1440 HTTPStatusCode: res.StatusCode,
1441 },
1442 }
1443 target := &ret
1444 b, err := gensupport.DecodeResponseBytes(target, res)
1445 if err != nil {
1446 return nil, err
1447 }
1448 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.projects.zones.signSshPublicKey", "response", internallog.HTTPResponse(res, b))
1449 return ret, nil
1450 }
1451
1452 type UsersSshPublicKeysCreateCall struct {
1453 s *Service
1454 parent string
1455 sshpublickey *SshPublicKey
1456 urlParams_ gensupport.URLParams
1457 ctx_ context.Context
1458 header_ http.Header
1459 }
1460
1461 // Create: Create an SSH public key
1462 //
1463 // - parent: The unique ID for the user in format `users/{user}`.
1464 func (r *UsersSshPublicKeysService) Create(parent string, sshpublickey *SshPublicKey) *UsersSshPublicKeysCreateCall {
1465 c := &UsersSshPublicKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1466 c.parent = parent
1467 c.sshpublickey = sshpublickey
1468 return c
1469 }
1470
1471 // Fields allows partial responses to be retrieved. See
1472 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1473 // details.
1474 func (c *UsersSshPublicKeysCreateCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysCreateCall {
1475 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1476 return c
1477 }
1478
1479 // Context sets the context to be used in this call's Do method.
1480 func (c *UsersSshPublicKeysCreateCall) Context(ctx context.Context) *UsersSshPublicKeysCreateCall {
1481 c.ctx_ = ctx
1482 return c
1483 }
1484
1485 // Header returns a http.Header that can be modified by the caller to add
1486 // headers to the request.
1487 func (c *UsersSshPublicKeysCreateCall) Header() http.Header {
1488 if c.header_ == nil {
1489 c.header_ = make(http.Header)
1490 }
1491 return c.header_
1492 }
1493
1494 func (c *UsersSshPublicKeysCreateCall) doRequest(alt string) (*http.Response, error) {
1495 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1496 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.sshpublickey)
1497 if err != nil {
1498 return nil, err
1499 }
1500 c.urlParams_.Set("alt", alt)
1501 c.urlParams_.Set("prettyPrint", "false")
1502 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+parent}/sshPublicKeys")
1503 urls += "?" + c.urlParams_.Encode()
1504 req, err := http.NewRequest("POST", urls, body)
1505 if err != nil {
1506 return nil, err
1507 }
1508 req.Header = reqHeaders
1509 googleapi.Expand(req.URL, map[string]string{
1510 "parent": c.parent,
1511 })
1512 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.create", "request", internallog.HTTPRequest(req, body.Bytes()))
1513 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1514 }
1515
1516 // Do executes the "oslogin.users.sshPublicKeys.create" call.
1517 // Any non-2xx status code is an error. Response headers are in either
1518 // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
1519 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1520 // whether the returned error was because http.StatusNotModified was returned.
1521 func (c *UsersSshPublicKeysCreateCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1522 gensupport.SetOptions(c.urlParams_, opts...)
1523 res, err := c.doRequest("json")
1524 if res != nil && res.StatusCode == http.StatusNotModified {
1525 if res.Body != nil {
1526 res.Body.Close()
1527 }
1528 return nil, gensupport.WrapError(&googleapi.Error{
1529 Code: res.StatusCode,
1530 Header: res.Header,
1531 })
1532 }
1533 if err != nil {
1534 return nil, err
1535 }
1536 defer googleapi.CloseBody(res)
1537 if err := googleapi.CheckResponse(res); err != nil {
1538 return nil, gensupport.WrapError(err)
1539 }
1540 ret := &SshPublicKey{
1541 ServerResponse: googleapi.ServerResponse{
1542 Header: res.Header,
1543 HTTPStatusCode: res.StatusCode,
1544 },
1545 }
1546 target := &ret
1547 b, err := gensupport.DecodeResponseBytes(target, res)
1548 if err != nil {
1549 return nil, err
1550 }
1551 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.create", "response", internallog.HTTPResponse(res, b))
1552 return ret, nil
1553 }
1554
1555 type UsersSshPublicKeysDeleteCall struct {
1556 s *Service
1557 name string
1558 urlParams_ gensupport.URLParams
1559 ctx_ context.Context
1560 header_ http.Header
1561 }
1562
1563 // Delete: Deletes an SSH public key.
1564 //
1565 // - name: The fingerprint of the public key to update. Public keys are
1566 // identified by their SHA-256 fingerprint. The fingerprint of the public key
1567 // is in format `users/{user}/sshPublicKeys/{fingerprint}`.
1568 func (r *UsersSshPublicKeysService) Delete(name string) *UsersSshPublicKeysDeleteCall {
1569 c := &UsersSshPublicKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1570 c.name = name
1571 return c
1572 }
1573
1574 // Fields allows partial responses to be retrieved. See
1575 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1576 // details.
1577 func (c *UsersSshPublicKeysDeleteCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysDeleteCall {
1578 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1579 return c
1580 }
1581
1582 // Context sets the context to be used in this call's Do method.
1583 func (c *UsersSshPublicKeysDeleteCall) Context(ctx context.Context) *UsersSshPublicKeysDeleteCall {
1584 c.ctx_ = ctx
1585 return c
1586 }
1587
1588 // Header returns a http.Header that can be modified by the caller to add
1589 // headers to the request.
1590 func (c *UsersSshPublicKeysDeleteCall) Header() http.Header {
1591 if c.header_ == nil {
1592 c.header_ = make(http.Header)
1593 }
1594 return c.header_
1595 }
1596
1597 func (c *UsersSshPublicKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
1598 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1599 c.urlParams_.Set("alt", alt)
1600 c.urlParams_.Set("prettyPrint", "false")
1601 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
1602 urls += "?" + c.urlParams_.Encode()
1603 req, err := http.NewRequest("DELETE", urls, nil)
1604 if err != nil {
1605 return nil, err
1606 }
1607 req.Header = reqHeaders
1608 googleapi.Expand(req.URL, map[string]string{
1609 "name": c.name,
1610 })
1611 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.delete", "request", internallog.HTTPRequest(req, nil))
1612 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1613 }
1614
1615 // Do executes the "oslogin.users.sshPublicKeys.delete" call.
1616 // Any non-2xx status code is an error. Response headers are in either
1617 // *Empty.ServerResponse.Header or (if a response was returned at all) in
1618 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1619 // whether the returned error was because http.StatusNotModified was returned.
1620 func (c *UsersSshPublicKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1621 gensupport.SetOptions(c.urlParams_, opts...)
1622 res, err := c.doRequest("json")
1623 if res != nil && res.StatusCode == http.StatusNotModified {
1624 if res.Body != nil {
1625 res.Body.Close()
1626 }
1627 return nil, gensupport.WrapError(&googleapi.Error{
1628 Code: res.StatusCode,
1629 Header: res.Header,
1630 })
1631 }
1632 if err != nil {
1633 return nil, err
1634 }
1635 defer googleapi.CloseBody(res)
1636 if err := googleapi.CheckResponse(res); err != nil {
1637 return nil, gensupport.WrapError(err)
1638 }
1639 ret := &Empty{
1640 ServerResponse: googleapi.ServerResponse{
1641 Header: res.Header,
1642 HTTPStatusCode: res.StatusCode,
1643 },
1644 }
1645 target := &ret
1646 b, err := gensupport.DecodeResponseBytes(target, res)
1647 if err != nil {
1648 return nil, err
1649 }
1650 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.delete", "response", internallog.HTTPResponse(res, b))
1651 return ret, nil
1652 }
1653
1654 type UsersSshPublicKeysGetCall struct {
1655 s *Service
1656 name string
1657 urlParams_ gensupport.URLParams
1658 ifNoneMatch_ string
1659 ctx_ context.Context
1660 header_ http.Header
1661 }
1662
1663 // Get: Retrieves an SSH public key.
1664 //
1665 // - name: The fingerprint of the public key to retrieve. Public keys are
1666 // identified by their SHA-256 fingerprint. The fingerprint of the public key
1667 // is in format `users/{user}/sshPublicKeys/{fingerprint}`.
1668 func (r *UsersSshPublicKeysService) Get(name string) *UsersSshPublicKeysGetCall {
1669 c := &UsersSshPublicKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1670 c.name = name
1671 return c
1672 }
1673
1674 // Fields allows partial responses to be retrieved. See
1675 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1676 // details.
1677 func (c *UsersSshPublicKeysGetCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysGetCall {
1678 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1679 return c
1680 }
1681
1682 // IfNoneMatch sets an optional parameter which makes the operation fail if the
1683 // object's ETag matches the given value. This is useful for getting updates
1684 // only after the object has changed since the last request.
1685 func (c *UsersSshPublicKeysGetCall) IfNoneMatch(entityTag string) *UsersSshPublicKeysGetCall {
1686 c.ifNoneMatch_ = entityTag
1687 return c
1688 }
1689
1690 // Context sets the context to be used in this call's Do method.
1691 func (c *UsersSshPublicKeysGetCall) Context(ctx context.Context) *UsersSshPublicKeysGetCall {
1692 c.ctx_ = ctx
1693 return c
1694 }
1695
1696 // Header returns a http.Header that can be modified by the caller to add
1697 // headers to the request.
1698 func (c *UsersSshPublicKeysGetCall) Header() http.Header {
1699 if c.header_ == nil {
1700 c.header_ = make(http.Header)
1701 }
1702 return c.header_
1703 }
1704
1705 func (c *UsersSshPublicKeysGetCall) doRequest(alt string) (*http.Response, error) {
1706 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1707 if c.ifNoneMatch_ != "" {
1708 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1709 }
1710 c.urlParams_.Set("alt", alt)
1711 c.urlParams_.Set("prettyPrint", "false")
1712 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
1713 urls += "?" + c.urlParams_.Encode()
1714 req, err := http.NewRequest("GET", urls, nil)
1715 if err != nil {
1716 return nil, err
1717 }
1718 req.Header = reqHeaders
1719 googleapi.Expand(req.URL, map[string]string{
1720 "name": c.name,
1721 })
1722 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.get", "request", internallog.HTTPRequest(req, nil))
1723 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1724 }
1725
1726 // Do executes the "oslogin.users.sshPublicKeys.get" call.
1727 // Any non-2xx status code is an error. Response headers are in either
1728 // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
1729 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1730 // whether the returned error was because http.StatusNotModified was returned.
1731 func (c *UsersSshPublicKeysGetCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1732 gensupport.SetOptions(c.urlParams_, opts...)
1733 res, err := c.doRequest("json")
1734 if res != nil && res.StatusCode == http.StatusNotModified {
1735 if res.Body != nil {
1736 res.Body.Close()
1737 }
1738 return nil, gensupport.WrapError(&googleapi.Error{
1739 Code: res.StatusCode,
1740 Header: res.Header,
1741 })
1742 }
1743 if err != nil {
1744 return nil, err
1745 }
1746 defer googleapi.CloseBody(res)
1747 if err := googleapi.CheckResponse(res); err != nil {
1748 return nil, gensupport.WrapError(err)
1749 }
1750 ret := &SshPublicKey{
1751 ServerResponse: googleapi.ServerResponse{
1752 Header: res.Header,
1753 HTTPStatusCode: res.StatusCode,
1754 },
1755 }
1756 target := &ret
1757 b, err := gensupport.DecodeResponseBytes(target, res)
1758 if err != nil {
1759 return nil, err
1760 }
1761 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.get", "response", internallog.HTTPResponse(res, b))
1762 return ret, nil
1763 }
1764
1765 type UsersSshPublicKeysPatchCall struct {
1766 s *Service
1767 name string
1768 sshpublickey *SshPublicKey
1769 urlParams_ gensupport.URLParams
1770 ctx_ context.Context
1771 header_ http.Header
1772 }
1773
1774 // Patch: Updates an SSH public key and returns the profile information. This
1775 // method supports patch semantics.
1776 //
1777 // - name: The fingerprint of the public key to update. Public keys are
1778 // identified by their SHA-256 fingerprint. The fingerprint of the public key
1779 // is in format `users/{user}/sshPublicKeys/{fingerprint}`.
1780 func (r *UsersSshPublicKeysService) Patch(name string, sshpublickey *SshPublicKey) *UsersSshPublicKeysPatchCall {
1781 c := &UsersSshPublicKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1782 c.name = name
1783 c.sshpublickey = sshpublickey
1784 return c
1785 }
1786
1787 // UpdateMask sets the optional parameter "updateMask": Mask to control which
1788 // fields get updated. Updates all if not present.
1789 func (c *UsersSshPublicKeysPatchCall) UpdateMask(updateMask string) *UsersSshPublicKeysPatchCall {
1790 c.urlParams_.Set("updateMask", updateMask)
1791 return c
1792 }
1793
1794 // Fields allows partial responses to be retrieved. See
1795 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
1796 // details.
1797 func (c *UsersSshPublicKeysPatchCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysPatchCall {
1798 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1799 return c
1800 }
1801
1802 // Context sets the context to be used in this call's Do method.
1803 func (c *UsersSshPublicKeysPatchCall) Context(ctx context.Context) *UsersSshPublicKeysPatchCall {
1804 c.ctx_ = ctx
1805 return c
1806 }
1807
1808 // Header returns a http.Header that can be modified by the caller to add
1809 // headers to the request.
1810 func (c *UsersSshPublicKeysPatchCall) Header() http.Header {
1811 if c.header_ == nil {
1812 c.header_ = make(http.Header)
1813 }
1814 return c.header_
1815 }
1816
1817 func (c *UsersSshPublicKeysPatchCall) doRequest(alt string) (*http.Response, error) {
1818 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1819 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.sshpublickey)
1820 if err != nil {
1821 return nil, err
1822 }
1823 c.urlParams_.Set("alt", alt)
1824 c.urlParams_.Set("prettyPrint", "false")
1825 urls := googleapi.ResolveRelative(c.s.BasePath, "v1alpha/{+name}")
1826 urls += "?" + c.urlParams_.Encode()
1827 req, err := http.NewRequest("PATCH", urls, body)
1828 if err != nil {
1829 return nil, err
1830 }
1831 req.Header = reqHeaders
1832 googleapi.Expand(req.URL, map[string]string{
1833 "name": c.name,
1834 })
1835 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.patch", "request", internallog.HTTPRequest(req, body.Bytes()))
1836 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1837 }
1838
1839 // Do executes the "oslogin.users.sshPublicKeys.patch" call.
1840 // Any non-2xx status code is an error. Response headers are in either
1841 // *SshPublicKey.ServerResponse.Header or (if a response was returned at all)
1842 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
1843 // whether the returned error was because http.StatusNotModified was returned.
1844 func (c *UsersSshPublicKeysPatchCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1845 gensupport.SetOptions(c.urlParams_, opts...)
1846 res, err := c.doRequest("json")
1847 if res != nil && res.StatusCode == http.StatusNotModified {
1848 if res.Body != nil {
1849 res.Body.Close()
1850 }
1851 return nil, gensupport.WrapError(&googleapi.Error{
1852 Code: res.StatusCode,
1853 Header: res.Header,
1854 })
1855 }
1856 if err != nil {
1857 return nil, err
1858 }
1859 defer googleapi.CloseBody(res)
1860 if err := googleapi.CheckResponse(res); err != nil {
1861 return nil, gensupport.WrapError(err)
1862 }
1863 ret := &SshPublicKey{
1864 ServerResponse: googleapi.ServerResponse{
1865 Header: res.Header,
1866 HTTPStatusCode: res.StatusCode,
1867 },
1868 }
1869 target := &ret
1870 b, err := gensupport.DecodeResponseBytes(target, res)
1871 if err != nil {
1872 return nil, err
1873 }
1874 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "oslogin.users.sshPublicKeys.patch", "response", internallog.HTTPResponse(res, b))
1875 return ret, nil
1876 }