You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1318 lines
42 KiB

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