1// Copyright 2019 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// Creating a client
14//
15// Usage example:
16//
17//   import "google.golang.org/api/oslogin/v1"
18//   ...
19//   ctx := context.Background()
20//   osloginService, err := oslogin.NewService(ctx)
21//
22// In this example, Google Application Default Credentials are used for authentication.
23//
24// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
25//
26// Other authentication options
27//
28// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
29//
30//   osloginService, err := oslogin.NewService(ctx, option.WithScopes(oslogin.ComputeScope))
31//
32// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
33//
34//   osloginService, err := oslogin.NewService(ctx, option.WithAPIKey("AIza..."))
35//
36// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
37//
38//   config := &oauth2.Config{...}
39//   // ...
40//   token, err := config.Exchange(ctx, ...)
41//   osloginService, err := oslogin.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
42//
43// See https://godoc.org/google.golang.org/api/option/ for details on options.
44package oslogin // import "google.golang.org/api/oslogin/v1"
45
46import (
47	"bytes"
48	"context"
49	"encoding/json"
50	"errors"
51	"fmt"
52	"io"
53	"net/http"
54	"net/url"
55	"strconv"
56	"strings"
57
58	gensupport "google.golang.org/api/gensupport"
59	googleapi "google.golang.org/api/googleapi"
60	option "google.golang.org/api/option"
61	htransport "google.golang.org/api/transport/http"
62)
63
64// Always reference these packages, just in case the auto-generated code
65// below doesn't.
66var _ = bytes.NewBuffer
67var _ = strconv.Itoa
68var _ = fmt.Sprintf
69var _ = json.NewDecoder
70var _ = io.Copy
71var _ = url.Parse
72var _ = gensupport.MarshalJSON
73var _ = googleapi.Version
74var _ = errors.New
75var _ = strings.Replace
76var _ = context.Canceled
77
78const apiId = "oslogin:v1"
79const apiName = "oslogin"
80const apiVersion = "v1"
81const basePath = "https://oslogin.googleapis.com/"
82
83// OAuth2 scopes used by this API.
84const (
85	// View and manage your data across Google Cloud Platform services
86	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
87
88	// View and manage your Google Compute Engine resources
89	ComputeScope = "https://www.googleapis.com/auth/compute"
90)
91
92// NewService creates a new Service.
93func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
94	scopesOption := option.WithScopes(
95		"https://www.googleapis.com/auth/cloud-platform",
96		"https://www.googleapis.com/auth/compute",
97	)
98	// NOTE: prepend, so we don't override user-specified scopes.
99	opts = append([]option.ClientOption{scopesOption}, opts...)
100	client, endpoint, err := htransport.NewClient(ctx, opts...)
101	if err != nil {
102		return nil, err
103	}
104	s, err := New(client)
105	if err != nil {
106		return nil, err
107	}
108	if endpoint != "" {
109		s.BasePath = endpoint
110	}
111	return s, nil
112}
113
114// New creates a new Service. It uses the provided http.Client for requests.
115//
116// Deprecated: please use NewService instead.
117// To provide a custom HTTP client, use option.WithHTTPClient.
118// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
119func New(client *http.Client) (*Service, error) {
120	if client == nil {
121		return nil, errors.New("client is nil")
122	}
123	s := &Service{client: client, BasePath: basePath}
124	s.Users = NewUsersService(s)
125	return s, nil
126}
127
128type Service struct {
129	client    *http.Client
130	BasePath  string // API endpoint base URL
131	UserAgent string // optional additional User-Agent fragment
132
133	Users *UsersService
134}
135
136func (s *Service) userAgent() string {
137	if s.UserAgent == "" {
138		return googleapi.UserAgent
139	}
140	return googleapi.UserAgent + " " + s.UserAgent
141}
142
143func NewUsersService(s *Service) *UsersService {
144	rs := &UsersService{s: s}
145	rs.Projects = NewUsersProjectsService(s)
146	rs.SshPublicKeys = NewUsersSshPublicKeysService(s)
147	return rs
148}
149
150type UsersService struct {
151	s *Service
152
153	Projects *UsersProjectsService
154
155	SshPublicKeys *UsersSshPublicKeysService
156}
157
158func NewUsersProjectsService(s *Service) *UsersProjectsService {
159	rs := &UsersProjectsService{s: s}
160	return rs
161}
162
163type UsersProjectsService struct {
164	s *Service
165}
166
167func NewUsersSshPublicKeysService(s *Service) *UsersSshPublicKeysService {
168	rs := &UsersSshPublicKeysService{s: s}
169	return rs
170}
171
172type UsersSshPublicKeysService struct {
173	s *Service
174}
175
176// Empty: A generic empty message that you can re-use to avoid defining
177// duplicated
178// empty messages in your APIs. A typical example is to use it as the
179// request
180// or the response type of an API method. For instance:
181//
182//     service Foo {
183//       rpc Bar(google.protobuf.Empty) returns
184// (google.protobuf.Empty);
185//     }
186//
187// The JSON representation for `Empty` is empty JSON object `{}`.
188type Empty struct {
189	// ServerResponse contains the HTTP response code and headers from the
190	// server.
191	googleapi.ServerResponse `json:"-"`
192}
193
194// ImportSshPublicKeyResponse: A response message for importing an SSH
195// public key.
196type ImportSshPublicKeyResponse struct {
197	// LoginProfile: The login profile information for the user.
198	LoginProfile *LoginProfile `json:"loginProfile,omitempty"`
199
200	// ServerResponse contains the HTTP response code and headers from the
201	// server.
202	googleapi.ServerResponse `json:"-"`
203
204	// ForceSendFields is a list of field names (e.g. "LoginProfile") to
205	// unconditionally include in API requests. By default, fields with
206	// empty values are omitted from API requests. However, any non-pointer,
207	// non-interface field appearing in ForceSendFields will be sent to the
208	// server regardless of whether the field is empty or not. This may be
209	// used to include empty fields in Patch requests.
210	ForceSendFields []string `json:"-"`
211
212	// NullFields is a list of field names (e.g. "LoginProfile") to include
213	// in API requests with the JSON null value. By default, fields with
214	// empty values are omitted from API requests. However, any field with
215	// an empty value appearing in NullFields will be sent to the server as
216	// null. It is an error if a field in this list has a non-empty value.
217	// This may be used to include null fields in Patch requests.
218	NullFields []string `json:"-"`
219}
220
221func (s *ImportSshPublicKeyResponse) MarshalJSON() ([]byte, error) {
222	type NoMethod ImportSshPublicKeyResponse
223	raw := NoMethod(*s)
224	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
225}
226
227// LoginProfile: The user profile information used for logging in to a
228// virtual machine on
229// Google Compute Engine.
230type LoginProfile struct {
231	// Name: A unique user ID.
232	Name string `json:"name,omitempty"`
233
234	// PosixAccounts: The list of POSIX accounts associated with the user.
235	PosixAccounts []*PosixAccount `json:"posixAccounts,omitempty"`
236
237	// SshPublicKeys: A map from SSH public key fingerprint to the
238	// associated key object.
239	SshPublicKeys map[string]SshPublicKey `json:"sshPublicKeys,omitempty"`
240
241	// ServerResponse contains the HTTP response code and headers from the
242	// server.
243	googleapi.ServerResponse `json:"-"`
244
245	// ForceSendFields is a list of field names (e.g. "Name") to
246	// unconditionally include in API requests. By default, fields with
247	// empty values are omitted from API requests. However, any non-pointer,
248	// non-interface field appearing in ForceSendFields will be sent to the
249	// server regardless of whether the field is empty or not. This may be
250	// used to include empty fields in Patch requests.
251	ForceSendFields []string `json:"-"`
252
253	// NullFields is a list of field names (e.g. "Name") to include in API
254	// requests with the JSON null value. By default, fields with empty
255	// values are omitted from API requests. However, any field with an
256	// empty value appearing in NullFields will be sent to the server as
257	// null. It is an error if a field in this list has a non-empty value.
258	// This may be used to include null fields in Patch requests.
259	NullFields []string `json:"-"`
260}
261
262func (s *LoginProfile) MarshalJSON() ([]byte, error) {
263	type NoMethod LoginProfile
264	raw := NoMethod(*s)
265	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
266}
267
268// PosixAccount: The POSIX account information associated with a Google
269// account.
270type PosixAccount struct {
271	// AccountId: Output only. A POSIX account identifier.
272	AccountId string `json:"accountId,omitempty"`
273
274	// Gecos: The GECOS (user information) entry for this account.
275	Gecos string `json:"gecos,omitempty"`
276
277	// Gid: The default group ID.
278	Gid int64 `json:"gid,omitempty,string"`
279
280	// HomeDirectory: The path to the home directory for this account.
281	HomeDirectory string `json:"homeDirectory,omitempty"`
282
283	// OperatingSystemType: The operating system type where this account
284	// applies.
285	//
286	// Possible values:
287	//   "OPERATING_SYSTEM_TYPE_UNSPECIFIED" - The operating system type
288	// associated with the user account information is
289	// unspecified.
290	//   "LINUX" - Linux user account information.
291	//   "WINDOWS" - Windows user account information.
292	OperatingSystemType string `json:"operatingSystemType,omitempty"`
293
294	// Primary: Only one POSIX account can be marked as primary.
295	Primary bool `json:"primary,omitempty"`
296
297	// Shell: The path to the logic shell for this account.
298	Shell string `json:"shell,omitempty"`
299
300	// SystemId: System identifier for which account the username or uid
301	// applies to.
302	// By default, the empty value is used.
303	SystemId string `json:"systemId,omitempty"`
304
305	// Uid: The user ID.
306	Uid int64 `json:"uid,omitempty,string"`
307
308	// Username: The username of the POSIX account.
309	Username string `json:"username,omitempty"`
310
311	// ForceSendFields is a list of field names (e.g. "AccountId") to
312	// unconditionally include in API requests. By default, fields with
313	// empty values are omitted from API requests. However, any non-pointer,
314	// non-interface field appearing in ForceSendFields will be sent to the
315	// server regardless of whether the field is empty or not. This may be
316	// used to include empty fields in Patch requests.
317	ForceSendFields []string `json:"-"`
318
319	// NullFields is a list of field names (e.g. "AccountId") to include in
320	// API requests with the JSON null value. By default, fields with empty
321	// values are omitted from API requests. However, any field with an
322	// empty value appearing in NullFields will be sent to the server as
323	// null. It is an error if a field in this list has a non-empty value.
324	// This may be used to include null fields in Patch requests.
325	NullFields []string `json:"-"`
326}
327
328func (s *PosixAccount) MarshalJSON() ([]byte, error) {
329	type NoMethod PosixAccount
330	raw := NoMethod(*s)
331	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
332}
333
334// SshPublicKey: The SSH public key information associated with a Google
335// account.
336type SshPublicKey struct {
337	// ExpirationTimeUsec: An expiration time in microseconds since epoch.
338	ExpirationTimeUsec int64 `json:"expirationTimeUsec,omitempty,string"`
339
340	// Fingerprint: Output only. The SHA-256 fingerprint of the SSH public
341	// key.
342	Fingerprint string `json:"fingerprint,omitempty"`
343
344	// Key: Public key text in SSH format, defined by
345	// <a href="https://www.ietf.org/rfc/rfc4253.txt"
346	// target="_blank">RFC4253</a>
347	// section 6.6.
348	Key string `json:"key,omitempty"`
349
350	// ServerResponse contains the HTTP response code and headers from the
351	// server.
352	googleapi.ServerResponse `json:"-"`
353
354	// ForceSendFields is a list of field names (e.g. "ExpirationTimeUsec")
355	// to unconditionally include in API requests. By default, fields with
356	// empty values are omitted from API requests. However, any non-pointer,
357	// non-interface field appearing in ForceSendFields will be sent to the
358	// server regardless of whether the field is empty or not. This may be
359	// used to include empty fields in Patch requests.
360	ForceSendFields []string `json:"-"`
361
362	// NullFields is a list of field names (e.g. "ExpirationTimeUsec") to
363	// include in API requests with the JSON null value. By default, fields
364	// with empty values are omitted from API requests. However, any field
365	// with an empty value appearing in NullFields will be sent to the
366	// server as null. It is an error if a field in this list has a
367	// non-empty value. This may be used to include null fields in Patch
368	// requests.
369	NullFields []string `json:"-"`
370}
371
372func (s *SshPublicKey) MarshalJSON() ([]byte, error) {
373	type NoMethod SshPublicKey
374	raw := NoMethod(*s)
375	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
376}
377
378// method id "oslogin.users.getLoginProfile":
379
380type UsersGetLoginProfileCall struct {
381	s            *Service
382	name         string
383	urlParams_   gensupport.URLParams
384	ifNoneMatch_ string
385	ctx_         context.Context
386	header_      http.Header
387}
388
389// GetLoginProfile: Retrieves the profile information used for logging
390// in to a virtual machine
391// on Google Compute Engine.
392func (r *UsersService) GetLoginProfile(name string) *UsersGetLoginProfileCall {
393	c := &UsersGetLoginProfileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
394	c.name = name
395	return c
396}
397
398// ProjectId sets the optional parameter "projectId": The project ID of
399// the Google Cloud Platform project.
400func (c *UsersGetLoginProfileCall) ProjectId(projectId string) *UsersGetLoginProfileCall {
401	c.urlParams_.Set("projectId", projectId)
402	return c
403}
404
405// SystemId sets the optional parameter "systemId": A system ID for
406// filtering the results of the request.
407func (c *UsersGetLoginProfileCall) SystemId(systemId string) *UsersGetLoginProfileCall {
408	c.urlParams_.Set("systemId", systemId)
409	return c
410}
411
412// Fields allows partial responses to be retrieved. See
413// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
414// for more information.
415func (c *UsersGetLoginProfileCall) Fields(s ...googleapi.Field) *UsersGetLoginProfileCall {
416	c.urlParams_.Set("fields", googleapi.CombineFields(s))
417	return c
418}
419
420// IfNoneMatch sets the optional parameter which makes the operation
421// fail if the object's ETag matches the given value. This is useful for
422// getting updates only after the object has changed since the last
423// request. Use googleapi.IsNotModified to check whether the response
424// error from Do is the result of In-None-Match.
425func (c *UsersGetLoginProfileCall) IfNoneMatch(entityTag string) *UsersGetLoginProfileCall {
426	c.ifNoneMatch_ = entityTag
427	return c
428}
429
430// Context sets the context to be used in this call's Do method. Any
431// pending HTTP request will be aborted if the provided context is
432// canceled.
433func (c *UsersGetLoginProfileCall) Context(ctx context.Context) *UsersGetLoginProfileCall {
434	c.ctx_ = ctx
435	return c
436}
437
438// Header returns an http.Header that can be modified by the caller to
439// add HTTP headers to the request.
440func (c *UsersGetLoginProfileCall) Header() http.Header {
441	if c.header_ == nil {
442		c.header_ = make(http.Header)
443	}
444	return c.header_
445}
446
447func (c *UsersGetLoginProfileCall) doRequest(alt string) (*http.Response, error) {
448	reqHeaders := make(http.Header)
449	for k, v := range c.header_ {
450		reqHeaders[k] = v
451	}
452	reqHeaders.Set("User-Agent", c.s.userAgent())
453	if c.ifNoneMatch_ != "" {
454		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
455	}
456	var body io.Reader = nil
457	c.urlParams_.Set("alt", alt)
458	c.urlParams_.Set("prettyPrint", "false")
459	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/loginProfile")
460	urls += "?" + c.urlParams_.Encode()
461	req, err := http.NewRequest("GET", urls, body)
462	if err != nil {
463		return nil, err
464	}
465	req.Header = reqHeaders
466	googleapi.Expand(req.URL, map[string]string{
467		"name": c.name,
468	})
469	return gensupport.SendRequest(c.ctx_, c.s.client, req)
470}
471
472// Do executes the "oslogin.users.getLoginProfile" call.
473// Exactly one of *LoginProfile or error will be non-nil. Any non-2xx
474// status code is an error. Response headers are in either
475// *LoginProfile.ServerResponse.Header or (if a response was returned at
476// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
477// to check whether the returned error was because
478// http.StatusNotModified was returned.
479func (c *UsersGetLoginProfileCall) Do(opts ...googleapi.CallOption) (*LoginProfile, error) {
480	gensupport.SetOptions(c.urlParams_, opts...)
481	res, err := c.doRequest("json")
482	if res != nil && res.StatusCode == http.StatusNotModified {
483		if res.Body != nil {
484			res.Body.Close()
485		}
486		return nil, &googleapi.Error{
487			Code:   res.StatusCode,
488			Header: res.Header,
489		}
490	}
491	if err != nil {
492		return nil, err
493	}
494	defer googleapi.CloseBody(res)
495	if err := googleapi.CheckResponse(res); err != nil {
496		return nil, err
497	}
498	ret := &LoginProfile{
499		ServerResponse: googleapi.ServerResponse{
500			Header:         res.Header,
501			HTTPStatusCode: res.StatusCode,
502		},
503	}
504	target := &ret
505	if err := gensupport.DecodeResponse(target, res); err != nil {
506		return nil, err
507	}
508	return ret, nil
509	// {
510	//   "description": "Retrieves the profile information used for logging in to a virtual machine\non Google Compute Engine.",
511	//   "flatPath": "v1/users/{usersId}/loginProfile",
512	//   "httpMethod": "GET",
513	//   "id": "oslogin.users.getLoginProfile",
514	//   "parameterOrder": [
515	//     "name"
516	//   ],
517	//   "parameters": {
518	//     "name": {
519	//       "description": "The unique ID for the user in format `users/{user}`.",
520	//       "location": "path",
521	//       "pattern": "^users/[^/]+$",
522	//       "required": true,
523	//       "type": "string"
524	//     },
525	//     "projectId": {
526	//       "description": "The project ID of the Google Cloud Platform project.",
527	//       "location": "query",
528	//       "type": "string"
529	//     },
530	//     "systemId": {
531	//       "description": "A system ID for filtering the results of the request.",
532	//       "location": "query",
533	//       "type": "string"
534	//     }
535	//   },
536	//   "path": "v1/{+name}/loginProfile",
537	//   "response": {
538	//     "$ref": "LoginProfile"
539	//   },
540	//   "scopes": [
541	//     "https://www.googleapis.com/auth/cloud-platform",
542	//     "https://www.googleapis.com/auth/compute"
543	//   ]
544	// }
545
546}
547
548// method id "oslogin.users.importSshPublicKey":
549
550type UsersImportSshPublicKeyCall struct {
551	s            *Service
552	parent       string
553	sshpublickey *SshPublicKey
554	urlParams_   gensupport.URLParams
555	ctx_         context.Context
556	header_      http.Header
557}
558
559// ImportSshPublicKey: Adds an SSH public key and returns the profile
560// information. Default POSIX
561// account information is set when no username and UID exist as part of
562// the
563// login profile.
564func (r *UsersService) ImportSshPublicKey(parent string, sshpublickey *SshPublicKey) *UsersImportSshPublicKeyCall {
565	c := &UsersImportSshPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
566	c.parent = parent
567	c.sshpublickey = sshpublickey
568	return c
569}
570
571// ProjectId sets the optional parameter "projectId": The project ID of
572// the Google Cloud Platform project.
573func (c *UsersImportSshPublicKeyCall) ProjectId(projectId string) *UsersImportSshPublicKeyCall {
574	c.urlParams_.Set("projectId", projectId)
575	return c
576}
577
578// Fields allows partial responses to be retrieved. See
579// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
580// for more information.
581func (c *UsersImportSshPublicKeyCall) Fields(s ...googleapi.Field) *UsersImportSshPublicKeyCall {
582	c.urlParams_.Set("fields", googleapi.CombineFields(s))
583	return c
584}
585
586// Context sets the context to be used in this call's Do method. Any
587// pending HTTP request will be aborted if the provided context is
588// canceled.
589func (c *UsersImportSshPublicKeyCall) Context(ctx context.Context) *UsersImportSshPublicKeyCall {
590	c.ctx_ = ctx
591	return c
592}
593
594// Header returns an http.Header that can be modified by the caller to
595// add HTTP headers to the request.
596func (c *UsersImportSshPublicKeyCall) Header() http.Header {
597	if c.header_ == nil {
598		c.header_ = make(http.Header)
599	}
600	return c.header_
601}
602
603func (c *UsersImportSshPublicKeyCall) doRequest(alt string) (*http.Response, error) {
604	reqHeaders := make(http.Header)
605	for k, v := range c.header_ {
606		reqHeaders[k] = v
607	}
608	reqHeaders.Set("User-Agent", c.s.userAgent())
609	var body io.Reader = nil
610	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
611	if err != nil {
612		return nil, err
613	}
614	reqHeaders.Set("Content-Type", "application/json")
615	c.urlParams_.Set("alt", alt)
616	c.urlParams_.Set("prettyPrint", "false")
617	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}:importSshPublicKey")
618	urls += "?" + c.urlParams_.Encode()
619	req, err := http.NewRequest("POST", urls, body)
620	if err != nil {
621		return nil, err
622	}
623	req.Header = reqHeaders
624	googleapi.Expand(req.URL, map[string]string{
625		"parent": c.parent,
626	})
627	return gensupport.SendRequest(c.ctx_, c.s.client, req)
628}
629
630// Do executes the "oslogin.users.importSshPublicKey" call.
631// Exactly one of *ImportSshPublicKeyResponse or error will be non-nil.
632// Any non-2xx status code is an error. Response headers are in either
633// *ImportSshPublicKeyResponse.ServerResponse.Header or (if a response
634// was returned at all) in error.(*googleapi.Error).Header. Use
635// googleapi.IsNotModified to check whether the returned error was
636// because http.StatusNotModified was returned.
637func (c *UsersImportSshPublicKeyCall) Do(opts ...googleapi.CallOption) (*ImportSshPublicKeyResponse, error) {
638	gensupport.SetOptions(c.urlParams_, opts...)
639	res, err := c.doRequest("json")
640	if res != nil && res.StatusCode == http.StatusNotModified {
641		if res.Body != nil {
642			res.Body.Close()
643		}
644		return nil, &googleapi.Error{
645			Code:   res.StatusCode,
646			Header: res.Header,
647		}
648	}
649	if err != nil {
650		return nil, err
651	}
652	defer googleapi.CloseBody(res)
653	if err := googleapi.CheckResponse(res); err != nil {
654		return nil, err
655	}
656	ret := &ImportSshPublicKeyResponse{
657		ServerResponse: googleapi.ServerResponse{
658			Header:         res.Header,
659			HTTPStatusCode: res.StatusCode,
660		},
661	}
662	target := &ret
663	if err := gensupport.DecodeResponse(target, res); err != nil {
664		return nil, err
665	}
666	return ret, nil
667	// {
668	//   "description": "Adds an SSH public key and returns the profile information. Default POSIX\naccount information is set when no username and UID exist as part of the\nlogin profile.",
669	//   "flatPath": "v1/users/{usersId}:importSshPublicKey",
670	//   "httpMethod": "POST",
671	//   "id": "oslogin.users.importSshPublicKey",
672	//   "parameterOrder": [
673	//     "parent"
674	//   ],
675	//   "parameters": {
676	//     "parent": {
677	//       "description": "The unique ID for the user in format `users/{user}`.",
678	//       "location": "path",
679	//       "pattern": "^users/[^/]+$",
680	//       "required": true,
681	//       "type": "string"
682	//     },
683	//     "projectId": {
684	//       "description": "The project ID of the Google Cloud Platform project.",
685	//       "location": "query",
686	//       "type": "string"
687	//     }
688	//   },
689	//   "path": "v1/{+parent}:importSshPublicKey",
690	//   "request": {
691	//     "$ref": "SshPublicKey"
692	//   },
693	//   "response": {
694	//     "$ref": "ImportSshPublicKeyResponse"
695	//   },
696	//   "scopes": [
697	//     "https://www.googleapis.com/auth/cloud-platform",
698	//     "https://www.googleapis.com/auth/compute"
699	//   ]
700	// }
701
702}
703
704// method id "oslogin.users.projects.delete":
705
706type UsersProjectsDeleteCall struct {
707	s          *Service
708	name       string
709	urlParams_ gensupport.URLParams
710	ctx_       context.Context
711	header_    http.Header
712}
713
714// Delete: Deletes a POSIX account.
715func (r *UsersProjectsService) Delete(name string) *UsersProjectsDeleteCall {
716	c := &UsersProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
717	c.name = name
718	return c
719}
720
721// Fields allows partial responses to be retrieved. See
722// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
723// for more information.
724func (c *UsersProjectsDeleteCall) Fields(s ...googleapi.Field) *UsersProjectsDeleteCall {
725	c.urlParams_.Set("fields", googleapi.CombineFields(s))
726	return c
727}
728
729// Context sets the context to be used in this call's Do method. Any
730// pending HTTP request will be aborted if the provided context is
731// canceled.
732func (c *UsersProjectsDeleteCall) Context(ctx context.Context) *UsersProjectsDeleteCall {
733	c.ctx_ = ctx
734	return c
735}
736
737// Header returns an http.Header that can be modified by the caller to
738// add HTTP headers to the request.
739func (c *UsersProjectsDeleteCall) Header() http.Header {
740	if c.header_ == nil {
741		c.header_ = make(http.Header)
742	}
743	return c.header_
744}
745
746func (c *UsersProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
747	reqHeaders := make(http.Header)
748	for k, v := range c.header_ {
749		reqHeaders[k] = v
750	}
751	reqHeaders.Set("User-Agent", c.s.userAgent())
752	var body io.Reader = nil
753	c.urlParams_.Set("alt", alt)
754	c.urlParams_.Set("prettyPrint", "false")
755	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
756	urls += "?" + c.urlParams_.Encode()
757	req, err := http.NewRequest("DELETE", urls, body)
758	if err != nil {
759		return nil, err
760	}
761	req.Header = reqHeaders
762	googleapi.Expand(req.URL, map[string]string{
763		"name": c.name,
764	})
765	return gensupport.SendRequest(c.ctx_, c.s.client, req)
766}
767
768// Do executes the "oslogin.users.projects.delete" call.
769// Exactly one of *Empty or error will be non-nil. Any non-2xx status
770// code is an error. Response headers are in either
771// *Empty.ServerResponse.Header or (if a response was returned at all)
772// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
773// check whether the returned error was because http.StatusNotModified
774// was returned.
775func (c *UsersProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
776	gensupport.SetOptions(c.urlParams_, opts...)
777	res, err := c.doRequest("json")
778	if res != nil && res.StatusCode == http.StatusNotModified {
779		if res.Body != nil {
780			res.Body.Close()
781		}
782		return nil, &googleapi.Error{
783			Code:   res.StatusCode,
784			Header: res.Header,
785		}
786	}
787	if err != nil {
788		return nil, err
789	}
790	defer googleapi.CloseBody(res)
791	if err := googleapi.CheckResponse(res); err != nil {
792		return nil, err
793	}
794	ret := &Empty{
795		ServerResponse: googleapi.ServerResponse{
796			Header:         res.Header,
797			HTTPStatusCode: res.StatusCode,
798		},
799	}
800	target := &ret
801	if err := gensupport.DecodeResponse(target, res); err != nil {
802		return nil, err
803	}
804	return ret, nil
805	// {
806	//   "description": "Deletes a POSIX account.",
807	//   "flatPath": "v1/users/{usersId}/projects/{projectsId}",
808	//   "httpMethod": "DELETE",
809	//   "id": "oslogin.users.projects.delete",
810	//   "parameterOrder": [
811	//     "name"
812	//   ],
813	//   "parameters": {
814	//     "name": {
815	//       "description": "A reference to the POSIX account to update. POSIX accounts are identified\nby the project ID they are associated with. A reference to the POSIX\naccount is in format `users/{user}/projects/{project}`.",
816	//       "location": "path",
817	//       "pattern": "^users/[^/]+/projects/[^/]+$",
818	//       "required": true,
819	//       "type": "string"
820	//     }
821	//   },
822	//   "path": "v1/{+name}",
823	//   "response": {
824	//     "$ref": "Empty"
825	//   },
826	//   "scopes": [
827	//     "https://www.googleapis.com/auth/cloud-platform",
828	//     "https://www.googleapis.com/auth/compute"
829	//   ]
830	// }
831
832}
833
834// method id "oslogin.users.sshPublicKeys.delete":
835
836type UsersSshPublicKeysDeleteCall struct {
837	s          *Service
838	name       string
839	urlParams_ gensupport.URLParams
840	ctx_       context.Context
841	header_    http.Header
842}
843
844// Delete: Deletes an SSH public key.
845func (r *UsersSshPublicKeysService) Delete(name string) *UsersSshPublicKeysDeleteCall {
846	c := &UsersSshPublicKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
847	c.name = name
848	return c
849}
850
851// Fields allows partial responses to be retrieved. See
852// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
853// for more information.
854func (c *UsersSshPublicKeysDeleteCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysDeleteCall {
855	c.urlParams_.Set("fields", googleapi.CombineFields(s))
856	return c
857}
858
859// Context sets the context to be used in this call's Do method. Any
860// pending HTTP request will be aborted if the provided context is
861// canceled.
862func (c *UsersSshPublicKeysDeleteCall) Context(ctx context.Context) *UsersSshPublicKeysDeleteCall {
863	c.ctx_ = ctx
864	return c
865}
866
867// Header returns an http.Header that can be modified by the caller to
868// add HTTP headers to the request.
869func (c *UsersSshPublicKeysDeleteCall) Header() http.Header {
870	if c.header_ == nil {
871		c.header_ = make(http.Header)
872	}
873	return c.header_
874}
875
876func (c *UsersSshPublicKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
877	reqHeaders := make(http.Header)
878	for k, v := range c.header_ {
879		reqHeaders[k] = v
880	}
881	reqHeaders.Set("User-Agent", c.s.userAgent())
882	var body io.Reader = nil
883	c.urlParams_.Set("alt", alt)
884	c.urlParams_.Set("prettyPrint", "false")
885	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
886	urls += "?" + c.urlParams_.Encode()
887	req, err := http.NewRequest("DELETE", urls, body)
888	if err != nil {
889		return nil, err
890	}
891	req.Header = reqHeaders
892	googleapi.Expand(req.URL, map[string]string{
893		"name": c.name,
894	})
895	return gensupport.SendRequest(c.ctx_, c.s.client, req)
896}
897
898// Do executes the "oslogin.users.sshPublicKeys.delete" call.
899// Exactly one of *Empty or error will be non-nil. Any non-2xx status
900// code is an error. Response headers are in either
901// *Empty.ServerResponse.Header or (if a response was returned at all)
902// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
903// check whether the returned error was because http.StatusNotModified
904// was returned.
905func (c *UsersSshPublicKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
906	gensupport.SetOptions(c.urlParams_, opts...)
907	res, err := c.doRequest("json")
908	if res != nil && res.StatusCode == http.StatusNotModified {
909		if res.Body != nil {
910			res.Body.Close()
911		}
912		return nil, &googleapi.Error{
913			Code:   res.StatusCode,
914			Header: res.Header,
915		}
916	}
917	if err != nil {
918		return nil, err
919	}
920	defer googleapi.CloseBody(res)
921	if err := googleapi.CheckResponse(res); err != nil {
922		return nil, err
923	}
924	ret := &Empty{
925		ServerResponse: googleapi.ServerResponse{
926			Header:         res.Header,
927			HTTPStatusCode: res.StatusCode,
928		},
929	}
930	target := &ret
931	if err := gensupport.DecodeResponse(target, res); err != nil {
932		return nil, err
933	}
934	return ret, nil
935	// {
936	//   "description": "Deletes an SSH public key.",
937	//   "flatPath": "v1/users/{usersId}/sshPublicKeys/{sshPublicKeysId}",
938	//   "httpMethod": "DELETE",
939	//   "id": "oslogin.users.sshPublicKeys.delete",
940	//   "parameterOrder": [
941	//     "name"
942	//   ],
943	//   "parameters": {
944	//     "name": {
945	//       "description": "The fingerprint of the public key to update. Public keys are identified by\ntheir SHA-256 fingerprint. The fingerprint of the public key is in format\n`users/{user}/sshPublicKeys/{fingerprint}`.",
946	//       "location": "path",
947	//       "pattern": "^users/[^/]+/sshPublicKeys/[^/]+$",
948	//       "required": true,
949	//       "type": "string"
950	//     }
951	//   },
952	//   "path": "v1/{+name}",
953	//   "response": {
954	//     "$ref": "Empty"
955	//   },
956	//   "scopes": [
957	//     "https://www.googleapis.com/auth/cloud-platform",
958	//     "https://www.googleapis.com/auth/compute"
959	//   ]
960	// }
961
962}
963
964// method id "oslogin.users.sshPublicKeys.get":
965
966type UsersSshPublicKeysGetCall struct {
967	s            *Service
968	name         string
969	urlParams_   gensupport.URLParams
970	ifNoneMatch_ string
971	ctx_         context.Context
972	header_      http.Header
973}
974
975// Get: Retrieves an SSH public key.
976func (r *UsersSshPublicKeysService) Get(name string) *UsersSshPublicKeysGetCall {
977	c := &UsersSshPublicKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
978	c.name = name
979	return c
980}
981
982// Fields allows partial responses to be retrieved. See
983// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
984// for more information.
985func (c *UsersSshPublicKeysGetCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysGetCall {
986	c.urlParams_.Set("fields", googleapi.CombineFields(s))
987	return c
988}
989
990// IfNoneMatch sets the optional parameter which makes the operation
991// fail if the object's ETag matches the given value. This is useful for
992// getting updates only after the object has changed since the last
993// request. Use googleapi.IsNotModified to check whether the response
994// error from Do is the result of In-None-Match.
995func (c *UsersSshPublicKeysGetCall) IfNoneMatch(entityTag string) *UsersSshPublicKeysGetCall {
996	c.ifNoneMatch_ = entityTag
997	return c
998}
999
1000// Context sets the context to be used in this call's Do method. Any
1001// pending HTTP request will be aborted if the provided context is
1002// canceled.
1003func (c *UsersSshPublicKeysGetCall) Context(ctx context.Context) *UsersSshPublicKeysGetCall {
1004	c.ctx_ = ctx
1005	return c
1006}
1007
1008// Header returns an http.Header that can be modified by the caller to
1009// add HTTP headers to the request.
1010func (c *UsersSshPublicKeysGetCall) Header() http.Header {
1011	if c.header_ == nil {
1012		c.header_ = make(http.Header)
1013	}
1014	return c.header_
1015}
1016
1017func (c *UsersSshPublicKeysGetCall) doRequest(alt string) (*http.Response, error) {
1018	reqHeaders := make(http.Header)
1019	for k, v := range c.header_ {
1020		reqHeaders[k] = v
1021	}
1022	reqHeaders.Set("User-Agent", c.s.userAgent())
1023	if c.ifNoneMatch_ != "" {
1024		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1025	}
1026	var body io.Reader = nil
1027	c.urlParams_.Set("alt", alt)
1028	c.urlParams_.Set("prettyPrint", "false")
1029	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1030	urls += "?" + c.urlParams_.Encode()
1031	req, err := http.NewRequest("GET", urls, body)
1032	if err != nil {
1033		return nil, err
1034	}
1035	req.Header = reqHeaders
1036	googleapi.Expand(req.URL, map[string]string{
1037		"name": c.name,
1038	})
1039	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1040}
1041
1042// Do executes the "oslogin.users.sshPublicKeys.get" call.
1043// Exactly one of *SshPublicKey or error will be non-nil. Any non-2xx
1044// status code is an error. Response headers are in either
1045// *SshPublicKey.ServerResponse.Header or (if a response was returned at
1046// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1047// to check whether the returned error was because
1048// http.StatusNotModified was returned.
1049func (c *UsersSshPublicKeysGetCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1050	gensupport.SetOptions(c.urlParams_, opts...)
1051	res, err := c.doRequest("json")
1052	if res != nil && res.StatusCode == http.StatusNotModified {
1053		if res.Body != nil {
1054			res.Body.Close()
1055		}
1056		return nil, &googleapi.Error{
1057			Code:   res.StatusCode,
1058			Header: res.Header,
1059		}
1060	}
1061	if err != nil {
1062		return nil, err
1063	}
1064	defer googleapi.CloseBody(res)
1065	if err := googleapi.CheckResponse(res); err != nil {
1066		return nil, err
1067	}
1068	ret := &SshPublicKey{
1069		ServerResponse: googleapi.ServerResponse{
1070			Header:         res.Header,
1071			HTTPStatusCode: res.StatusCode,
1072		},
1073	}
1074	target := &ret
1075	if err := gensupport.DecodeResponse(target, res); err != nil {
1076		return nil, err
1077	}
1078	return ret, nil
1079	// {
1080	//   "description": "Retrieves an SSH public key.",
1081	//   "flatPath": "v1/users/{usersId}/sshPublicKeys/{sshPublicKeysId}",
1082	//   "httpMethod": "GET",
1083	//   "id": "oslogin.users.sshPublicKeys.get",
1084	//   "parameterOrder": [
1085	//     "name"
1086	//   ],
1087	//   "parameters": {
1088	//     "name": {
1089	//       "description": "The fingerprint of the public key to retrieve. Public keys are identified\nby their SHA-256 fingerprint. The fingerprint of the public key is in\nformat `users/{user}/sshPublicKeys/{fingerprint}`.",
1090	//       "location": "path",
1091	//       "pattern": "^users/[^/]+/sshPublicKeys/[^/]+$",
1092	//       "required": true,
1093	//       "type": "string"
1094	//     }
1095	//   },
1096	//   "path": "v1/{+name}",
1097	//   "response": {
1098	//     "$ref": "SshPublicKey"
1099	//   },
1100	//   "scopes": [
1101	//     "https://www.googleapis.com/auth/cloud-platform",
1102	//     "https://www.googleapis.com/auth/compute"
1103	//   ]
1104	// }
1105
1106}
1107
1108// method id "oslogin.users.sshPublicKeys.patch":
1109
1110type UsersSshPublicKeysPatchCall struct {
1111	s            *Service
1112	name         string
1113	sshpublickey *SshPublicKey
1114	urlParams_   gensupport.URLParams
1115	ctx_         context.Context
1116	header_      http.Header
1117}
1118
1119// Patch: Updates an SSH public key and returns the profile information.
1120// This method
1121// supports patch semantics.
1122func (r *UsersSshPublicKeysService) Patch(name string, sshpublickey *SshPublicKey) *UsersSshPublicKeysPatchCall {
1123	c := &UsersSshPublicKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1124	c.name = name
1125	c.sshpublickey = sshpublickey
1126	return c
1127}
1128
1129// UpdateMask sets the optional parameter "updateMask": Mask to control
1130// which fields get updated. Updates all if not present.
1131func (c *UsersSshPublicKeysPatchCall) UpdateMask(updateMask string) *UsersSshPublicKeysPatchCall {
1132	c.urlParams_.Set("updateMask", updateMask)
1133	return c
1134}
1135
1136// Fields allows partial responses to be retrieved. See
1137// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1138// for more information.
1139func (c *UsersSshPublicKeysPatchCall) Fields(s ...googleapi.Field) *UsersSshPublicKeysPatchCall {
1140	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1141	return c
1142}
1143
1144// Context sets the context to be used in this call's Do method. Any
1145// pending HTTP request will be aborted if the provided context is
1146// canceled.
1147func (c *UsersSshPublicKeysPatchCall) Context(ctx context.Context) *UsersSshPublicKeysPatchCall {
1148	c.ctx_ = ctx
1149	return c
1150}
1151
1152// Header returns an http.Header that can be modified by the caller to
1153// add HTTP headers to the request.
1154func (c *UsersSshPublicKeysPatchCall) Header() http.Header {
1155	if c.header_ == nil {
1156		c.header_ = make(http.Header)
1157	}
1158	return c.header_
1159}
1160
1161func (c *UsersSshPublicKeysPatchCall) doRequest(alt string) (*http.Response, error) {
1162	reqHeaders := make(http.Header)
1163	for k, v := range c.header_ {
1164		reqHeaders[k] = v
1165	}
1166	reqHeaders.Set("User-Agent", c.s.userAgent())
1167	var body io.Reader = nil
1168	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sshpublickey)
1169	if err != nil {
1170		return nil, err
1171	}
1172	reqHeaders.Set("Content-Type", "application/json")
1173	c.urlParams_.Set("alt", alt)
1174	c.urlParams_.Set("prettyPrint", "false")
1175	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1176	urls += "?" + c.urlParams_.Encode()
1177	req, err := http.NewRequest("PATCH", urls, body)
1178	if err != nil {
1179		return nil, err
1180	}
1181	req.Header = reqHeaders
1182	googleapi.Expand(req.URL, map[string]string{
1183		"name": c.name,
1184	})
1185	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1186}
1187
1188// Do executes the "oslogin.users.sshPublicKeys.patch" call.
1189// Exactly one of *SshPublicKey or error will be non-nil. Any non-2xx
1190// status code is an error. Response headers are in either
1191// *SshPublicKey.ServerResponse.Header or (if a response was returned at
1192// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1193// to check whether the returned error was because
1194// http.StatusNotModified was returned.
1195func (c *UsersSshPublicKeysPatchCall) Do(opts ...googleapi.CallOption) (*SshPublicKey, error) {
1196	gensupport.SetOptions(c.urlParams_, opts...)
1197	res, err := c.doRequest("json")
1198	if res != nil && res.StatusCode == http.StatusNotModified {
1199		if res.Body != nil {
1200			res.Body.Close()
1201		}
1202		return nil, &googleapi.Error{
1203			Code:   res.StatusCode,
1204			Header: res.Header,
1205		}
1206	}
1207	if err != nil {
1208		return nil, err
1209	}
1210	defer googleapi.CloseBody(res)
1211	if err := googleapi.CheckResponse(res); err != nil {
1212		return nil, err
1213	}
1214	ret := &SshPublicKey{
1215		ServerResponse: googleapi.ServerResponse{
1216			Header:         res.Header,
1217			HTTPStatusCode: res.StatusCode,
1218		},
1219	}
1220	target := &ret
1221	if err := gensupport.DecodeResponse(target, res); err != nil {
1222		return nil, err
1223	}
1224	return ret, nil
1225	// {
1226	//   "description": "Updates an SSH public key and returns the profile information. This method\nsupports patch semantics.",
1227	//   "flatPath": "v1/users/{usersId}/sshPublicKeys/{sshPublicKeysId}",
1228	//   "httpMethod": "PATCH",
1229	//   "id": "oslogin.users.sshPublicKeys.patch",
1230	//   "parameterOrder": [
1231	//     "name"
1232	//   ],
1233	//   "parameters": {
1234	//     "name": {
1235	//       "description": "The fingerprint of the public key to update. Public keys are identified by\ntheir SHA-256 fingerprint. The fingerprint of the public key is in format\n`users/{user}/sshPublicKeys/{fingerprint}`.",
1236	//       "location": "path",
1237	//       "pattern": "^users/[^/]+/sshPublicKeys/[^/]+$",
1238	//       "required": true,
1239	//       "type": "string"
1240	//     },
1241	//     "updateMask": {
1242	//       "description": "Mask to control which fields get updated. Updates all if not present.",
1243	//       "format": "google-fieldmask",
1244	//       "location": "query",
1245	//       "type": "string"
1246	//     }
1247	//   },
1248	//   "path": "v1/{+name}",
1249	//   "request": {
1250	//     "$ref": "SshPublicKey"
1251	//   },
1252	//   "response": {
1253	//     "$ref": "SshPublicKey"
1254	//   },
1255	//   "scopes": [
1256	//     "https://www.googleapis.com/auth/cloud-platform",
1257	//     "https://www.googleapis.com/auth/compute"
1258	//   ]
1259	// }
1260
1261}
1262