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.
 
 
 

1183 lines
38 KiB

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