Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

7750 rader
266 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 iam provides access to the Identity and Access Management (IAM) API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/iam/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/iam/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // iamService, err := iam.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // iamService, err := iam.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // iamService, err := iam.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package iam // import "google.golang.org/api/iam/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "iam:v1"
  67. const apiName = "iam"
  68. const apiVersion = "v1"
  69. const basePath = "https://iam.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.IamPolicies = NewIamPoliciesService(s)
  106. s.Organizations = NewOrganizationsService(s)
  107. s.Permissions = NewPermissionsService(s)
  108. s.Projects = NewProjectsService(s)
  109. s.Roles = NewRolesService(s)
  110. return s, nil
  111. }
  112. type Service struct {
  113. client *http.Client
  114. BasePath string // API endpoint base URL
  115. UserAgent string // optional additional User-Agent fragment
  116. IamPolicies *IamPoliciesService
  117. Organizations *OrganizationsService
  118. Permissions *PermissionsService
  119. Projects *ProjectsService
  120. Roles *RolesService
  121. }
  122. func (s *Service) userAgent() string {
  123. if s.UserAgent == "" {
  124. return googleapi.UserAgent
  125. }
  126. return googleapi.UserAgent + " " + s.UserAgent
  127. }
  128. func NewIamPoliciesService(s *Service) *IamPoliciesService {
  129. rs := &IamPoliciesService{s: s}
  130. return rs
  131. }
  132. type IamPoliciesService struct {
  133. s *Service
  134. }
  135. func NewOrganizationsService(s *Service) *OrganizationsService {
  136. rs := &OrganizationsService{s: s}
  137. rs.Roles = NewOrganizationsRolesService(s)
  138. return rs
  139. }
  140. type OrganizationsService struct {
  141. s *Service
  142. Roles *OrganizationsRolesService
  143. }
  144. func NewOrganizationsRolesService(s *Service) *OrganizationsRolesService {
  145. rs := &OrganizationsRolesService{s: s}
  146. return rs
  147. }
  148. type OrganizationsRolesService struct {
  149. s *Service
  150. }
  151. func NewPermissionsService(s *Service) *PermissionsService {
  152. rs := &PermissionsService{s: s}
  153. return rs
  154. }
  155. type PermissionsService struct {
  156. s *Service
  157. }
  158. func NewProjectsService(s *Service) *ProjectsService {
  159. rs := &ProjectsService{s: s}
  160. rs.Roles = NewProjectsRolesService(s)
  161. rs.ServiceAccounts = NewProjectsServiceAccountsService(s)
  162. return rs
  163. }
  164. type ProjectsService struct {
  165. s *Service
  166. Roles *ProjectsRolesService
  167. ServiceAccounts *ProjectsServiceAccountsService
  168. }
  169. func NewProjectsRolesService(s *Service) *ProjectsRolesService {
  170. rs := &ProjectsRolesService{s: s}
  171. return rs
  172. }
  173. type ProjectsRolesService struct {
  174. s *Service
  175. }
  176. func NewProjectsServiceAccountsService(s *Service) *ProjectsServiceAccountsService {
  177. rs := &ProjectsServiceAccountsService{s: s}
  178. rs.Keys = NewProjectsServiceAccountsKeysService(s)
  179. return rs
  180. }
  181. type ProjectsServiceAccountsService struct {
  182. s *Service
  183. Keys *ProjectsServiceAccountsKeysService
  184. }
  185. func NewProjectsServiceAccountsKeysService(s *Service) *ProjectsServiceAccountsKeysService {
  186. rs := &ProjectsServiceAccountsKeysService{s: s}
  187. return rs
  188. }
  189. type ProjectsServiceAccountsKeysService struct {
  190. s *Service
  191. }
  192. func NewRolesService(s *Service) *RolesService {
  193. rs := &RolesService{s: s}
  194. return rs
  195. }
  196. type RolesService struct {
  197. s *Service
  198. }
  199. // AuditConfig: Specifies the audit configuration for a service.
  200. // The configuration determines which permission types are logged, and
  201. // what
  202. // identities, if any, are exempted from logging.
  203. // An AuditConfig must have one or more AuditLogConfigs.
  204. //
  205. // If there are AuditConfigs for both `allServices` and a specific
  206. // service,
  207. // the union of the two AuditConfigs is used for that service: the
  208. // log_types
  209. // specified in each AuditConfig are enabled, and the exempted_members
  210. // in each
  211. // AuditLogConfig are exempted.
  212. //
  213. // Example Policy with multiple AuditConfigs:
  214. //
  215. // {
  216. // "audit_configs": [
  217. // {
  218. // "service": "allServices"
  219. // "audit_log_configs": [
  220. // {
  221. // "log_type": "DATA_READ",
  222. // "exempted_members": [
  223. // "user:foo@gmail.com"
  224. // ]
  225. // },
  226. // {
  227. // "log_type": "DATA_WRITE",
  228. // },
  229. // {
  230. // "log_type": "ADMIN_READ",
  231. // }
  232. // ]
  233. // },
  234. // {
  235. // "service": "fooservice.googleapis.com"
  236. // "audit_log_configs": [
  237. // {
  238. // "log_type": "DATA_READ",
  239. // },
  240. // {
  241. // "log_type": "DATA_WRITE",
  242. // "exempted_members": [
  243. // "user:bar@gmail.com"
  244. // ]
  245. // }
  246. // ]
  247. // }
  248. // ]
  249. // }
  250. //
  251. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  252. // ADMIN_READ
  253. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  254. // and
  255. // bar@gmail.com from DATA_WRITE logging.
  256. type AuditConfig struct {
  257. // AuditLogConfigs: The configuration for logging of each type of
  258. // permission.
  259. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  260. // Service: Specifies a service that will be enabled for audit
  261. // logging.
  262. // For example, `storage.googleapis.com`,
  263. // `cloudsql.googleapis.com`.
  264. // `allServices` is a special value that covers all services.
  265. Service string `json:"service,omitempty"`
  266. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  267. // unconditionally include in API requests. By default, fields with
  268. // empty values are omitted from API requests. However, any non-pointer,
  269. // non-interface field appearing in ForceSendFields will be sent to the
  270. // server regardless of whether the field is empty or not. This may be
  271. // used to include empty fields in Patch requests.
  272. ForceSendFields []string `json:"-"`
  273. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  274. // include in API requests with the JSON null value. By default, fields
  275. // with empty values are omitted from API requests. However, any field
  276. // with an empty value appearing in NullFields will be sent to the
  277. // server as null. It is an error if a field in this list has a
  278. // non-empty value. This may be used to include null fields in Patch
  279. // requests.
  280. NullFields []string `json:"-"`
  281. }
  282. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  283. type NoMethod AuditConfig
  284. raw := NoMethod(*s)
  285. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  286. }
  287. // AuditData: Audit log information specific to Cloud IAM. This message
  288. // is serialized
  289. // as an `Any` type in the `ServiceData` message of an
  290. // `AuditLog` message.
  291. type AuditData struct {
  292. // PolicyDelta: Policy delta between the original policy and the newly
  293. // set policy.
  294. PolicyDelta *PolicyDelta `json:"policyDelta,omitempty"`
  295. // ForceSendFields is a list of field names (e.g. "PolicyDelta") to
  296. // unconditionally include in API requests. By default, fields with
  297. // empty values are omitted from API requests. However, any non-pointer,
  298. // non-interface field appearing in ForceSendFields will be sent to the
  299. // server regardless of whether the field is empty or not. This may be
  300. // used to include empty fields in Patch requests.
  301. ForceSendFields []string `json:"-"`
  302. // NullFields is a list of field names (e.g. "PolicyDelta") to include
  303. // in API requests with the JSON null value. By default, fields with
  304. // empty values are omitted from API requests. However, any field with
  305. // an empty value appearing in NullFields will be sent to the server as
  306. // null. It is an error if a field in this list has a non-empty value.
  307. // This may be used to include null fields in Patch requests.
  308. NullFields []string `json:"-"`
  309. }
  310. func (s *AuditData) MarshalJSON() ([]byte, error) {
  311. type NoMethod AuditData
  312. raw := NoMethod(*s)
  313. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  314. }
  315. // AuditLogConfig: Provides the configuration for logging a type of
  316. // permissions.
  317. // Example:
  318. //
  319. // {
  320. // "audit_log_configs": [
  321. // {
  322. // "log_type": "DATA_READ",
  323. // "exempted_members": [
  324. // "user:foo@gmail.com"
  325. // ]
  326. // },
  327. // {
  328. // "log_type": "DATA_WRITE",
  329. // }
  330. // ]
  331. // }
  332. //
  333. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  334. // exempting
  335. // foo@gmail.com from DATA_READ logging.
  336. type AuditLogConfig struct {
  337. // ExemptedMembers: Specifies the identities that do not cause logging
  338. // for this type of
  339. // permission.
  340. // Follows the same format of Binding.members.
  341. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  342. // LogType: The log type that this config enables.
  343. //
  344. // Possible values:
  345. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  346. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  347. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  348. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  349. LogType string `json:"logType,omitempty"`
  350. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  351. // unconditionally include in API requests. By default, fields with
  352. // empty values are omitted from API requests. However, any non-pointer,
  353. // non-interface field appearing in ForceSendFields will be sent to the
  354. // server regardless of whether the field is empty or not. This may be
  355. // used to include empty fields in Patch requests.
  356. ForceSendFields []string `json:"-"`
  357. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  358. // include in API requests with the JSON null value. By default, fields
  359. // with empty values are omitted from API requests. However, any field
  360. // with an empty value appearing in NullFields will be sent to the
  361. // server as null. It is an error if a field in this list has a
  362. // non-empty value. This may be used to include null fields in Patch
  363. // requests.
  364. NullFields []string `json:"-"`
  365. }
  366. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  367. type NoMethod AuditLogConfig
  368. raw := NoMethod(*s)
  369. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  370. }
  371. // AuditableService: Contains information about an auditable service.
  372. type AuditableService struct {
  373. // Name: Public name of the service.
  374. // For example, the service name for Cloud IAM is 'iam.googleapis.com'.
  375. Name string `json:"name,omitempty"`
  376. // ForceSendFields is a list of field names (e.g. "Name") to
  377. // unconditionally include in API requests. By default, fields with
  378. // empty values are omitted from API requests. However, any non-pointer,
  379. // non-interface field appearing in ForceSendFields will be sent to the
  380. // server regardless of whether the field is empty or not. This may be
  381. // used to include empty fields in Patch requests.
  382. ForceSendFields []string `json:"-"`
  383. // NullFields is a list of field names (e.g. "Name") to include in API
  384. // requests with the JSON null value. By default, fields with empty
  385. // values are omitted from API requests. However, any field with an
  386. // empty value appearing in NullFields will be sent to the server as
  387. // null. It is an error if a field in this list has a non-empty value.
  388. // This may be used to include null fields in Patch requests.
  389. NullFields []string `json:"-"`
  390. }
  391. func (s *AuditableService) MarshalJSON() ([]byte, error) {
  392. type NoMethod AuditableService
  393. raw := NoMethod(*s)
  394. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  395. }
  396. // Binding: Associates `members` with a `role`.
  397. type Binding struct {
  398. // Condition: Unimplemented. The condition that is associated with this
  399. // binding.
  400. // NOTE: an unsatisfied condition will not allow user access via
  401. // current
  402. // binding. Different bindings, including their conditions, are
  403. // examined
  404. // independently.
  405. Condition *Expr `json:"condition,omitempty"`
  406. // Members: Specifies the identities requesting access for a Cloud
  407. // Platform resource.
  408. // `members` can have the following values:
  409. //
  410. // * `allUsers`: A special identifier that represents anyone who is
  411. // on the internet; with or without a Google account.
  412. //
  413. // * `allAuthenticatedUsers`: A special identifier that represents
  414. // anyone
  415. // who is authenticated with a Google account or a service
  416. // account.
  417. //
  418. // * `user:{emailid}`: An email address that represents a specific
  419. // Google
  420. // account. For example, `alice@gmail.com` .
  421. //
  422. //
  423. // * `serviceAccount:{emailid}`: An email address that represents a
  424. // service
  425. // account. For example,
  426. // `my-other-app@appspot.gserviceaccount.com`.
  427. //
  428. // * `group:{emailid}`: An email address that represents a Google
  429. // group.
  430. // For example, `admins@example.com`.
  431. //
  432. //
  433. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  434. // the
  435. // users of that domain. For example, `google.com` or
  436. // `example.com`.
  437. //
  438. //
  439. Members []string `json:"members,omitempty"`
  440. // Role: Role that is assigned to `members`.
  441. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  442. Role string `json:"role,omitempty"`
  443. // ForceSendFields is a list of field names (e.g. "Condition") to
  444. // unconditionally include in API requests. By default, fields with
  445. // empty values are omitted from API requests. However, any non-pointer,
  446. // non-interface field appearing in ForceSendFields will be sent to the
  447. // server regardless of whether the field is empty or not. This may be
  448. // used to include empty fields in Patch requests.
  449. ForceSendFields []string `json:"-"`
  450. // NullFields is a list of field names (e.g. "Condition") to include in
  451. // API requests with the JSON null value. By default, fields with empty
  452. // values are omitted from API requests. However, any field with an
  453. // empty value appearing in NullFields will be sent to the server as
  454. // null. It is an error if a field in this list has a non-empty value.
  455. // This may be used to include null fields in Patch requests.
  456. NullFields []string `json:"-"`
  457. }
  458. func (s *Binding) MarshalJSON() ([]byte, error) {
  459. type NoMethod Binding
  460. raw := NoMethod(*s)
  461. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  462. }
  463. // BindingDelta: One delta entry for Binding. Each individual change
  464. // (only one member in each
  465. // entry) to a binding will be a separate entry.
  466. type BindingDelta struct {
  467. // Action: The action that was performed on a Binding.
  468. // Required
  469. //
  470. // Possible values:
  471. // "ACTION_UNSPECIFIED" - Unspecified.
  472. // "ADD" - Addition of a Binding.
  473. // "REMOVE" - Removal of a Binding.
  474. Action string `json:"action,omitempty"`
  475. // Condition: Unimplemented. The condition that is associated with this
  476. // binding.
  477. // This field is logged only for Cloud Audit Logging.
  478. Condition *Expr `json:"condition,omitempty"`
  479. // Member: A single identity requesting access for a Cloud Platform
  480. // resource.
  481. // Follows the same format of Binding.members.
  482. // Required
  483. Member string `json:"member,omitempty"`
  484. // Role: Role that is assigned to `members`.
  485. // For example, `roles/viewer`, `roles/editor`, or
  486. // `roles/owner`.
  487. // Required
  488. Role string `json:"role,omitempty"`
  489. // ForceSendFields is a list of field names (e.g. "Action") to
  490. // unconditionally include in API requests. By default, fields with
  491. // empty values are omitted from API requests. However, any non-pointer,
  492. // non-interface field appearing in ForceSendFields will be sent to the
  493. // server regardless of whether the field is empty or not. This may be
  494. // used to include empty fields in Patch requests.
  495. ForceSendFields []string `json:"-"`
  496. // NullFields is a list of field names (e.g. "Action") to include in API
  497. // requests with the JSON null value. By default, fields with empty
  498. // values are omitted from API requests. However, any field with an
  499. // empty value appearing in NullFields will be sent to the server as
  500. // null. It is an error if a field in this list has a non-empty value.
  501. // This may be used to include null fields in Patch requests.
  502. NullFields []string `json:"-"`
  503. }
  504. func (s *BindingDelta) MarshalJSON() ([]byte, error) {
  505. type NoMethod BindingDelta
  506. raw := NoMethod(*s)
  507. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  508. }
  509. // CreateRoleRequest: The request to create a new role.
  510. type CreateRoleRequest struct {
  511. // Role: The Role resource to create.
  512. Role *Role `json:"role,omitempty"`
  513. // RoleId: The role id to use for this role.
  514. RoleId string `json:"roleId,omitempty"`
  515. // ForceSendFields is a list of field names (e.g. "Role") to
  516. // unconditionally include in API requests. By default, fields with
  517. // empty values are omitted from API requests. However, any non-pointer,
  518. // non-interface field appearing in ForceSendFields will be sent to the
  519. // server regardless of whether the field is empty or not. This may be
  520. // used to include empty fields in Patch requests.
  521. ForceSendFields []string `json:"-"`
  522. // NullFields is a list of field names (e.g. "Role") to include in API
  523. // requests with the JSON null value. By default, fields with empty
  524. // values are omitted from API requests. However, any field with an
  525. // empty value appearing in NullFields will be sent to the server as
  526. // null. It is an error if a field in this list has a non-empty value.
  527. // This may be used to include null fields in Patch requests.
  528. NullFields []string `json:"-"`
  529. }
  530. func (s *CreateRoleRequest) MarshalJSON() ([]byte, error) {
  531. type NoMethod CreateRoleRequest
  532. raw := NoMethod(*s)
  533. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  534. }
  535. // CreateServiceAccountKeyRequest: The service account key create
  536. // request.
  537. type CreateServiceAccountKeyRequest struct {
  538. // KeyAlgorithm: Which type of key and algorithm to use for the key.
  539. // The default is currently a 2K RSA key. However this may change in
  540. // the
  541. // future.
  542. //
  543. // Possible values:
  544. // "KEY_ALG_UNSPECIFIED" - An unspecified key algorithm.
  545. // "KEY_ALG_RSA_1024" - 1k RSA Key.
  546. // "KEY_ALG_RSA_2048" - 2k RSA Key.
  547. KeyAlgorithm string `json:"keyAlgorithm,omitempty"`
  548. // PrivateKeyType: The output format of the private key. The default
  549. // value is
  550. // `TYPE_GOOGLE_CREDENTIALS_FILE`, which is the Google Credentials
  551. // File
  552. // format.
  553. //
  554. // Possible values:
  555. // "TYPE_UNSPECIFIED" - Unspecified. Equivalent to
  556. // `TYPE_GOOGLE_CREDENTIALS_FILE`.
  557. // "TYPE_PKCS12_FILE" - PKCS12 format.
  558. // The password for the PKCS12 file is `notasecret`.
  559. // For more information, see https://tools.ietf.org/html/rfc7292.
  560. // "TYPE_GOOGLE_CREDENTIALS_FILE" - Google Credentials File format.
  561. PrivateKeyType string `json:"privateKeyType,omitempty"`
  562. // ForceSendFields is a list of field names (e.g. "KeyAlgorithm") to
  563. // unconditionally include in API requests. By default, fields with
  564. // empty values are omitted from API requests. However, any non-pointer,
  565. // non-interface field appearing in ForceSendFields will be sent to the
  566. // server regardless of whether the field is empty or not. This may be
  567. // used to include empty fields in Patch requests.
  568. ForceSendFields []string `json:"-"`
  569. // NullFields is a list of field names (e.g. "KeyAlgorithm") to include
  570. // in API requests with the JSON null value. By default, fields with
  571. // empty values are omitted from API requests. However, any field with
  572. // an empty value appearing in NullFields will be sent to the server as
  573. // null. It is an error if a field in this list has a non-empty value.
  574. // This may be used to include null fields in Patch requests.
  575. NullFields []string `json:"-"`
  576. }
  577. func (s *CreateServiceAccountKeyRequest) MarshalJSON() ([]byte, error) {
  578. type NoMethod CreateServiceAccountKeyRequest
  579. raw := NoMethod(*s)
  580. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  581. }
  582. // CreateServiceAccountRequest: The service account create request.
  583. type CreateServiceAccountRequest struct {
  584. // AccountId: Required. The account id that is used to generate the
  585. // service account
  586. // email address and a stable unique id. It is unique within a
  587. // project,
  588. // must be 6-30 characters long, and match the regular
  589. // expression
  590. // `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
  591. AccountId string `json:"accountId,omitempty"`
  592. // ServiceAccount: The ServiceAccount resource to
  593. // create. Currently, only the following values are user
  594. // assignable:
  595. // `display_name` .
  596. ServiceAccount *ServiceAccount `json:"serviceAccount,omitempty"`
  597. // ForceSendFields is a list of field names (e.g. "AccountId") to
  598. // unconditionally include in API requests. By default, fields with
  599. // empty values are omitted from API requests. However, any non-pointer,
  600. // non-interface field appearing in ForceSendFields will be sent to the
  601. // server regardless of whether the field is empty or not. This may be
  602. // used to include empty fields in Patch requests.
  603. ForceSendFields []string `json:"-"`
  604. // NullFields is a list of field names (e.g. "AccountId") to include in
  605. // API requests with the JSON null value. By default, fields with empty
  606. // values are omitted from API requests. However, any field with an
  607. // empty value appearing in NullFields will be sent to the server as
  608. // null. It is an error if a field in this list has a non-empty value.
  609. // This may be used to include null fields in Patch requests.
  610. NullFields []string `json:"-"`
  611. }
  612. func (s *CreateServiceAccountRequest) MarshalJSON() ([]byte, error) {
  613. type NoMethod CreateServiceAccountRequest
  614. raw := NoMethod(*s)
  615. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  616. }
  617. // DisableServiceAccountRequest: The service account disable request.
  618. type DisableServiceAccountRequest struct {
  619. }
  620. // Empty: A generic empty message that you can re-use to avoid defining
  621. // duplicated
  622. // empty messages in your APIs. A typical example is to use it as the
  623. // request
  624. // or the response type of an API method. For instance:
  625. //
  626. // service Foo {
  627. // rpc Bar(google.protobuf.Empty) returns
  628. // (google.protobuf.Empty);
  629. // }
  630. //
  631. // The JSON representation for `Empty` is empty JSON object `{}`.
  632. type Empty struct {
  633. // ServerResponse contains the HTTP response code and headers from the
  634. // server.
  635. googleapi.ServerResponse `json:"-"`
  636. }
  637. // EnableServiceAccountRequest: The service account enable request.
  638. type EnableServiceAccountRequest struct {
  639. }
  640. // Expr: Represents an expression text. Example:
  641. //
  642. // title: "User account presence"
  643. // description: "Determines whether the request has a user account"
  644. // expression: "size(request.user) > 0"
  645. type Expr struct {
  646. // Description: An optional description of the expression. This is a
  647. // longer text which
  648. // describes the expression, e.g. when hovered over it in a UI.
  649. Description string `json:"description,omitempty"`
  650. // Expression: Textual representation of an expression in
  651. // Common Expression Language syntax.
  652. //
  653. // The application context of the containing message determines
  654. // which
  655. // well-known feature set of CEL is supported.
  656. Expression string `json:"expression,omitempty"`
  657. // Location: An optional string indicating the location of the
  658. // expression for error
  659. // reporting, e.g. a file name and a position in the file.
  660. Location string `json:"location,omitempty"`
  661. // Title: An optional title for the expression, i.e. a short string
  662. // describing
  663. // its purpose. This can be used e.g. in UIs which allow to enter
  664. // the
  665. // expression.
  666. Title string `json:"title,omitempty"`
  667. // ForceSendFields is a list of field names (e.g. "Description") to
  668. // unconditionally include in API requests. By default, fields with
  669. // empty values are omitted from API requests. However, any non-pointer,
  670. // non-interface field appearing in ForceSendFields will be sent to the
  671. // server regardless of whether the field is empty or not. This may be
  672. // used to include empty fields in Patch requests.
  673. ForceSendFields []string `json:"-"`
  674. // NullFields is a list of field names (e.g. "Description") to include
  675. // in API requests with the JSON null value. By default, fields with
  676. // empty values are omitted from API requests. However, any field with
  677. // an empty value appearing in NullFields will be sent to the server as
  678. // null. It is an error if a field in this list has a non-empty value.
  679. // This may be used to include null fields in Patch requests.
  680. NullFields []string `json:"-"`
  681. }
  682. func (s *Expr) MarshalJSON() ([]byte, error) {
  683. type NoMethod Expr
  684. raw := NoMethod(*s)
  685. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  686. }
  687. // LintPolicyRequest: The request to lint a Cloud IAM policy object.
  688. // LintPolicy is currently
  689. // functional only for `lint_object` of type `condition`.
  690. type LintPolicyRequest struct {
  691. // Binding: Binding object to be linted. The functionality of linting a
  692. // binding is
  693. // not yet implemented and if this field is set, it returns
  694. // NOT_IMPLEMENTED
  695. // error.
  696. Binding *Binding `json:"binding,omitempty"`
  697. // Condition: google.iam.v1.Binding.condition object to be linted.
  698. Condition *Expr `json:"condition,omitempty"`
  699. // Context: `context` contains additional *permission-controlled* data
  700. // that any
  701. // lint unit may depend on, in form of `{key: value}` pairs. Currently,
  702. // this
  703. // field is non-operational and it will not be used during the lint
  704. // operation.
  705. Context googleapi.RawMessage `json:"context,omitempty"`
  706. // FullResourceName: The full resource name of the policy this lint
  707. // request is about.
  708. //
  709. // The name follows the Google Cloud Platform (GCP) resource format.
  710. // For example, a GCP project with ID `my-project` will be
  711. // named
  712. // `//cloudresourcemanager.googleapis.com/projects/my-project`.
  713. //
  714. // Th
  715. // e resource name is not used to read the policy instance from the
  716. // Cloud
  717. // IAM database. The candidate policy for lint has to be provided in the
  718. // same
  719. // request object.
  720. FullResourceName string `json:"fullResourceName,omitempty"`
  721. // Policy: Policy object to be linted. The functionality of linting a
  722. // policy is not
  723. // yet implemented and if this field is set, it returns
  724. // NOT_IMPLEMENTED
  725. // error.
  726. Policy *Policy `json:"policy,omitempty"`
  727. // ForceSendFields is a list of field names (e.g. "Binding") to
  728. // unconditionally include in API requests. By default, fields with
  729. // empty values are omitted from API requests. However, any non-pointer,
  730. // non-interface field appearing in ForceSendFields will be sent to the
  731. // server regardless of whether the field is empty or not. This may be
  732. // used to include empty fields in Patch requests.
  733. ForceSendFields []string `json:"-"`
  734. // NullFields is a list of field names (e.g. "Binding") to include in
  735. // API requests with the JSON null value. By default, fields with empty
  736. // values are omitted from API requests. However, any field with an
  737. // empty value appearing in NullFields will be sent to the server as
  738. // null. It is an error if a field in this list has a non-empty value.
  739. // This may be used to include null fields in Patch requests.
  740. NullFields []string `json:"-"`
  741. }
  742. func (s *LintPolicyRequest) MarshalJSON() ([]byte, error) {
  743. type NoMethod LintPolicyRequest
  744. raw := NoMethod(*s)
  745. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  746. }
  747. // LintPolicyResponse: The response of a lint operation. An empty
  748. // response indicates
  749. // the operation was able to fully execute and no lint issue was found.
  750. type LintPolicyResponse struct {
  751. // LintResults: List of lint results sorted by a composite <severity,
  752. // binding_ordinal> key,
  753. // descending order of severity and ascending order of
  754. // binding_ordinal.
  755. // There is no certain order among the same keys.
  756. //
  757. // For cross-binding results (only if the input object to lint
  758. // is
  759. // instance of google.iam.v1.Policy), there will be
  760. // a
  761. // google.iam.admin.v1.LintResult for each of the involved bindings,
  762. // and the associated debug_message may enumerate the other
  763. // involved
  764. // binding ordinal number(s).
  765. LintResults []*LintResult `json:"lintResults,omitempty"`
  766. // ServerResponse contains the HTTP response code and headers from the
  767. // server.
  768. googleapi.ServerResponse `json:"-"`
  769. // ForceSendFields is a list of field names (e.g. "LintResults") to
  770. // unconditionally include in API requests. By default, fields with
  771. // empty values are omitted from API requests. However, any non-pointer,
  772. // non-interface field appearing in ForceSendFields will be sent to the
  773. // server regardless of whether the field is empty or not. This may be
  774. // used to include empty fields in Patch requests.
  775. ForceSendFields []string `json:"-"`
  776. // NullFields is a list of field names (e.g. "LintResults") to include
  777. // in API requests with the JSON null value. By default, fields with
  778. // empty values are omitted from API requests. However, any field with
  779. // an empty value appearing in NullFields will be sent to the server as
  780. // null. It is an error if a field in this list has a non-empty value.
  781. // This may be used to include null fields in Patch requests.
  782. NullFields []string `json:"-"`
  783. }
  784. func (s *LintPolicyResponse) MarshalJSON() ([]byte, error) {
  785. type NoMethod LintPolicyResponse
  786. raw := NoMethod(*s)
  787. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  788. }
  789. // LintResult: Structured response of a single validation unit.
  790. type LintResult struct {
  791. // BindingOrdinal: 0-based index ordinality of the binding in the input
  792. // object associated
  793. // with this result.
  794. // This field is populated only if the input object to lint is of
  795. // type
  796. // google.iam.v1.Policy, which can comprise more than one binding.
  797. // It is set to -1 if the result is not associated with any
  798. // particular
  799. // binding and only targets the policy as a whole, such as results
  800. // about
  801. // policy size violations.
  802. BindingOrdinal int64 `json:"bindingOrdinal,omitempty"`
  803. // DebugMessage: Human readable debug message associated with the issue.
  804. DebugMessage string `json:"debugMessage,omitempty"`
  805. // FieldName: The name of the field for which this lint result is
  806. // about.
  807. //
  808. // For nested messages, `field_name` consists of names of the embedded
  809. // fields
  810. // separated by period character. The top-level qualifier is the input
  811. // object
  812. // to lint in the request. For instance, if the lint request is on
  813. // a
  814. // google.iam.v1.Policy and this lint result is about a
  815. // condition
  816. // expression of one of the input policy bindings, the field would
  817. // be
  818. // populated as `policy.bindings.condition.expression`.
  819. //
  820. // This field does not identify the ordinality of the repetitive fields
  821. // (for
  822. // instance bindings in a policy).
  823. FieldName string `json:"fieldName,omitempty"`
  824. // Level: The validation unit level.
  825. //
  826. // Possible values:
  827. // "LEVEL_UNSPECIFIED" - Level is unspecified.
  828. // "POLICY" - A validation unit which operates on a policy. It is
  829. // executed only if the
  830. // input object to lint is of type google.iam.v1.Policy.
  831. // "BINDING" - A validation unit which operates on an individual
  832. // binding. It is executed
  833. // in both cases where the input object to lint is of
  834. // type
  835. // google.iam.v1.Policy or google.iam.v1.Binding.
  836. // "CONDITION" - A validation unit which operates on an individual
  837. // condition within a
  838. // binding. It is executed in all three cases where the input object
  839. // to
  840. // lint is of type google.iam.v1.Policy,
  841. // google.iam.v1.Binding or
  842. // google.iam.v1.Binding.condition.
  843. Level string `json:"level,omitempty"`
  844. // LocationOffset: 0-based character position of problematic construct
  845. // within the object
  846. // identified by `field_name`. Currently, this is populated only for
  847. // condition
  848. // expression.
  849. LocationOffset int64 `json:"locationOffset,omitempty"`
  850. // Severity: The validation unit severity.
  851. //
  852. // Possible values:
  853. // "SEVERITY_UNSPECIFIED" - Severity is unspecified.
  854. // "ERROR" - A validation unit returns an error only for critical
  855. // issues. If an
  856. // attempt is made to set the problematic policy without rectifying
  857. // the
  858. // critical issue, it causes the `setPolicy` operation to fail.
  859. // "WARNING" - Any issue which is severe enough but does not cause an
  860. // error.
  861. // For example, suspicious constructs in the input object will
  862. // not
  863. // necessarily fail `setPolicy`, but there is a high likelihood that
  864. // they
  865. // won't behave as expected during policy evaluation in
  866. // `checkPolicy`.
  867. // This includes the following common scenarios:
  868. //
  869. // - Unsatisfiable condition: Expired timestamp in date/time
  870. // condition.
  871. // - Ineffective condition: Condition on a <member, role> pair which is
  872. // granted unconditionally in another binding of the same policy.
  873. // "NOTICE" - Reserved for the issues that are not severe as
  874. // `ERROR`/`WARNING`, but
  875. // need special handling. For instance, messages about skipped
  876. // validation
  877. // units are issued as `NOTICE`.
  878. // "INFO" - Any informative statement which is not severe enough to
  879. // raise
  880. // `ERROR`/`WARNING`/`NOTICE`, like auto-correction recommendations on
  881. // the
  882. // input content. Note that current version of the linter does not
  883. // utilize
  884. // `INFO`.
  885. // "DEPRECATED" - Deprecated severity level.
  886. Severity string `json:"severity,omitempty"`
  887. // ValidationUnitName: The validation unit name, for
  888. // instance
  889. // “lintValidationUnits/ConditionComplexityCheck”.
  890. ValidationUnitName string `json:"validationUnitName,omitempty"`
  891. // ForceSendFields is a list of field names (e.g. "BindingOrdinal") to
  892. // unconditionally include in API requests. By default, fields with
  893. // empty values are omitted from API requests. However, any non-pointer,
  894. // non-interface field appearing in ForceSendFields will be sent to the
  895. // server regardless of whether the field is empty or not. This may be
  896. // used to include empty fields in Patch requests.
  897. ForceSendFields []string `json:"-"`
  898. // NullFields is a list of field names (e.g. "BindingOrdinal") to
  899. // include in API requests with the JSON null value. By default, fields
  900. // with empty values are omitted from API requests. However, any field
  901. // with an empty value appearing in NullFields will be sent to the
  902. // server as null. It is an error if a field in this list has a
  903. // non-empty value. This may be used to include null fields in Patch
  904. // requests.
  905. NullFields []string `json:"-"`
  906. }
  907. func (s *LintResult) MarshalJSON() ([]byte, error) {
  908. type NoMethod LintResult
  909. raw := NoMethod(*s)
  910. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  911. }
  912. // ListRolesResponse: The response containing the roles defined under a
  913. // resource.
  914. type ListRolesResponse struct {
  915. // NextPageToken: To retrieve the next page of results,
  916. // set
  917. // `ListRolesRequest.page_token` to this value.
  918. NextPageToken string `json:"nextPageToken,omitempty"`
  919. // Roles: The Roles defined on this resource.
  920. Roles []*Role `json:"roles,omitempty"`
  921. // ServerResponse contains the HTTP response code and headers from the
  922. // server.
  923. googleapi.ServerResponse `json:"-"`
  924. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  925. // unconditionally include in API requests. By default, fields with
  926. // empty values are omitted from API requests. However, any non-pointer,
  927. // non-interface field appearing in ForceSendFields will be sent to the
  928. // server regardless of whether the field is empty or not. This may be
  929. // used to include empty fields in Patch requests.
  930. ForceSendFields []string `json:"-"`
  931. // NullFields is a list of field names (e.g. "NextPageToken") to include
  932. // in API requests with the JSON null value. By default, fields with
  933. // empty values are omitted from API requests. However, any field with
  934. // an empty value appearing in NullFields will be sent to the server as
  935. // null. It is an error if a field in this list has a non-empty value.
  936. // This may be used to include null fields in Patch requests.
  937. NullFields []string `json:"-"`
  938. }
  939. func (s *ListRolesResponse) MarshalJSON() ([]byte, error) {
  940. type NoMethod ListRolesResponse
  941. raw := NoMethod(*s)
  942. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  943. }
  944. // ListServiceAccountKeysResponse: The service account keys list
  945. // response.
  946. type ListServiceAccountKeysResponse struct {
  947. // Keys: The public keys for the service account.
  948. Keys []*ServiceAccountKey `json:"keys,omitempty"`
  949. // ServerResponse contains the HTTP response code and headers from the
  950. // server.
  951. googleapi.ServerResponse `json:"-"`
  952. // ForceSendFields is a list of field names (e.g. "Keys") to
  953. // unconditionally include in API requests. By default, fields with
  954. // empty values are omitted from API requests. However, any non-pointer,
  955. // non-interface field appearing in ForceSendFields will be sent to the
  956. // server regardless of whether the field is empty or not. This may be
  957. // used to include empty fields in Patch requests.
  958. ForceSendFields []string `json:"-"`
  959. // NullFields is a list of field names (e.g. "Keys") to include in API
  960. // requests with the JSON null value. By default, fields with empty
  961. // values are omitted from API requests. However, any field with an
  962. // empty value appearing in NullFields will be sent to the server as
  963. // null. It is an error if a field in this list has a non-empty value.
  964. // This may be used to include null fields in Patch requests.
  965. NullFields []string `json:"-"`
  966. }
  967. func (s *ListServiceAccountKeysResponse) MarshalJSON() ([]byte, error) {
  968. type NoMethod ListServiceAccountKeysResponse
  969. raw := NoMethod(*s)
  970. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  971. }
  972. // ListServiceAccountsResponse: The service account list response.
  973. type ListServiceAccountsResponse struct {
  974. // Accounts: The list of matching service accounts.
  975. Accounts []*ServiceAccount `json:"accounts,omitempty"`
  976. // NextPageToken: To retrieve the next page of results,
  977. // set
  978. // ListServiceAccountsRequest.page_token
  979. // to this value.
  980. NextPageToken string `json:"nextPageToken,omitempty"`
  981. // ServerResponse contains the HTTP response code and headers from the
  982. // server.
  983. googleapi.ServerResponse `json:"-"`
  984. // ForceSendFields is a list of field names (e.g. "Accounts") to
  985. // unconditionally include in API requests. By default, fields with
  986. // empty values are omitted from API requests. However, any non-pointer,
  987. // non-interface field appearing in ForceSendFields will be sent to the
  988. // server regardless of whether the field is empty or not. This may be
  989. // used to include empty fields in Patch requests.
  990. ForceSendFields []string `json:"-"`
  991. // NullFields is a list of field names (e.g. "Accounts") to include in
  992. // API requests with the JSON null value. By default, fields with empty
  993. // values are omitted from API requests. However, any field with an
  994. // empty value appearing in NullFields will be sent to the server as
  995. // null. It is an error if a field in this list has a non-empty value.
  996. // This may be used to include null fields in Patch requests.
  997. NullFields []string `json:"-"`
  998. }
  999. func (s *ListServiceAccountsResponse) MarshalJSON() ([]byte, error) {
  1000. type NoMethod ListServiceAccountsResponse
  1001. raw := NoMethod(*s)
  1002. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1003. }
  1004. // PatchServiceAccountRequest: The patch service account request.
  1005. type PatchServiceAccountRequest struct {
  1006. ServiceAccount *ServiceAccount `json:"serviceAccount,omitempty"`
  1007. UpdateMask string `json:"updateMask,omitempty"`
  1008. // ForceSendFields is a list of field names (e.g. "ServiceAccount") to
  1009. // unconditionally include in API requests. By default, fields with
  1010. // empty values are omitted from API requests. However, any non-pointer,
  1011. // non-interface field appearing in ForceSendFields will be sent to the
  1012. // server regardless of whether the field is empty or not. This may be
  1013. // used to include empty fields in Patch requests.
  1014. ForceSendFields []string `json:"-"`
  1015. // NullFields is a list of field names (e.g. "ServiceAccount") to
  1016. // include in API requests with the JSON null value. By default, fields
  1017. // with empty values are omitted from API requests. However, any field
  1018. // with an empty value appearing in NullFields will be sent to the
  1019. // server as null. It is an error if a field in this list has a
  1020. // non-empty value. This may be used to include null fields in Patch
  1021. // requests.
  1022. NullFields []string `json:"-"`
  1023. }
  1024. func (s *PatchServiceAccountRequest) MarshalJSON() ([]byte, error) {
  1025. type NoMethod PatchServiceAccountRequest
  1026. raw := NoMethod(*s)
  1027. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1028. }
  1029. // Permission: A permission which can be included by a role.
  1030. type Permission struct {
  1031. // ApiDisabled: The service API associated with the permission is not
  1032. // enabled.
  1033. ApiDisabled bool `json:"apiDisabled,omitempty"`
  1034. // CustomRolesSupportLevel: The current custom role support level.
  1035. //
  1036. // Possible values:
  1037. // "SUPPORTED" - Permission is fully supported for custom role use.
  1038. // "TESTING" - Permission is being tested to check custom role
  1039. // compatibility.
  1040. // "NOT_SUPPORTED" - Permission is not supported for custom role use.
  1041. CustomRolesSupportLevel string `json:"customRolesSupportLevel,omitempty"`
  1042. // Description: A brief description of what this Permission is used for.
  1043. Description string `json:"description,omitempty"`
  1044. // Name: The name of this Permission.
  1045. Name string `json:"name,omitempty"`
  1046. // OnlyInPredefinedRoles: This permission can ONLY be used in predefined
  1047. // roles.
  1048. OnlyInPredefinedRoles bool `json:"onlyInPredefinedRoles,omitempty"`
  1049. // Stage: The current launch stage of the permission.
  1050. //
  1051. // Possible values:
  1052. // "ALPHA" - The permission is currently in an alpha phase.
  1053. // "BETA" - The permission is currently in a beta phase.
  1054. // "GA" - The permission is generally available.
  1055. // "DEPRECATED" - The permission is being deprecated.
  1056. Stage string `json:"stage,omitempty"`
  1057. // Title: The title of this Permission.
  1058. Title string `json:"title,omitempty"`
  1059. // ForceSendFields is a list of field names (e.g. "ApiDisabled") to
  1060. // unconditionally include in API requests. By default, fields with
  1061. // empty values are omitted from API requests. However, any non-pointer,
  1062. // non-interface field appearing in ForceSendFields will be sent to the
  1063. // server regardless of whether the field is empty or not. This may be
  1064. // used to include empty fields in Patch requests.
  1065. ForceSendFields []string `json:"-"`
  1066. // NullFields is a list of field names (e.g. "ApiDisabled") to include
  1067. // in API requests with the JSON null value. By default, fields with
  1068. // empty values are omitted from API requests. However, any field with
  1069. // an empty value appearing in NullFields will be sent to the server as
  1070. // null. It is an error if a field in this list has a non-empty value.
  1071. // This may be used to include null fields in Patch requests.
  1072. NullFields []string `json:"-"`
  1073. }
  1074. func (s *Permission) MarshalJSON() ([]byte, error) {
  1075. type NoMethod Permission
  1076. raw := NoMethod(*s)
  1077. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1078. }
  1079. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  1080. // used to
  1081. // specify access control policies for Cloud Platform resources.
  1082. //
  1083. //
  1084. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  1085. // of
  1086. // `members` to a `role`, where the members can be user accounts, Google
  1087. // groups,
  1088. // Google domains, and service accounts. A `role` is a named list of
  1089. // permissions
  1090. // defined by IAM.
  1091. //
  1092. // **JSON Example**
  1093. //
  1094. // {
  1095. // "bindings": [
  1096. // {
  1097. // "role": "roles/owner",
  1098. // "members": [
  1099. // "user:mike@example.com",
  1100. // "group:admins@example.com",
  1101. // "domain:google.com",
  1102. //
  1103. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  1104. // ]
  1105. // },
  1106. // {
  1107. // "role": "roles/viewer",
  1108. // "members": ["user:sean@example.com"]
  1109. // }
  1110. // ]
  1111. // }
  1112. //
  1113. // **YAML Example**
  1114. //
  1115. // bindings:
  1116. // - members:
  1117. // - user:mike@example.com
  1118. // - group:admins@example.com
  1119. // - domain:google.com
  1120. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  1121. // role: roles/owner
  1122. // - members:
  1123. // - user:sean@example.com
  1124. // role: roles/viewer
  1125. //
  1126. //
  1127. // For a description of IAM and its features, see the
  1128. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  1129. type Policy struct {
  1130. // AuditConfigs: Specifies cloud audit logging configuration for this
  1131. // policy.
  1132. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  1133. // Bindings: Associates a list of `members` to a `role`.
  1134. // `bindings` with no members will result in an error.
  1135. Bindings []*Binding `json:"bindings,omitempty"`
  1136. // Etag: `etag` is used for optimistic concurrency control as a way to
  1137. // help
  1138. // prevent simultaneous updates of a policy from overwriting each
  1139. // other.
  1140. // It is strongly suggested that systems make use of the `etag` in
  1141. // the
  1142. // read-modify-write cycle to perform policy updates in order to avoid
  1143. // race
  1144. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  1145. // and
  1146. // systems are expected to put that etag in the request to
  1147. // `setIamPolicy` to
  1148. // ensure that their change will be applied to the same version of the
  1149. // policy.
  1150. //
  1151. // If no `etag` is provided in the call to `setIamPolicy`, then the
  1152. // existing
  1153. // policy is overwritten blindly.
  1154. Etag string `json:"etag,omitempty"`
  1155. // Version: Deprecated.
  1156. Version int64 `json:"version,omitempty"`
  1157. // ServerResponse contains the HTTP response code and headers from the
  1158. // server.
  1159. googleapi.ServerResponse `json:"-"`
  1160. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  1161. // unconditionally include in API requests. By default, fields with
  1162. // empty values are omitted from API requests. However, any non-pointer,
  1163. // non-interface field appearing in ForceSendFields will be sent to the
  1164. // server regardless of whether the field is empty or not. This may be
  1165. // used to include empty fields in Patch requests.
  1166. ForceSendFields []string `json:"-"`
  1167. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  1168. // in API requests with the JSON null value. By default, fields with
  1169. // empty values are omitted from API requests. However, any field with
  1170. // an empty value appearing in NullFields will be sent to the server as
  1171. // null. It is an error if a field in this list has a non-empty value.
  1172. // This may be used to include null fields in Patch requests.
  1173. NullFields []string `json:"-"`
  1174. }
  1175. func (s *Policy) MarshalJSON() ([]byte, error) {
  1176. type NoMethod Policy
  1177. raw := NoMethod(*s)
  1178. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1179. }
  1180. // PolicyDelta: The difference delta between two policies.
  1181. type PolicyDelta struct {
  1182. // BindingDeltas: The delta for Bindings between two policies.
  1183. BindingDeltas []*BindingDelta `json:"bindingDeltas,omitempty"`
  1184. // ForceSendFields is a list of field names (e.g. "BindingDeltas") to
  1185. // unconditionally include in API requests. By default, fields with
  1186. // empty values are omitted from API requests. However, any non-pointer,
  1187. // non-interface field appearing in ForceSendFields will be sent to the
  1188. // server regardless of whether the field is empty or not. This may be
  1189. // used to include empty fields in Patch requests.
  1190. ForceSendFields []string `json:"-"`
  1191. // NullFields is a list of field names (e.g. "BindingDeltas") to include
  1192. // in API requests with the JSON null value. By default, fields with
  1193. // empty values are omitted from API requests. However, any field with
  1194. // an empty value appearing in NullFields will be sent to the server as
  1195. // null. It is an error if a field in this list has a non-empty value.
  1196. // This may be used to include null fields in Patch requests.
  1197. NullFields []string `json:"-"`
  1198. }
  1199. func (s *PolicyDelta) MarshalJSON() ([]byte, error) {
  1200. type NoMethod PolicyDelta
  1201. raw := NoMethod(*s)
  1202. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1203. }
  1204. // QueryAuditableServicesRequest: A request to get the list of auditable
  1205. // services for a resource.
  1206. type QueryAuditableServicesRequest struct {
  1207. // FullResourceName: Required. The full resource name to query from the
  1208. // list of auditable
  1209. // services.
  1210. //
  1211. // The name follows the Google Cloud Platform resource format.
  1212. // For example, a Cloud Platform project with id `my-project` will be
  1213. // named
  1214. // `//cloudresourcemanager.googleapis.com/projects/my-project`.
  1215. FullResourceName string `json:"fullResourceName,omitempty"`
  1216. // ForceSendFields is a list of field names (e.g. "FullResourceName") to
  1217. // unconditionally include in API requests. By default, fields with
  1218. // empty values are omitted from API requests. However, any non-pointer,
  1219. // non-interface field appearing in ForceSendFields will be sent to the
  1220. // server regardless of whether the field is empty or not. This may be
  1221. // used to include empty fields in Patch requests.
  1222. ForceSendFields []string `json:"-"`
  1223. // NullFields is a list of field names (e.g. "FullResourceName") to
  1224. // include in API requests with the JSON null value. By default, fields
  1225. // with empty values are omitted from API requests. However, any field
  1226. // with an empty value appearing in NullFields will be sent to the
  1227. // server as null. It is an error if a field in this list has a
  1228. // non-empty value. This may be used to include null fields in Patch
  1229. // requests.
  1230. NullFields []string `json:"-"`
  1231. }
  1232. func (s *QueryAuditableServicesRequest) MarshalJSON() ([]byte, error) {
  1233. type NoMethod QueryAuditableServicesRequest
  1234. raw := NoMethod(*s)
  1235. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1236. }
  1237. // QueryAuditableServicesResponse: A response containing a list of
  1238. // auditable services for a resource.
  1239. type QueryAuditableServicesResponse struct {
  1240. // Services: The auditable services for a resource.
  1241. Services []*AuditableService `json:"services,omitempty"`
  1242. // ServerResponse contains the HTTP response code and headers from the
  1243. // server.
  1244. googleapi.ServerResponse `json:"-"`
  1245. // ForceSendFields is a list of field names (e.g. "Services") to
  1246. // unconditionally include in API requests. By default, fields with
  1247. // empty values are omitted from API requests. However, any non-pointer,
  1248. // non-interface field appearing in ForceSendFields will be sent to the
  1249. // server regardless of whether the field is empty or not. This may be
  1250. // used to include empty fields in Patch requests.
  1251. ForceSendFields []string `json:"-"`
  1252. // NullFields is a list of field names (e.g. "Services") to include in
  1253. // API requests with the JSON null value. By default, fields with empty
  1254. // values are omitted from API requests. However, any field with an
  1255. // empty value appearing in NullFields will be sent to the server as
  1256. // null. It is an error if a field in this list has a non-empty value.
  1257. // This may be used to include null fields in Patch requests.
  1258. NullFields []string `json:"-"`
  1259. }
  1260. func (s *QueryAuditableServicesResponse) MarshalJSON() ([]byte, error) {
  1261. type NoMethod QueryAuditableServicesResponse
  1262. raw := NoMethod(*s)
  1263. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1264. }
  1265. // QueryGrantableRolesRequest: The grantable role query request.
  1266. type QueryGrantableRolesRequest struct {
  1267. // FullResourceName: Required. The full resource name to query from the
  1268. // list of grantable roles.
  1269. //
  1270. // The name follows the Google Cloud Platform resource format.
  1271. // For example, a Cloud Platform project with id `my-project` will be
  1272. // named
  1273. // `//cloudresourcemanager.googleapis.com/projects/my-project`.
  1274. FullResourceName string `json:"fullResourceName,omitempty"`
  1275. // PageSize: Optional limit on the number of roles to include in the
  1276. // response.
  1277. PageSize int64 `json:"pageSize,omitempty"`
  1278. // PageToken: Optional pagination token returned in an
  1279. // earlier
  1280. // QueryGrantableRolesResponse.
  1281. PageToken string `json:"pageToken,omitempty"`
  1282. // Possible values:
  1283. // "BASIC" - Omits the `included_permissions` field.
  1284. // This is the default value.
  1285. // "FULL" - Returns all fields.
  1286. View string `json:"view,omitempty"`
  1287. // ForceSendFields is a list of field names (e.g. "FullResourceName") to
  1288. // unconditionally include in API requests. By default, fields with
  1289. // empty values are omitted from API requests. However, any non-pointer,
  1290. // non-interface field appearing in ForceSendFields will be sent to the
  1291. // server regardless of whether the field is empty or not. This may be
  1292. // used to include empty fields in Patch requests.
  1293. ForceSendFields []string `json:"-"`
  1294. // NullFields is a list of field names (e.g. "FullResourceName") to
  1295. // include in API requests with the JSON null value. By default, fields
  1296. // with empty values are omitted from API requests. However, any field
  1297. // with an empty value appearing in NullFields will be sent to the
  1298. // server as null. It is an error if a field in this list has a
  1299. // non-empty value. This may be used to include null fields in Patch
  1300. // requests.
  1301. NullFields []string `json:"-"`
  1302. }
  1303. func (s *QueryGrantableRolesRequest) MarshalJSON() ([]byte, error) {
  1304. type NoMethod QueryGrantableRolesRequest
  1305. raw := NoMethod(*s)
  1306. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1307. }
  1308. // QueryGrantableRolesResponse: The grantable role query response.
  1309. type QueryGrantableRolesResponse struct {
  1310. // NextPageToken: To retrieve the next page of results,
  1311. // set
  1312. // `QueryGrantableRolesRequest.page_token` to this value.
  1313. NextPageToken string `json:"nextPageToken,omitempty"`
  1314. // Roles: The list of matching roles.
  1315. Roles []*Role `json:"roles,omitempty"`
  1316. // ServerResponse contains the HTTP response code and headers from the
  1317. // server.
  1318. googleapi.ServerResponse `json:"-"`
  1319. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1320. // unconditionally include in API requests. By default, fields with
  1321. // empty values are omitted from API requests. However, any non-pointer,
  1322. // non-interface field appearing in ForceSendFields will be sent to the
  1323. // server regardless of whether the field is empty or not. This may be
  1324. // used to include empty fields in Patch requests.
  1325. ForceSendFields []string `json:"-"`
  1326. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1327. // in API requests with the JSON null value. By default, fields with
  1328. // empty values are omitted from API requests. However, any field with
  1329. // an empty value appearing in NullFields will be sent to the server as
  1330. // null. It is an error if a field in this list has a non-empty value.
  1331. // This may be used to include null fields in Patch requests.
  1332. NullFields []string `json:"-"`
  1333. }
  1334. func (s *QueryGrantableRolesResponse) MarshalJSON() ([]byte, error) {
  1335. type NoMethod QueryGrantableRolesResponse
  1336. raw := NoMethod(*s)
  1337. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1338. }
  1339. // QueryTestablePermissionsRequest: A request to get permissions which
  1340. // can be tested on a resource.
  1341. type QueryTestablePermissionsRequest struct {
  1342. // FullResourceName: Required. The full resource name to query from the
  1343. // list of testable
  1344. // permissions.
  1345. //
  1346. // The name follows the Google Cloud Platform resource format.
  1347. // For example, a Cloud Platform project with id `my-project` will be
  1348. // named
  1349. // `//cloudresourcemanager.googleapis.com/projects/my-project`.
  1350. FullResourceName string `json:"fullResourceName,omitempty"`
  1351. // PageSize: Optional limit on the number of permissions to include in
  1352. // the response.
  1353. PageSize int64 `json:"pageSize,omitempty"`
  1354. // PageToken: Optional pagination token returned in an
  1355. // earlier
  1356. // QueryTestablePermissionsRequest.
  1357. PageToken string `json:"pageToken,omitempty"`
  1358. // ForceSendFields is a list of field names (e.g. "FullResourceName") to
  1359. // unconditionally include in API requests. By default, fields with
  1360. // empty values are omitted from API requests. However, any non-pointer,
  1361. // non-interface field appearing in ForceSendFields will be sent to the
  1362. // server regardless of whether the field is empty or not. This may be
  1363. // used to include empty fields in Patch requests.
  1364. ForceSendFields []string `json:"-"`
  1365. // NullFields is a list of field names (e.g. "FullResourceName") to
  1366. // include in API requests with the JSON null value. By default, fields
  1367. // with empty values are omitted from API requests. However, any field
  1368. // with an empty value appearing in NullFields will be sent to the
  1369. // server as null. It is an error if a field in this list has a
  1370. // non-empty value. This may be used to include null fields in Patch
  1371. // requests.
  1372. NullFields []string `json:"-"`
  1373. }
  1374. func (s *QueryTestablePermissionsRequest) MarshalJSON() ([]byte, error) {
  1375. type NoMethod QueryTestablePermissionsRequest
  1376. raw := NoMethod(*s)
  1377. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1378. }
  1379. // QueryTestablePermissionsResponse: The response containing permissions
  1380. // which can be tested on a resource.
  1381. type QueryTestablePermissionsResponse struct {
  1382. // NextPageToken: To retrieve the next page of results,
  1383. // set
  1384. // `QueryTestableRolesRequest.page_token` to this value.
  1385. NextPageToken string `json:"nextPageToken,omitempty"`
  1386. // Permissions: The Permissions testable on the requested resource.
  1387. Permissions []*Permission `json:"permissions,omitempty"`
  1388. // ServerResponse contains the HTTP response code and headers from the
  1389. // server.
  1390. googleapi.ServerResponse `json:"-"`
  1391. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1392. // unconditionally include in API requests. By default, fields with
  1393. // empty values are omitted from API requests. However, any non-pointer,
  1394. // non-interface field appearing in ForceSendFields will be sent to the
  1395. // server regardless of whether the field is empty or not. This may be
  1396. // used to include empty fields in Patch requests.
  1397. ForceSendFields []string `json:"-"`
  1398. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1399. // in API requests with the JSON null value. By default, fields with
  1400. // empty values are omitted from API requests. However, any field with
  1401. // an empty value appearing in NullFields will be sent to the server as
  1402. // null. It is an error if a field in this list has a non-empty value.
  1403. // This may be used to include null fields in Patch requests.
  1404. NullFields []string `json:"-"`
  1405. }
  1406. func (s *QueryTestablePermissionsResponse) MarshalJSON() ([]byte, error) {
  1407. type NoMethod QueryTestablePermissionsResponse
  1408. raw := NoMethod(*s)
  1409. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1410. }
  1411. // Role: A role in the Identity and Access Management API.
  1412. type Role struct {
  1413. // Deleted: The current deleted state of the role. This field is read
  1414. // only.
  1415. // It will be ignored in calls to CreateRole and UpdateRole.
  1416. Deleted bool `json:"deleted,omitempty"`
  1417. // Description: Optional. A human-readable description for the role.
  1418. Description string `json:"description,omitempty"`
  1419. // Etag: Used to perform a consistent read-modify-write.
  1420. Etag string `json:"etag,omitempty"`
  1421. // IncludedPermissions: The names of the permissions this role grants
  1422. // when bound in an IAM policy.
  1423. IncludedPermissions []string `json:"includedPermissions,omitempty"`
  1424. // Name: The name of the role.
  1425. //
  1426. // When Role is used in CreateRole, the role name must not be set.
  1427. //
  1428. // When Role is used in output and other input such as UpdateRole, the
  1429. // role
  1430. // name is the complete path, e.g., roles/logging.viewer for curated
  1431. // roles
  1432. // and organizations/{ORGANIZATION_ID}/roles/logging.viewer for custom
  1433. // roles.
  1434. Name string `json:"name,omitempty"`
  1435. // Stage: The current launch stage of the role. If the `ALPHA` launch
  1436. // stage has been
  1437. // selected for a role, the `stage` field will not be included in
  1438. // the
  1439. // returned definition for the role.
  1440. //
  1441. // Possible values:
  1442. // "ALPHA" - The user has indicated this role is currently in an Alpha
  1443. // phase. If this
  1444. // launch stage is selected, the `stage` field will not be included
  1445. // when
  1446. // requesting the definition for a given role.
  1447. // "BETA" - The user has indicated this role is currently in a Beta
  1448. // phase.
  1449. // "GA" - The user has indicated this role is generally available.
  1450. // "DEPRECATED" - The user has indicated this role is being
  1451. // deprecated.
  1452. // "DISABLED" - This role is disabled and will not contribute
  1453. // permissions to any members
  1454. // it is granted to in policies.
  1455. // "EAP" - The user has indicated this role is currently in an EAP
  1456. // phase.
  1457. Stage string `json:"stage,omitempty"`
  1458. // Title: Optional. A human-readable title for the role. Typically
  1459. // this
  1460. // is limited to 100 UTF-8 bytes.
  1461. Title string `json:"title,omitempty"`
  1462. // ServerResponse contains the HTTP response code and headers from the
  1463. // server.
  1464. googleapi.ServerResponse `json:"-"`
  1465. // ForceSendFields is a list of field names (e.g. "Deleted") to
  1466. // unconditionally include in API requests. By default, fields with
  1467. // empty values are omitted from API requests. However, any non-pointer,
  1468. // non-interface field appearing in ForceSendFields will be sent to the
  1469. // server regardless of whether the field is empty or not. This may be
  1470. // used to include empty fields in Patch requests.
  1471. ForceSendFields []string `json:"-"`
  1472. // NullFields is a list of field names (e.g. "Deleted") to include in
  1473. // API requests with the JSON null value. By default, fields with empty
  1474. // values are omitted from API requests. However, any field with an
  1475. // empty value appearing in NullFields will be sent to the server as
  1476. // null. It is an error if a field in this list has a non-empty value.
  1477. // This may be used to include null fields in Patch requests.
  1478. NullFields []string `json:"-"`
  1479. }
  1480. func (s *Role) MarshalJSON() ([]byte, error) {
  1481. type NoMethod Role
  1482. raw := NoMethod(*s)
  1483. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1484. }
  1485. // ServiceAccount: A service account in the Identity and Access
  1486. // Management API.
  1487. //
  1488. // To create a service account, specify the `project_id` and the
  1489. // `account_id`
  1490. // for the account. The `account_id` is unique within the project, and
  1491. // is used
  1492. // to generate the service account email address and a
  1493. // stable
  1494. // `unique_id`.
  1495. //
  1496. // If the account already exists, the account's resource name is
  1497. // returned
  1498. // in the format of projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. The
  1499. // caller
  1500. // can use the name in other methods to access the account.
  1501. //
  1502. // All other methods can identify the service account using the
  1503. // format
  1504. // `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
  1505. // Using `-` as a wildcard for the `PROJECT_ID` will infer the project
  1506. // from
  1507. // the account. The `ACCOUNT` value can be the `email` address or
  1508. // the
  1509. // `unique_id` of the service account.
  1510. type ServiceAccount struct {
  1511. // Description: Optional. A user-specified opaque description of the
  1512. // service account.
  1513. // Must be less than or equal to 256 UTF-8 bytes.
  1514. Description string `json:"description,omitempty"`
  1515. // Disabled: @OutputOnly A bool indicate if the service account is
  1516. // disabled.
  1517. // The field is currently in alpha phase.
  1518. Disabled bool `json:"disabled,omitempty"`
  1519. // DisplayName: Optional. A user-specified name for the service
  1520. // account.
  1521. // Must be less than or equal to 100 UTF-8 bytes.
  1522. DisplayName string `json:"displayName,omitempty"`
  1523. // Email: @OutputOnly The email address of the service account.
  1524. Email string `json:"email,omitempty"`
  1525. // Etag: Optional. Note: `etag` is an inoperable legacy field that is
  1526. // only returned
  1527. // for backwards compatibility.
  1528. Etag string `json:"etag,omitempty"`
  1529. // Name: The resource name of the service account in the following
  1530. // format:
  1531. // `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
  1532. //
  1533. // Requests using `-` as a wildcard for the `PROJECT_ID` will infer
  1534. // the
  1535. // project from the `account` and the `ACCOUNT` value can be the
  1536. // `email`
  1537. // address or the `unique_id` of the service account.
  1538. //
  1539. // In responses the resource name will always be in the
  1540. // format
  1541. // `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
  1542. Name string `json:"name,omitempty"`
  1543. // Oauth2ClientId: @OutputOnly The OAuth2 client id for the service
  1544. // account.
  1545. // This is used in conjunction with the OAuth2 clientconfig API to
  1546. // make
  1547. // three legged OAuth2 (3LO) flows to access the data of Google users.
  1548. Oauth2ClientId string `json:"oauth2ClientId,omitempty"`
  1549. // ProjectId: @OutputOnly The id of the project that owns the service
  1550. // account.
  1551. ProjectId string `json:"projectId,omitempty"`
  1552. // UniqueId: @OutputOnly The unique and stable id of the service
  1553. // account.
  1554. UniqueId string `json:"uniqueId,omitempty"`
  1555. // ServerResponse contains the HTTP response code and headers from the
  1556. // server.
  1557. googleapi.ServerResponse `json:"-"`
  1558. // ForceSendFields is a list of field names (e.g. "Description") to
  1559. // unconditionally include in API requests. By default, fields with
  1560. // empty values are omitted from API requests. However, any non-pointer,
  1561. // non-interface field appearing in ForceSendFields will be sent to the
  1562. // server regardless of whether the field is empty or not. This may be
  1563. // used to include empty fields in Patch requests.
  1564. ForceSendFields []string `json:"-"`
  1565. // NullFields is a list of field names (e.g. "Description") to include
  1566. // in API requests with the JSON null value. By default, fields with
  1567. // empty values are omitted from API requests. However, any field with
  1568. // an empty value appearing in NullFields will be sent to the server as
  1569. // null. It is an error if a field in this list has a non-empty value.
  1570. // This may be used to include null fields in Patch requests.
  1571. NullFields []string `json:"-"`
  1572. }
  1573. func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
  1574. type NoMethod ServiceAccount
  1575. raw := NoMethod(*s)
  1576. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1577. }
  1578. // ServiceAccountKey: Represents a service account key.
  1579. //
  1580. // A service account has two sets of key-pairs: user-managed,
  1581. // and
  1582. // system-managed.
  1583. //
  1584. // User-managed key-pairs can be created and deleted by users. Users
  1585. // are
  1586. // responsible for rotating these keys periodically to ensure security
  1587. // of
  1588. // their service accounts. Users retain the private key of these
  1589. // key-pairs,
  1590. // and Google retains ONLY the public key.
  1591. //
  1592. // System-managed keys are automatically rotated by Google, and are used
  1593. // for
  1594. // signing for a maximum of two weeks. The rotation process is
  1595. // probabilistic,
  1596. // and usage of the new key will gradually ramp up and down over the
  1597. // key's
  1598. // lifetime. We recommend caching the public key set for a service
  1599. // account for
  1600. // no more than 24 hours to ensure you have access to the latest
  1601. // keys.
  1602. //
  1603. // Public keys for all service accounts are also published at the
  1604. // OAuth2
  1605. // Service Account API.
  1606. type ServiceAccountKey struct {
  1607. // KeyAlgorithm: Specifies the algorithm (and possibly key size) for the
  1608. // key.
  1609. //
  1610. // Possible values:
  1611. // "KEY_ALG_UNSPECIFIED" - An unspecified key algorithm.
  1612. // "KEY_ALG_RSA_1024" - 1k RSA Key.
  1613. // "KEY_ALG_RSA_2048" - 2k RSA Key.
  1614. KeyAlgorithm string `json:"keyAlgorithm,omitempty"`
  1615. // Name: The resource name of the service account key in the following
  1616. // format
  1617. // `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
  1618. Name string `json:"name,omitempty"`
  1619. // PrivateKeyData: The private key data. Only provided in
  1620. // `CreateServiceAccountKey`
  1621. // responses. Make sure to keep the private key data secure because
  1622. // it
  1623. // allows for the assertion of the service account identity.
  1624. // When base64 decoded, the private key data can be used to authenticate
  1625. // with
  1626. // Google API client libraries and with
  1627. // <a
  1628. // href="/sdk/gcloud/reference/auth/activate-service-account">gcloud
  1629. // auth
  1630. // activate-service-account</a>.
  1631. PrivateKeyData string `json:"privateKeyData,omitempty"`
  1632. // PrivateKeyType: The output format for the private key.
  1633. // Only provided in `CreateServiceAccountKey` responses, not
  1634. // in `GetServiceAccountKey` or `ListServiceAccountKey`
  1635. // responses.
  1636. //
  1637. // Google never exposes system-managed private keys, and never
  1638. // retains
  1639. // user-managed private keys.
  1640. //
  1641. // Possible values:
  1642. // "TYPE_UNSPECIFIED" - Unspecified. Equivalent to
  1643. // `TYPE_GOOGLE_CREDENTIALS_FILE`.
  1644. // "TYPE_PKCS12_FILE" - PKCS12 format.
  1645. // The password for the PKCS12 file is `notasecret`.
  1646. // For more information, see https://tools.ietf.org/html/rfc7292.
  1647. // "TYPE_GOOGLE_CREDENTIALS_FILE" - Google Credentials File format.
  1648. PrivateKeyType string `json:"privateKeyType,omitempty"`
  1649. // PublicKeyData: The public key data. Only provided in
  1650. // `GetServiceAccountKey` responses.
  1651. PublicKeyData string `json:"publicKeyData,omitempty"`
  1652. // ValidAfterTime: The key can be used after this timestamp.
  1653. ValidAfterTime string `json:"validAfterTime,omitempty"`
  1654. // ValidBeforeTime: The key can be used before this timestamp.
  1655. ValidBeforeTime string `json:"validBeforeTime,omitempty"`
  1656. // ServerResponse contains the HTTP response code and headers from the
  1657. // server.
  1658. googleapi.ServerResponse `json:"-"`
  1659. // ForceSendFields is a list of field names (e.g. "KeyAlgorithm") to
  1660. // unconditionally include in API requests. By default, fields with
  1661. // empty values are omitted from API requests. However, any non-pointer,
  1662. // non-interface field appearing in ForceSendFields will be sent to the
  1663. // server regardless of whether the field is empty or not. This may be
  1664. // used to include empty fields in Patch requests.
  1665. ForceSendFields []string `json:"-"`
  1666. // NullFields is a list of field names (e.g. "KeyAlgorithm") to include
  1667. // in API requests with the JSON null value. By default, fields with
  1668. // empty values are omitted from API requests. However, any field with
  1669. // an empty value appearing in NullFields will be sent to the server as
  1670. // null. It is an error if a field in this list has a non-empty value.
  1671. // This may be used to include null fields in Patch requests.
  1672. NullFields []string `json:"-"`
  1673. }
  1674. func (s *ServiceAccountKey) MarshalJSON() ([]byte, error) {
  1675. type NoMethod ServiceAccountKey
  1676. raw := NoMethod(*s)
  1677. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1678. }
  1679. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1680. type SetIamPolicyRequest struct {
  1681. // Policy: REQUIRED: The complete policy to be applied to the
  1682. // `resource`. The size of
  1683. // the policy is limited to a few 10s of KB. An empty policy is a
  1684. // valid policy but certain Cloud Platform services (such as
  1685. // Projects)
  1686. // might reject them.
  1687. Policy *Policy `json:"policy,omitempty"`
  1688. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  1689. // policy to modify. Only
  1690. // the fields in the mask will be modified. If no mask is provided,
  1691. // the
  1692. // following default mask is used:
  1693. // paths: "bindings, etag"
  1694. // This field is only used by Cloud IAM.
  1695. UpdateMask string `json:"updateMask,omitempty"`
  1696. // ForceSendFields is a list of field names (e.g. "Policy") to
  1697. // unconditionally include in API requests. By default, fields with
  1698. // empty values are omitted from API requests. However, any non-pointer,
  1699. // non-interface field appearing in ForceSendFields will be sent to the
  1700. // server regardless of whether the field is empty or not. This may be
  1701. // used to include empty fields in Patch requests.
  1702. ForceSendFields []string `json:"-"`
  1703. // NullFields is a list of field names (e.g. "Policy") to include in API
  1704. // requests with the JSON null value. By default, fields with empty
  1705. // values are omitted from API requests. However, any field with an
  1706. // empty value appearing in NullFields will be sent to the server as
  1707. // null. It is an error if a field in this list has a non-empty value.
  1708. // This may be used to include null fields in Patch requests.
  1709. NullFields []string `json:"-"`
  1710. }
  1711. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1712. type NoMethod SetIamPolicyRequest
  1713. raw := NoMethod(*s)
  1714. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1715. }
  1716. // SignBlobRequest: The service account sign blob request.
  1717. type SignBlobRequest struct {
  1718. // BytesToSign: The bytes to sign.
  1719. BytesToSign string `json:"bytesToSign,omitempty"`
  1720. // ForceSendFields is a list of field names (e.g. "BytesToSign") to
  1721. // unconditionally include in API requests. By default, fields with
  1722. // empty values are omitted from API requests. However, any non-pointer,
  1723. // non-interface field appearing in ForceSendFields will be sent to the
  1724. // server regardless of whether the field is empty or not. This may be
  1725. // used to include empty fields in Patch requests.
  1726. ForceSendFields []string `json:"-"`
  1727. // NullFields is a list of field names (e.g. "BytesToSign") to include
  1728. // in API requests with the JSON null value. By default, fields with
  1729. // empty values are omitted from API requests. However, any field with
  1730. // an empty value appearing in NullFields will be sent to the server as
  1731. // null. It is an error if a field in this list has a non-empty value.
  1732. // This may be used to include null fields in Patch requests.
  1733. NullFields []string `json:"-"`
  1734. }
  1735. func (s *SignBlobRequest) MarshalJSON() ([]byte, error) {
  1736. type NoMethod SignBlobRequest
  1737. raw := NoMethod(*s)
  1738. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1739. }
  1740. // SignBlobResponse: The service account sign blob response.
  1741. type SignBlobResponse struct {
  1742. // KeyId: The id of the key used to sign the blob.
  1743. KeyId string `json:"keyId,omitempty"`
  1744. // Signature: The signed blob.
  1745. Signature string `json:"signature,omitempty"`
  1746. // ServerResponse contains the HTTP response code and headers from the
  1747. // server.
  1748. googleapi.ServerResponse `json:"-"`
  1749. // ForceSendFields is a list of field names (e.g. "KeyId") to
  1750. // unconditionally include in API requests. By default, fields with
  1751. // empty values are omitted from API requests. However, any non-pointer,
  1752. // non-interface field appearing in ForceSendFields will be sent to the
  1753. // server regardless of whether the field is empty or not. This may be
  1754. // used to include empty fields in Patch requests.
  1755. ForceSendFields []string `json:"-"`
  1756. // NullFields is a list of field names (e.g. "KeyId") to include in API
  1757. // requests with the JSON null value. By default, fields with empty
  1758. // values are omitted from API requests. However, any field with an
  1759. // empty value appearing in NullFields will be sent to the server as
  1760. // null. It is an error if a field in this list has a non-empty value.
  1761. // This may be used to include null fields in Patch requests.
  1762. NullFields []string `json:"-"`
  1763. }
  1764. func (s *SignBlobResponse) MarshalJSON() ([]byte, error) {
  1765. type NoMethod SignBlobResponse
  1766. raw := NoMethod(*s)
  1767. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1768. }
  1769. // SignJwtRequest: The service account sign JWT request.
  1770. type SignJwtRequest struct {
  1771. // Payload: The JWT payload to sign, a JSON JWT Claim set.
  1772. Payload string `json:"payload,omitempty"`
  1773. // ForceSendFields is a list of field names (e.g. "Payload") to
  1774. // unconditionally include in API requests. By default, fields with
  1775. // empty values are omitted from API requests. However, any non-pointer,
  1776. // non-interface field appearing in ForceSendFields will be sent to the
  1777. // server regardless of whether the field is empty or not. This may be
  1778. // used to include empty fields in Patch requests.
  1779. ForceSendFields []string `json:"-"`
  1780. // NullFields is a list of field names (e.g. "Payload") to include in
  1781. // API requests with the JSON null value. By default, fields with empty
  1782. // values are omitted from API requests. However, any field with an
  1783. // empty value appearing in NullFields will be sent to the server as
  1784. // null. It is an error if a field in this list has a non-empty value.
  1785. // This may be used to include null fields in Patch requests.
  1786. NullFields []string `json:"-"`
  1787. }
  1788. func (s *SignJwtRequest) MarshalJSON() ([]byte, error) {
  1789. type NoMethod SignJwtRequest
  1790. raw := NoMethod(*s)
  1791. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1792. }
  1793. // SignJwtResponse: The service account sign JWT response.
  1794. type SignJwtResponse struct {
  1795. // KeyId: The id of the key used to sign the JWT.
  1796. KeyId string `json:"keyId,omitempty"`
  1797. // SignedJwt: The signed JWT.
  1798. SignedJwt string `json:"signedJwt,omitempty"`
  1799. // ServerResponse contains the HTTP response code and headers from the
  1800. // server.
  1801. googleapi.ServerResponse `json:"-"`
  1802. // ForceSendFields is a list of field names (e.g. "KeyId") to
  1803. // unconditionally include in API requests. By default, fields with
  1804. // empty values are omitted from API requests. However, any non-pointer,
  1805. // non-interface field appearing in ForceSendFields will be sent to the
  1806. // server regardless of whether the field is empty or not. This may be
  1807. // used to include empty fields in Patch requests.
  1808. ForceSendFields []string `json:"-"`
  1809. // NullFields is a list of field names (e.g. "KeyId") to include in API
  1810. // requests with the JSON null value. By default, fields with empty
  1811. // values are omitted from API requests. However, any field with an
  1812. // empty value appearing in NullFields will be sent to the server as
  1813. // null. It is an error if a field in this list has a non-empty value.
  1814. // This may be used to include null fields in Patch requests.
  1815. NullFields []string `json:"-"`
  1816. }
  1817. func (s *SignJwtResponse) MarshalJSON() ([]byte, error) {
  1818. type NoMethod SignJwtResponse
  1819. raw := NoMethod(*s)
  1820. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1821. }
  1822. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  1823. // method.
  1824. type TestIamPermissionsRequest struct {
  1825. // Permissions: The set of permissions to check for the `resource`.
  1826. // Permissions with
  1827. // wildcards (such as '*' or 'storage.*') are not allowed. For
  1828. // more
  1829. // information see
  1830. // [IAM
  1831. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  1832. Permissions []string `json:"permissions,omitempty"`
  1833. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1834. // unconditionally include in API requests. By default, fields with
  1835. // empty values are omitted from API requests. However, any non-pointer,
  1836. // non-interface field appearing in ForceSendFields will be sent to the
  1837. // server regardless of whether the field is empty or not. This may be
  1838. // used to include empty fields in Patch requests.
  1839. ForceSendFields []string `json:"-"`
  1840. // NullFields is a list of field names (e.g. "Permissions") to include
  1841. // in API requests with the JSON null value. By default, fields with
  1842. // empty values are omitted from API requests. However, any field with
  1843. // an empty value appearing in NullFields will be sent to the server as
  1844. // null. It is an error if a field in this list has a non-empty value.
  1845. // This may be used to include null fields in Patch requests.
  1846. NullFields []string `json:"-"`
  1847. }
  1848. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  1849. type NoMethod TestIamPermissionsRequest
  1850. raw := NoMethod(*s)
  1851. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1852. }
  1853. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1854. // method.
  1855. type TestIamPermissionsResponse struct {
  1856. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1857. // the caller is
  1858. // allowed.
  1859. Permissions []string `json:"permissions,omitempty"`
  1860. // ServerResponse contains the HTTP response code and headers from the
  1861. // server.
  1862. googleapi.ServerResponse `json:"-"`
  1863. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1864. // unconditionally include in API requests. By default, fields with
  1865. // empty values are omitted from API requests. However, any non-pointer,
  1866. // non-interface field appearing in ForceSendFields will be sent to the
  1867. // server regardless of whether the field is empty or not. This may be
  1868. // used to include empty fields in Patch requests.
  1869. ForceSendFields []string `json:"-"`
  1870. // NullFields is a list of field names (e.g. "Permissions") to include
  1871. // in API requests with the JSON null value. By default, fields with
  1872. // empty values are omitted from API requests. However, any field with
  1873. // an empty value appearing in NullFields will be sent to the server as
  1874. // null. It is an error if a field in this list has a non-empty value.
  1875. // This may be used to include null fields in Patch requests.
  1876. NullFields []string `json:"-"`
  1877. }
  1878. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1879. type NoMethod TestIamPermissionsResponse
  1880. raw := NoMethod(*s)
  1881. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1882. }
  1883. // UndeleteRoleRequest: The request to undelete an existing role.
  1884. type UndeleteRoleRequest struct {
  1885. // Etag: Used to perform a consistent read-modify-write.
  1886. Etag string `json:"etag,omitempty"`
  1887. // ForceSendFields is a list of field names (e.g. "Etag") to
  1888. // unconditionally include in API requests. By default, fields with
  1889. // empty values are omitted from API requests. However, any non-pointer,
  1890. // non-interface field appearing in ForceSendFields will be sent to the
  1891. // server regardless of whether the field is empty or not. This may be
  1892. // used to include empty fields in Patch requests.
  1893. ForceSendFields []string `json:"-"`
  1894. // NullFields is a list of field names (e.g. "Etag") to include in API
  1895. // requests with the JSON null value. By default, fields with empty
  1896. // values are omitted from API requests. However, any field with an
  1897. // empty value appearing in NullFields will be sent to the server as
  1898. // null. It is an error if a field in this list has a non-empty value.
  1899. // This may be used to include null fields in Patch requests.
  1900. NullFields []string `json:"-"`
  1901. }
  1902. func (s *UndeleteRoleRequest) MarshalJSON() ([]byte, error) {
  1903. type NoMethod UndeleteRoleRequest
  1904. raw := NoMethod(*s)
  1905. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1906. }
  1907. // UndeleteServiceAccountRequest: The service account undelete request.
  1908. type UndeleteServiceAccountRequest struct {
  1909. }
  1910. type UndeleteServiceAccountResponse struct {
  1911. // RestoredAccount: Metadata for the restored service account.
  1912. RestoredAccount *ServiceAccount `json:"restoredAccount,omitempty"`
  1913. // ServerResponse contains the HTTP response code and headers from the
  1914. // server.
  1915. googleapi.ServerResponse `json:"-"`
  1916. // ForceSendFields is a list of field names (e.g. "RestoredAccount") to
  1917. // unconditionally include in API requests. By default, fields with
  1918. // empty values are omitted from API requests. However, any non-pointer,
  1919. // non-interface field appearing in ForceSendFields will be sent to the
  1920. // server regardless of whether the field is empty or not. This may be
  1921. // used to include empty fields in Patch requests.
  1922. ForceSendFields []string `json:"-"`
  1923. // NullFields is a list of field names (e.g. "RestoredAccount") to
  1924. // include in API requests with the JSON null value. By default, fields
  1925. // with empty values are omitted from API requests. However, any field
  1926. // with an empty value appearing in NullFields will be sent to the
  1927. // server as null. It is an error if a field in this list has a
  1928. // non-empty value. This may be used to include null fields in Patch
  1929. // requests.
  1930. NullFields []string `json:"-"`
  1931. }
  1932. func (s *UndeleteServiceAccountResponse) MarshalJSON() ([]byte, error) {
  1933. type NoMethod UndeleteServiceAccountResponse
  1934. raw := NoMethod(*s)
  1935. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1936. }
  1937. // method id "iam.iamPolicies.lintPolicy":
  1938. type IamPoliciesLintPolicyCall struct {
  1939. s *Service
  1940. lintpolicyrequest *LintPolicyRequest
  1941. urlParams_ gensupport.URLParams
  1942. ctx_ context.Context
  1943. header_ http.Header
  1944. }
  1945. // LintPolicy: Lints a Cloud IAM policy object or its sub fields.
  1946. // Currently supports
  1947. // google.iam.v1.Policy, google.iam.v1.Binding
  1948. // and
  1949. // google.iam.v1.Binding.condition.
  1950. //
  1951. // Each lint operation consists of multiple lint validation
  1952. // units.
  1953. // Validation units have the following properties:
  1954. //
  1955. // - Each unit inspects the input object in regard to a particular
  1956. // linting aspect and issues a google.iam.admin.v1.LintResult
  1957. // disclosing the result.
  1958. // - Domain of discourse of each unit can be either
  1959. // google.iam.v1.Policy, google.iam.v1.Binding, or
  1960. // google.iam.v1.Binding.condition depending on the purpose of the
  1961. // validation.
  1962. // - A unit may require additional data (like the list of all possible
  1963. // enumerable values of a particular attribute used in the policy
  1964. // instance)
  1965. // which shall be provided by the caller. Refer to the comments of
  1966. // google.iam.admin.v1.LintPolicyRequest.context for more
  1967. // details.
  1968. //
  1969. // The set of applicable validation units is determined by the Cloud
  1970. // IAM
  1971. // server and is not configurable.
  1972. //
  1973. // Regardless of any lint issues or their severities, successful calls
  1974. // to
  1975. // `lintPolicy` return an HTTP 200 OK status code.
  1976. func (r *IamPoliciesService) LintPolicy(lintpolicyrequest *LintPolicyRequest) *IamPoliciesLintPolicyCall {
  1977. c := &IamPoliciesLintPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1978. c.lintpolicyrequest = lintpolicyrequest
  1979. return c
  1980. }
  1981. // Fields allows partial responses to be retrieved. See
  1982. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1983. // for more information.
  1984. func (c *IamPoliciesLintPolicyCall) Fields(s ...googleapi.Field) *IamPoliciesLintPolicyCall {
  1985. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1986. return c
  1987. }
  1988. // Context sets the context to be used in this call's Do method. Any
  1989. // pending HTTP request will be aborted if the provided context is
  1990. // canceled.
  1991. func (c *IamPoliciesLintPolicyCall) Context(ctx context.Context) *IamPoliciesLintPolicyCall {
  1992. c.ctx_ = ctx
  1993. return c
  1994. }
  1995. // Header returns an http.Header that can be modified by the caller to
  1996. // add HTTP headers to the request.
  1997. func (c *IamPoliciesLintPolicyCall) Header() http.Header {
  1998. if c.header_ == nil {
  1999. c.header_ = make(http.Header)
  2000. }
  2001. return c.header_
  2002. }
  2003. func (c *IamPoliciesLintPolicyCall) doRequest(alt string) (*http.Response, error) {
  2004. reqHeaders := make(http.Header)
  2005. for k, v := range c.header_ {
  2006. reqHeaders[k] = v
  2007. }
  2008. reqHeaders.Set("User-Agent", c.s.userAgent())
  2009. var body io.Reader = nil
  2010. body, err := googleapi.WithoutDataWrapper.JSONReader(c.lintpolicyrequest)
  2011. if err != nil {
  2012. return nil, err
  2013. }
  2014. reqHeaders.Set("Content-Type", "application/json")
  2015. c.urlParams_.Set("alt", alt)
  2016. c.urlParams_.Set("prettyPrint", "false")
  2017. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/iamPolicies:lintPolicy")
  2018. urls += "?" + c.urlParams_.Encode()
  2019. req, err := http.NewRequest("POST", urls, body)
  2020. if err != nil {
  2021. return nil, err
  2022. }
  2023. req.Header = reqHeaders
  2024. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2025. }
  2026. // Do executes the "iam.iamPolicies.lintPolicy" call.
  2027. // Exactly one of *LintPolicyResponse or error will be non-nil. Any
  2028. // non-2xx status code is an error. Response headers are in either
  2029. // *LintPolicyResponse.ServerResponse.Header or (if a response was
  2030. // returned at all) in error.(*googleapi.Error).Header. Use
  2031. // googleapi.IsNotModified to check whether the returned error was
  2032. // because http.StatusNotModified was returned.
  2033. func (c *IamPoliciesLintPolicyCall) Do(opts ...googleapi.CallOption) (*LintPolicyResponse, error) {
  2034. gensupport.SetOptions(c.urlParams_, opts...)
  2035. res, err := c.doRequest("json")
  2036. if res != nil && res.StatusCode == http.StatusNotModified {
  2037. if res.Body != nil {
  2038. res.Body.Close()
  2039. }
  2040. return nil, &googleapi.Error{
  2041. Code: res.StatusCode,
  2042. Header: res.Header,
  2043. }
  2044. }
  2045. if err != nil {
  2046. return nil, err
  2047. }
  2048. defer googleapi.CloseBody(res)
  2049. if err := googleapi.CheckResponse(res); err != nil {
  2050. return nil, err
  2051. }
  2052. ret := &LintPolicyResponse{
  2053. ServerResponse: googleapi.ServerResponse{
  2054. Header: res.Header,
  2055. HTTPStatusCode: res.StatusCode,
  2056. },
  2057. }
  2058. target := &ret
  2059. if err := gensupport.DecodeResponse(target, res); err != nil {
  2060. return nil, err
  2061. }
  2062. return ret, nil
  2063. // {
  2064. // "description": "Lints a Cloud IAM policy object or its sub fields. Currently supports\ngoogle.iam.v1.Policy, google.iam.v1.Binding and\ngoogle.iam.v1.Binding.condition.\n\nEach lint operation consists of multiple lint validation units.\nValidation units have the following properties:\n\n- Each unit inspects the input object in regard to a particular\n linting aspect and issues a google.iam.admin.v1.LintResult\n disclosing the result.\n- Domain of discourse of each unit can be either\n google.iam.v1.Policy, google.iam.v1.Binding, or\n google.iam.v1.Binding.condition depending on the purpose of the\n validation.\n- A unit may require additional data (like the list of all possible\n enumerable values of a particular attribute used in the policy instance)\n which shall be provided by the caller. Refer to the comments of\n google.iam.admin.v1.LintPolicyRequest.context for more details.\n\nThe set of applicable validation units is determined by the Cloud IAM\nserver and is not configurable.\n\nRegardless of any lint issues or their severities, successful calls to\n`lintPolicy` return an HTTP 200 OK status code.",
  2065. // "flatPath": "v1/iamPolicies:lintPolicy",
  2066. // "httpMethod": "POST",
  2067. // "id": "iam.iamPolicies.lintPolicy",
  2068. // "parameterOrder": [],
  2069. // "parameters": {},
  2070. // "path": "v1/iamPolicies:lintPolicy",
  2071. // "request": {
  2072. // "$ref": "LintPolicyRequest"
  2073. // },
  2074. // "response": {
  2075. // "$ref": "LintPolicyResponse"
  2076. // },
  2077. // "scopes": [
  2078. // "https://www.googleapis.com/auth/cloud-platform"
  2079. // ]
  2080. // }
  2081. }
  2082. // method id "iam.iamPolicies.queryAuditableServices":
  2083. type IamPoliciesQueryAuditableServicesCall struct {
  2084. s *Service
  2085. queryauditableservicesrequest *QueryAuditableServicesRequest
  2086. urlParams_ gensupport.URLParams
  2087. ctx_ context.Context
  2088. header_ http.Header
  2089. }
  2090. // QueryAuditableServices: Returns a list of services that support
  2091. // service level audit logging
  2092. // configuration for the given resource.
  2093. func (r *IamPoliciesService) QueryAuditableServices(queryauditableservicesrequest *QueryAuditableServicesRequest) *IamPoliciesQueryAuditableServicesCall {
  2094. c := &IamPoliciesQueryAuditableServicesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2095. c.queryauditableservicesrequest = queryauditableservicesrequest
  2096. return c
  2097. }
  2098. // Fields allows partial responses to be retrieved. See
  2099. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2100. // for more information.
  2101. func (c *IamPoliciesQueryAuditableServicesCall) Fields(s ...googleapi.Field) *IamPoliciesQueryAuditableServicesCall {
  2102. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2103. return c
  2104. }
  2105. // Context sets the context to be used in this call's Do method. Any
  2106. // pending HTTP request will be aborted if the provided context is
  2107. // canceled.
  2108. func (c *IamPoliciesQueryAuditableServicesCall) Context(ctx context.Context) *IamPoliciesQueryAuditableServicesCall {
  2109. c.ctx_ = ctx
  2110. return c
  2111. }
  2112. // Header returns an http.Header that can be modified by the caller to
  2113. // add HTTP headers to the request.
  2114. func (c *IamPoliciesQueryAuditableServicesCall) Header() http.Header {
  2115. if c.header_ == nil {
  2116. c.header_ = make(http.Header)
  2117. }
  2118. return c.header_
  2119. }
  2120. func (c *IamPoliciesQueryAuditableServicesCall) doRequest(alt string) (*http.Response, error) {
  2121. reqHeaders := make(http.Header)
  2122. for k, v := range c.header_ {
  2123. reqHeaders[k] = v
  2124. }
  2125. reqHeaders.Set("User-Agent", c.s.userAgent())
  2126. var body io.Reader = nil
  2127. body, err := googleapi.WithoutDataWrapper.JSONReader(c.queryauditableservicesrequest)
  2128. if err != nil {
  2129. return nil, err
  2130. }
  2131. reqHeaders.Set("Content-Type", "application/json")
  2132. c.urlParams_.Set("alt", alt)
  2133. c.urlParams_.Set("prettyPrint", "false")
  2134. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/iamPolicies:queryAuditableServices")
  2135. urls += "?" + c.urlParams_.Encode()
  2136. req, err := http.NewRequest("POST", urls, body)
  2137. if err != nil {
  2138. return nil, err
  2139. }
  2140. req.Header = reqHeaders
  2141. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2142. }
  2143. // Do executes the "iam.iamPolicies.queryAuditableServices" call.
  2144. // Exactly one of *QueryAuditableServicesResponse or error will be
  2145. // non-nil. Any non-2xx status code is an error. Response headers are in
  2146. // either *QueryAuditableServicesResponse.ServerResponse.Header or (if a
  2147. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2148. // googleapi.IsNotModified to check whether the returned error was
  2149. // because http.StatusNotModified was returned.
  2150. func (c *IamPoliciesQueryAuditableServicesCall) Do(opts ...googleapi.CallOption) (*QueryAuditableServicesResponse, error) {
  2151. gensupport.SetOptions(c.urlParams_, opts...)
  2152. res, err := c.doRequest("json")
  2153. if res != nil && res.StatusCode == http.StatusNotModified {
  2154. if res.Body != nil {
  2155. res.Body.Close()
  2156. }
  2157. return nil, &googleapi.Error{
  2158. Code: res.StatusCode,
  2159. Header: res.Header,
  2160. }
  2161. }
  2162. if err != nil {
  2163. return nil, err
  2164. }
  2165. defer googleapi.CloseBody(res)
  2166. if err := googleapi.CheckResponse(res); err != nil {
  2167. return nil, err
  2168. }
  2169. ret := &QueryAuditableServicesResponse{
  2170. ServerResponse: googleapi.ServerResponse{
  2171. Header: res.Header,
  2172. HTTPStatusCode: res.StatusCode,
  2173. },
  2174. }
  2175. target := &ret
  2176. if err := gensupport.DecodeResponse(target, res); err != nil {
  2177. return nil, err
  2178. }
  2179. return ret, nil
  2180. // {
  2181. // "description": "Returns a list of services that support service level audit logging\nconfiguration for the given resource.",
  2182. // "flatPath": "v1/iamPolicies:queryAuditableServices",
  2183. // "httpMethod": "POST",
  2184. // "id": "iam.iamPolicies.queryAuditableServices",
  2185. // "parameterOrder": [],
  2186. // "parameters": {},
  2187. // "path": "v1/iamPolicies:queryAuditableServices",
  2188. // "request": {
  2189. // "$ref": "QueryAuditableServicesRequest"
  2190. // },
  2191. // "response": {
  2192. // "$ref": "QueryAuditableServicesResponse"
  2193. // },
  2194. // "scopes": [
  2195. // "https://www.googleapis.com/auth/cloud-platform"
  2196. // ]
  2197. // }
  2198. }
  2199. // method id "iam.organizations.roles.create":
  2200. type OrganizationsRolesCreateCall struct {
  2201. s *Service
  2202. parent string
  2203. createrolerequest *CreateRoleRequest
  2204. urlParams_ gensupport.URLParams
  2205. ctx_ context.Context
  2206. header_ http.Header
  2207. }
  2208. // Create: Creates a new Role.
  2209. func (r *OrganizationsRolesService) Create(parent string, createrolerequest *CreateRoleRequest) *OrganizationsRolesCreateCall {
  2210. c := &OrganizationsRolesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2211. c.parent = parent
  2212. c.createrolerequest = createrolerequest
  2213. return c
  2214. }
  2215. // Fields allows partial responses to be retrieved. See
  2216. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2217. // for more information.
  2218. func (c *OrganizationsRolesCreateCall) Fields(s ...googleapi.Field) *OrganizationsRolesCreateCall {
  2219. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2220. return c
  2221. }
  2222. // Context sets the context to be used in this call's Do method. Any
  2223. // pending HTTP request will be aborted if the provided context is
  2224. // canceled.
  2225. func (c *OrganizationsRolesCreateCall) Context(ctx context.Context) *OrganizationsRolesCreateCall {
  2226. c.ctx_ = ctx
  2227. return c
  2228. }
  2229. // Header returns an http.Header that can be modified by the caller to
  2230. // add HTTP headers to the request.
  2231. func (c *OrganizationsRolesCreateCall) Header() http.Header {
  2232. if c.header_ == nil {
  2233. c.header_ = make(http.Header)
  2234. }
  2235. return c.header_
  2236. }
  2237. func (c *OrganizationsRolesCreateCall) doRequest(alt string) (*http.Response, error) {
  2238. reqHeaders := make(http.Header)
  2239. for k, v := range c.header_ {
  2240. reqHeaders[k] = v
  2241. }
  2242. reqHeaders.Set("User-Agent", c.s.userAgent())
  2243. var body io.Reader = nil
  2244. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createrolerequest)
  2245. if err != nil {
  2246. return nil, err
  2247. }
  2248. reqHeaders.Set("Content-Type", "application/json")
  2249. c.urlParams_.Set("alt", alt)
  2250. c.urlParams_.Set("prettyPrint", "false")
  2251. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/roles")
  2252. urls += "?" + c.urlParams_.Encode()
  2253. req, err := http.NewRequest("POST", urls, body)
  2254. if err != nil {
  2255. return nil, err
  2256. }
  2257. req.Header = reqHeaders
  2258. googleapi.Expand(req.URL, map[string]string{
  2259. "parent": c.parent,
  2260. })
  2261. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2262. }
  2263. // Do executes the "iam.organizations.roles.create" call.
  2264. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  2265. // code is an error. Response headers are in either
  2266. // *Role.ServerResponse.Header or (if a response was returned at all) in
  2267. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2268. // whether the returned error was because http.StatusNotModified was
  2269. // returned.
  2270. func (c *OrganizationsRolesCreateCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  2271. gensupport.SetOptions(c.urlParams_, opts...)
  2272. res, err := c.doRequest("json")
  2273. if res != nil && res.StatusCode == http.StatusNotModified {
  2274. if res.Body != nil {
  2275. res.Body.Close()
  2276. }
  2277. return nil, &googleapi.Error{
  2278. Code: res.StatusCode,
  2279. Header: res.Header,
  2280. }
  2281. }
  2282. if err != nil {
  2283. return nil, err
  2284. }
  2285. defer googleapi.CloseBody(res)
  2286. if err := googleapi.CheckResponse(res); err != nil {
  2287. return nil, err
  2288. }
  2289. ret := &Role{
  2290. ServerResponse: googleapi.ServerResponse{
  2291. Header: res.Header,
  2292. HTTPStatusCode: res.StatusCode,
  2293. },
  2294. }
  2295. target := &ret
  2296. if err := gensupport.DecodeResponse(target, res); err != nil {
  2297. return nil, err
  2298. }
  2299. return ret, nil
  2300. // {
  2301. // "description": "Creates a new Role.",
  2302. // "flatPath": "v1/organizations/{organizationsId}/roles",
  2303. // "httpMethod": "POST",
  2304. // "id": "iam.organizations.roles.create",
  2305. // "parameterOrder": [
  2306. // "parent"
  2307. // ],
  2308. // "parameters": {
  2309. // "parent": {
  2310. // "description": "The resource name of the parent resource in one of the following formats:\n`organizations/{ORGANIZATION_ID}`\n`projects/{PROJECT_ID}`",
  2311. // "location": "path",
  2312. // "pattern": "^organizations/[^/]+$",
  2313. // "required": true,
  2314. // "type": "string"
  2315. // }
  2316. // },
  2317. // "path": "v1/{+parent}/roles",
  2318. // "request": {
  2319. // "$ref": "CreateRoleRequest"
  2320. // },
  2321. // "response": {
  2322. // "$ref": "Role"
  2323. // },
  2324. // "scopes": [
  2325. // "https://www.googleapis.com/auth/cloud-platform"
  2326. // ]
  2327. // }
  2328. }
  2329. // method id "iam.organizations.roles.delete":
  2330. type OrganizationsRolesDeleteCall struct {
  2331. s *Service
  2332. name string
  2333. urlParams_ gensupport.URLParams
  2334. ctx_ context.Context
  2335. header_ http.Header
  2336. }
  2337. // Delete: Soft deletes a role. The role is suspended and cannot be used
  2338. // to create new
  2339. // IAM Policy Bindings.
  2340. // The Role will not be included in `ListRoles()` unless `show_deleted`
  2341. // is set
  2342. // in the `ListRolesRequest`. The Role contains the deleted boolean
  2343. // set.
  2344. // Existing Bindings remains, but are inactive. The Role can be
  2345. // undeleted
  2346. // within 7 days. After 7 days the Role is deleted and all Bindings
  2347. // associated
  2348. // with the role are removed.
  2349. func (r *OrganizationsRolesService) Delete(name string) *OrganizationsRolesDeleteCall {
  2350. c := &OrganizationsRolesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2351. c.name = name
  2352. return c
  2353. }
  2354. // Etag sets the optional parameter "etag": Used to perform a consistent
  2355. // read-modify-write.
  2356. func (c *OrganizationsRolesDeleteCall) Etag(etag string) *OrganizationsRolesDeleteCall {
  2357. c.urlParams_.Set("etag", etag)
  2358. return c
  2359. }
  2360. // Fields allows partial responses to be retrieved. See
  2361. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2362. // for more information.
  2363. func (c *OrganizationsRolesDeleteCall) Fields(s ...googleapi.Field) *OrganizationsRolesDeleteCall {
  2364. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2365. return c
  2366. }
  2367. // Context sets the context to be used in this call's Do method. Any
  2368. // pending HTTP request will be aborted if the provided context is
  2369. // canceled.
  2370. func (c *OrganizationsRolesDeleteCall) Context(ctx context.Context) *OrganizationsRolesDeleteCall {
  2371. c.ctx_ = ctx
  2372. return c
  2373. }
  2374. // Header returns an http.Header that can be modified by the caller to
  2375. // add HTTP headers to the request.
  2376. func (c *OrganizationsRolesDeleteCall) Header() http.Header {
  2377. if c.header_ == nil {
  2378. c.header_ = make(http.Header)
  2379. }
  2380. return c.header_
  2381. }
  2382. func (c *OrganizationsRolesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2383. reqHeaders := make(http.Header)
  2384. for k, v := range c.header_ {
  2385. reqHeaders[k] = v
  2386. }
  2387. reqHeaders.Set("User-Agent", c.s.userAgent())
  2388. var body io.Reader = nil
  2389. c.urlParams_.Set("alt", alt)
  2390. c.urlParams_.Set("prettyPrint", "false")
  2391. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2392. urls += "?" + c.urlParams_.Encode()
  2393. req, err := http.NewRequest("DELETE", urls, body)
  2394. if err != nil {
  2395. return nil, err
  2396. }
  2397. req.Header = reqHeaders
  2398. googleapi.Expand(req.URL, map[string]string{
  2399. "name": c.name,
  2400. })
  2401. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2402. }
  2403. // Do executes the "iam.organizations.roles.delete" call.
  2404. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  2405. // code is an error. Response headers are in either
  2406. // *Role.ServerResponse.Header or (if a response was returned at all) in
  2407. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2408. // whether the returned error was because http.StatusNotModified was
  2409. // returned.
  2410. func (c *OrganizationsRolesDeleteCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  2411. gensupport.SetOptions(c.urlParams_, opts...)
  2412. res, err := c.doRequest("json")
  2413. if res != nil && res.StatusCode == http.StatusNotModified {
  2414. if res.Body != nil {
  2415. res.Body.Close()
  2416. }
  2417. return nil, &googleapi.Error{
  2418. Code: res.StatusCode,
  2419. Header: res.Header,
  2420. }
  2421. }
  2422. if err != nil {
  2423. return nil, err
  2424. }
  2425. defer googleapi.CloseBody(res)
  2426. if err := googleapi.CheckResponse(res); err != nil {
  2427. return nil, err
  2428. }
  2429. ret := &Role{
  2430. ServerResponse: googleapi.ServerResponse{
  2431. Header: res.Header,
  2432. HTTPStatusCode: res.StatusCode,
  2433. },
  2434. }
  2435. target := &ret
  2436. if err := gensupport.DecodeResponse(target, res); err != nil {
  2437. return nil, err
  2438. }
  2439. return ret, nil
  2440. // {
  2441. // "description": "Soft deletes a role. The role is suspended and cannot be used to create new\nIAM Policy Bindings.\nThe Role will not be included in `ListRoles()` unless `show_deleted` is set\nin the `ListRolesRequest`. The Role contains the deleted boolean set.\nExisting Bindings remains, but are inactive. The Role can be undeleted\nwithin 7 days. After 7 days the Role is deleted and all Bindings associated\nwith the role are removed.",
  2442. // "flatPath": "v1/organizations/{organizationsId}/roles/{rolesId}",
  2443. // "httpMethod": "DELETE",
  2444. // "id": "iam.organizations.roles.delete",
  2445. // "parameterOrder": [
  2446. // "name"
  2447. // ],
  2448. // "parameters": {
  2449. // "etag": {
  2450. // "description": "Used to perform a consistent read-modify-write.",
  2451. // "format": "byte",
  2452. // "location": "query",
  2453. // "type": "string"
  2454. // },
  2455. // "name": {
  2456. // "description": "The resource name of the role in one of the following formats:\n`organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`\n`projects/{PROJECT_ID}/roles/{ROLE_NAME}`",
  2457. // "location": "path",
  2458. // "pattern": "^organizations/[^/]+/roles/[^/]+$",
  2459. // "required": true,
  2460. // "type": "string"
  2461. // }
  2462. // },
  2463. // "path": "v1/{+name}",
  2464. // "response": {
  2465. // "$ref": "Role"
  2466. // },
  2467. // "scopes": [
  2468. // "https://www.googleapis.com/auth/cloud-platform"
  2469. // ]
  2470. // }
  2471. }
  2472. // method id "iam.organizations.roles.get":
  2473. type OrganizationsRolesGetCall struct {
  2474. s *Service
  2475. name string
  2476. urlParams_ gensupport.URLParams
  2477. ifNoneMatch_ string
  2478. ctx_ context.Context
  2479. header_ http.Header
  2480. }
  2481. // Get: Gets a Role definition.
  2482. func (r *OrganizationsRolesService) Get(name string) *OrganizationsRolesGetCall {
  2483. c := &OrganizationsRolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2484. c.name = name
  2485. return c
  2486. }
  2487. // Fields allows partial responses to be retrieved. See
  2488. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2489. // for more information.
  2490. func (c *OrganizationsRolesGetCall) Fields(s ...googleapi.Field) *OrganizationsRolesGetCall {
  2491. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2492. return c
  2493. }
  2494. // IfNoneMatch sets the optional parameter which makes the operation
  2495. // fail if the object's ETag matches the given value. This is useful for
  2496. // getting updates only after the object has changed since the last
  2497. // request. Use googleapi.IsNotModified to check whether the response
  2498. // error from Do is the result of In-None-Match.
  2499. func (c *OrganizationsRolesGetCall) IfNoneMatch(entityTag string) *OrganizationsRolesGetCall {
  2500. c.ifNoneMatch_ = entityTag
  2501. return c
  2502. }
  2503. // Context sets the context to be used in this call's Do method. Any
  2504. // pending HTTP request will be aborted if the provided context is
  2505. // canceled.
  2506. func (c *OrganizationsRolesGetCall) Context(ctx context.Context) *OrganizationsRolesGetCall {
  2507. c.ctx_ = ctx
  2508. return c
  2509. }
  2510. // Header returns an http.Header that can be modified by the caller to
  2511. // add HTTP headers to the request.
  2512. func (c *OrganizationsRolesGetCall) Header() http.Header {
  2513. if c.header_ == nil {
  2514. c.header_ = make(http.Header)
  2515. }
  2516. return c.header_
  2517. }
  2518. func (c *OrganizationsRolesGetCall) doRequest(alt string) (*http.Response, error) {
  2519. reqHeaders := make(http.Header)
  2520. for k, v := range c.header_ {
  2521. reqHeaders[k] = v
  2522. }
  2523. reqHeaders.Set("User-Agent", c.s.userAgent())
  2524. if c.ifNoneMatch_ != "" {
  2525. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2526. }
  2527. var body io.Reader = nil
  2528. c.urlParams_.Set("alt", alt)
  2529. c.urlParams_.Set("prettyPrint", "false")
  2530. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2531. urls += "?" + c.urlParams_.Encode()
  2532. req, err := http.NewRequest("GET", urls, body)
  2533. if err != nil {
  2534. return nil, err
  2535. }
  2536. req.Header = reqHeaders
  2537. googleapi.Expand(req.URL, map[string]string{
  2538. "name": c.name,
  2539. })
  2540. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2541. }
  2542. // Do executes the "iam.organizations.roles.get" call.
  2543. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  2544. // code is an error. Response headers are in either
  2545. // *Role.ServerResponse.Header or (if a response was returned at all) in
  2546. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2547. // whether the returned error was because http.StatusNotModified was
  2548. // returned.
  2549. func (c *OrganizationsRolesGetCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  2550. gensupport.SetOptions(c.urlParams_, opts...)
  2551. res, err := c.doRequest("json")
  2552. if res != nil && res.StatusCode == http.StatusNotModified {
  2553. if res.Body != nil {
  2554. res.Body.Close()
  2555. }
  2556. return nil, &googleapi.Error{
  2557. Code: res.StatusCode,
  2558. Header: res.Header,
  2559. }
  2560. }
  2561. if err != nil {
  2562. return nil, err
  2563. }
  2564. defer googleapi.CloseBody(res)
  2565. if err := googleapi.CheckResponse(res); err != nil {
  2566. return nil, err
  2567. }
  2568. ret := &Role{
  2569. ServerResponse: googleapi.ServerResponse{
  2570. Header: res.Header,
  2571. HTTPStatusCode: res.StatusCode,
  2572. },
  2573. }
  2574. target := &ret
  2575. if err := gensupport.DecodeResponse(target, res); err != nil {
  2576. return nil, err
  2577. }
  2578. return ret, nil
  2579. // {
  2580. // "description": "Gets a Role definition.",
  2581. // "flatPath": "v1/organizations/{organizationsId}/roles/{rolesId}",
  2582. // "httpMethod": "GET",
  2583. // "id": "iam.organizations.roles.get",
  2584. // "parameterOrder": [
  2585. // "name"
  2586. // ],
  2587. // "parameters": {
  2588. // "name": {
  2589. // "description": "The resource name of the role in one of the following formats:\n`roles/{ROLE_NAME}`\n`organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`\n`projects/{PROJECT_ID}/roles/{ROLE_NAME}`",
  2590. // "location": "path",
  2591. // "pattern": "^organizations/[^/]+/roles/[^/]+$",
  2592. // "required": true,
  2593. // "type": "string"
  2594. // }
  2595. // },
  2596. // "path": "v1/{+name}",
  2597. // "response": {
  2598. // "$ref": "Role"
  2599. // },
  2600. // "scopes": [
  2601. // "https://www.googleapis.com/auth/cloud-platform"
  2602. // ]
  2603. // }
  2604. }
  2605. // method id "iam.organizations.roles.list":
  2606. type OrganizationsRolesListCall struct {
  2607. s *Service
  2608. parent string
  2609. urlParams_ gensupport.URLParams
  2610. ifNoneMatch_ string
  2611. ctx_ context.Context
  2612. header_ http.Header
  2613. }
  2614. // List: Lists the Roles defined on a resource.
  2615. func (r *OrganizationsRolesService) List(parent string) *OrganizationsRolesListCall {
  2616. c := &OrganizationsRolesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2617. c.parent = parent
  2618. return c
  2619. }
  2620. // PageSize sets the optional parameter "pageSize": Optional limit on
  2621. // the number of roles to include in the response.
  2622. func (c *OrganizationsRolesListCall) PageSize(pageSize int64) *OrganizationsRolesListCall {
  2623. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2624. return c
  2625. }
  2626. // PageToken sets the optional parameter "pageToken": Optional
  2627. // pagination token returned in an earlier ListRolesResponse.
  2628. func (c *OrganizationsRolesListCall) PageToken(pageToken string) *OrganizationsRolesListCall {
  2629. c.urlParams_.Set("pageToken", pageToken)
  2630. return c
  2631. }
  2632. // ShowDeleted sets the optional parameter "showDeleted": Include Roles
  2633. // that have been deleted.
  2634. func (c *OrganizationsRolesListCall) ShowDeleted(showDeleted bool) *OrganizationsRolesListCall {
  2635. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  2636. return c
  2637. }
  2638. // View sets the optional parameter "view": Optional view for the
  2639. // returned Role objects. When `FULL` is specified,
  2640. // the `includedPermissions` field is returned, which includes a list of
  2641. // all
  2642. // permissions in the role. The default value is `BASIC`, which does
  2643. // not
  2644. // return the `includedPermissions` field.
  2645. //
  2646. // Possible values:
  2647. // "BASIC"
  2648. // "FULL"
  2649. func (c *OrganizationsRolesListCall) View(view string) *OrganizationsRolesListCall {
  2650. c.urlParams_.Set("view", view)
  2651. return c
  2652. }
  2653. // Fields allows partial responses to be retrieved. See
  2654. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2655. // for more information.
  2656. func (c *OrganizationsRolesListCall) Fields(s ...googleapi.Field) *OrganizationsRolesListCall {
  2657. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2658. return c
  2659. }
  2660. // IfNoneMatch sets the optional parameter which makes the operation
  2661. // fail if the object's ETag matches the given value. This is useful for
  2662. // getting updates only after the object has changed since the last
  2663. // request. Use googleapi.IsNotModified to check whether the response
  2664. // error from Do is the result of In-None-Match.
  2665. func (c *OrganizationsRolesListCall) IfNoneMatch(entityTag string) *OrganizationsRolesListCall {
  2666. c.ifNoneMatch_ = entityTag
  2667. return c
  2668. }
  2669. // Context sets the context to be used in this call's Do method. Any
  2670. // pending HTTP request will be aborted if the provided context is
  2671. // canceled.
  2672. func (c *OrganizationsRolesListCall) Context(ctx context.Context) *OrganizationsRolesListCall {
  2673. c.ctx_ = ctx
  2674. return c
  2675. }
  2676. // Header returns an http.Header that can be modified by the caller to
  2677. // add HTTP headers to the request.
  2678. func (c *OrganizationsRolesListCall) Header() http.Header {
  2679. if c.header_ == nil {
  2680. c.header_ = make(http.Header)
  2681. }
  2682. return c.header_
  2683. }
  2684. func (c *OrganizationsRolesListCall) doRequest(alt string) (*http.Response, error) {
  2685. reqHeaders := make(http.Header)
  2686. for k, v := range c.header_ {
  2687. reqHeaders[k] = v
  2688. }
  2689. reqHeaders.Set("User-Agent", c.s.userAgent())
  2690. if c.ifNoneMatch_ != "" {
  2691. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2692. }
  2693. var body io.Reader = nil
  2694. c.urlParams_.Set("alt", alt)
  2695. c.urlParams_.Set("prettyPrint", "false")
  2696. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/roles")
  2697. urls += "?" + c.urlParams_.Encode()
  2698. req, err := http.NewRequest("GET", urls, body)
  2699. if err != nil {
  2700. return nil, err
  2701. }
  2702. req.Header = reqHeaders
  2703. googleapi.Expand(req.URL, map[string]string{
  2704. "parent": c.parent,
  2705. })
  2706. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2707. }
  2708. // Do executes the "iam.organizations.roles.list" call.
  2709. // Exactly one of *ListRolesResponse or error will be non-nil. Any
  2710. // non-2xx status code is an error. Response headers are in either
  2711. // *ListRolesResponse.ServerResponse.Header or (if a response was
  2712. // returned at all) in error.(*googleapi.Error).Header. Use
  2713. // googleapi.IsNotModified to check whether the returned error was
  2714. // because http.StatusNotModified was returned.
  2715. func (c *OrganizationsRolesListCall) Do(opts ...googleapi.CallOption) (*ListRolesResponse, error) {
  2716. gensupport.SetOptions(c.urlParams_, opts...)
  2717. res, err := c.doRequest("json")
  2718. if res != nil && res.StatusCode == http.StatusNotModified {
  2719. if res.Body != nil {
  2720. res.Body.Close()
  2721. }
  2722. return nil, &googleapi.Error{
  2723. Code: res.StatusCode,
  2724. Header: res.Header,
  2725. }
  2726. }
  2727. if err != nil {
  2728. return nil, err
  2729. }
  2730. defer googleapi.CloseBody(res)
  2731. if err := googleapi.CheckResponse(res); err != nil {
  2732. return nil, err
  2733. }
  2734. ret := &ListRolesResponse{
  2735. ServerResponse: googleapi.ServerResponse{
  2736. Header: res.Header,
  2737. HTTPStatusCode: res.StatusCode,
  2738. },
  2739. }
  2740. target := &ret
  2741. if err := gensupport.DecodeResponse(target, res); err != nil {
  2742. return nil, err
  2743. }
  2744. return ret, nil
  2745. // {
  2746. // "description": "Lists the Roles defined on a resource.",
  2747. // "flatPath": "v1/organizations/{organizationsId}/roles",
  2748. // "httpMethod": "GET",
  2749. // "id": "iam.organizations.roles.list",
  2750. // "parameterOrder": [
  2751. // "parent"
  2752. // ],
  2753. // "parameters": {
  2754. // "pageSize": {
  2755. // "description": "Optional limit on the number of roles to include in the response.",
  2756. // "format": "int32",
  2757. // "location": "query",
  2758. // "type": "integer"
  2759. // },
  2760. // "pageToken": {
  2761. // "description": "Optional pagination token returned in an earlier ListRolesResponse.",
  2762. // "location": "query",
  2763. // "type": "string"
  2764. // },
  2765. // "parent": {
  2766. // "description": "The resource name of the parent resource in one of the following formats:\n`` (empty string) -- this refers to curated roles.\n`organizations/{ORGANIZATION_ID}`\n`projects/{PROJECT_ID}`",
  2767. // "location": "path",
  2768. // "pattern": "^organizations/[^/]+$",
  2769. // "required": true,
  2770. // "type": "string"
  2771. // },
  2772. // "showDeleted": {
  2773. // "description": "Include Roles that have been deleted.",
  2774. // "location": "query",
  2775. // "type": "boolean"
  2776. // },
  2777. // "view": {
  2778. // "description": "Optional view for the returned Role objects. When `FULL` is specified,\nthe `includedPermissions` field is returned, which includes a list of all\npermissions in the role. The default value is `BASIC`, which does not\nreturn the `includedPermissions` field.",
  2779. // "enum": [
  2780. // "BASIC",
  2781. // "FULL"
  2782. // ],
  2783. // "location": "query",
  2784. // "type": "string"
  2785. // }
  2786. // },
  2787. // "path": "v1/{+parent}/roles",
  2788. // "response": {
  2789. // "$ref": "ListRolesResponse"
  2790. // },
  2791. // "scopes": [
  2792. // "https://www.googleapis.com/auth/cloud-platform"
  2793. // ]
  2794. // }
  2795. }
  2796. // Pages invokes f for each page of results.
  2797. // A non-nil error returned from f will halt the iteration.
  2798. // The provided context supersedes any context provided to the Context method.
  2799. func (c *OrganizationsRolesListCall) Pages(ctx context.Context, f func(*ListRolesResponse) error) error {
  2800. c.ctx_ = ctx
  2801. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2802. for {
  2803. x, err := c.Do()
  2804. if err != nil {
  2805. return err
  2806. }
  2807. if err := f(x); err != nil {
  2808. return err
  2809. }
  2810. if x.NextPageToken == "" {
  2811. return nil
  2812. }
  2813. c.PageToken(x.NextPageToken)
  2814. }
  2815. }
  2816. // method id "iam.organizations.roles.patch":
  2817. type OrganizationsRolesPatchCall struct {
  2818. s *Service
  2819. name string
  2820. role *Role
  2821. urlParams_ gensupport.URLParams
  2822. ctx_ context.Context
  2823. header_ http.Header
  2824. }
  2825. // Patch: Updates a Role definition.
  2826. func (r *OrganizationsRolesService) Patch(name string, role *Role) *OrganizationsRolesPatchCall {
  2827. c := &OrganizationsRolesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2828. c.name = name
  2829. c.role = role
  2830. return c
  2831. }
  2832. // UpdateMask sets the optional parameter "updateMask": A mask
  2833. // describing which fields in the Role have changed.
  2834. func (c *OrganizationsRolesPatchCall) UpdateMask(updateMask string) *OrganizationsRolesPatchCall {
  2835. c.urlParams_.Set("updateMask", updateMask)
  2836. return c
  2837. }
  2838. // Fields allows partial responses to be retrieved. See
  2839. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2840. // for more information.
  2841. func (c *OrganizationsRolesPatchCall) Fields(s ...googleapi.Field) *OrganizationsRolesPatchCall {
  2842. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2843. return c
  2844. }
  2845. // Context sets the context to be used in this call's Do method. Any
  2846. // pending HTTP request will be aborted if the provided context is
  2847. // canceled.
  2848. func (c *OrganizationsRolesPatchCall) Context(ctx context.Context) *OrganizationsRolesPatchCall {
  2849. c.ctx_ = ctx
  2850. return c
  2851. }
  2852. // Header returns an http.Header that can be modified by the caller to
  2853. // add HTTP headers to the request.
  2854. func (c *OrganizationsRolesPatchCall) Header() http.Header {
  2855. if c.header_ == nil {
  2856. c.header_ = make(http.Header)
  2857. }
  2858. return c.header_
  2859. }
  2860. func (c *OrganizationsRolesPatchCall) doRequest(alt string) (*http.Response, error) {
  2861. reqHeaders := make(http.Header)
  2862. for k, v := range c.header_ {
  2863. reqHeaders[k] = v
  2864. }
  2865. reqHeaders.Set("User-Agent", c.s.userAgent())
  2866. var body io.Reader = nil
  2867. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  2868. if err != nil {
  2869. return nil, err
  2870. }
  2871. reqHeaders.Set("Content-Type", "application/json")
  2872. c.urlParams_.Set("alt", alt)
  2873. c.urlParams_.Set("prettyPrint", "false")
  2874. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2875. urls += "?" + c.urlParams_.Encode()
  2876. req, err := http.NewRequest("PATCH", urls, body)
  2877. if err != nil {
  2878. return nil, err
  2879. }
  2880. req.Header = reqHeaders
  2881. googleapi.Expand(req.URL, map[string]string{
  2882. "name": c.name,
  2883. })
  2884. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2885. }
  2886. // Do executes the "iam.organizations.roles.patch" call.
  2887. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  2888. // code is an error. Response headers are in either
  2889. // *Role.ServerResponse.Header or (if a response was returned at all) in
  2890. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2891. // whether the returned error was because http.StatusNotModified was
  2892. // returned.
  2893. func (c *OrganizationsRolesPatchCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  2894. gensupport.SetOptions(c.urlParams_, opts...)
  2895. res, err := c.doRequest("json")
  2896. if res != nil && res.StatusCode == http.StatusNotModified {
  2897. if res.Body != nil {
  2898. res.Body.Close()
  2899. }
  2900. return nil, &googleapi.Error{
  2901. Code: res.StatusCode,
  2902. Header: res.Header,
  2903. }
  2904. }
  2905. if err != nil {
  2906. return nil, err
  2907. }
  2908. defer googleapi.CloseBody(res)
  2909. if err := googleapi.CheckResponse(res); err != nil {
  2910. return nil, err
  2911. }
  2912. ret := &Role{
  2913. ServerResponse: googleapi.ServerResponse{
  2914. Header: res.Header,
  2915. HTTPStatusCode: res.StatusCode,
  2916. },
  2917. }
  2918. target := &ret
  2919. if err := gensupport.DecodeResponse(target, res); err != nil {
  2920. return nil, err
  2921. }
  2922. return ret, nil
  2923. // {
  2924. // "description": "Updates a Role definition.",
  2925. // "flatPath": "v1/organizations/{organizationsId}/roles/{rolesId}",
  2926. // "httpMethod": "PATCH",
  2927. // "id": "iam.organizations.roles.patch",
  2928. // "parameterOrder": [
  2929. // "name"
  2930. // ],
  2931. // "parameters": {
  2932. // "name": {
  2933. // "description": "The resource name of the role in one of the following formats:\n`roles/{ROLE_NAME}`\n`organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`\n`projects/{PROJECT_ID}/roles/{ROLE_NAME}`",
  2934. // "location": "path",
  2935. // "pattern": "^organizations/[^/]+/roles/[^/]+$",
  2936. // "required": true,
  2937. // "type": "string"
  2938. // },
  2939. // "updateMask": {
  2940. // "description": "A mask describing which fields in the Role have changed.",
  2941. // "format": "google-fieldmask",
  2942. // "location": "query",
  2943. // "type": "string"
  2944. // }
  2945. // },
  2946. // "path": "v1/{+name}",
  2947. // "request": {
  2948. // "$ref": "Role"
  2949. // },
  2950. // "response": {
  2951. // "$ref": "Role"
  2952. // },
  2953. // "scopes": [
  2954. // "https://www.googleapis.com/auth/cloud-platform"
  2955. // ]
  2956. // }
  2957. }
  2958. // method id "iam.organizations.roles.undelete":
  2959. type OrganizationsRolesUndeleteCall struct {
  2960. s *Service
  2961. name string
  2962. undeleterolerequest *UndeleteRoleRequest
  2963. urlParams_ gensupport.URLParams
  2964. ctx_ context.Context
  2965. header_ http.Header
  2966. }
  2967. // Undelete: Undelete a Role, bringing it back in its previous state.
  2968. func (r *OrganizationsRolesService) Undelete(name string, undeleterolerequest *UndeleteRoleRequest) *OrganizationsRolesUndeleteCall {
  2969. c := &OrganizationsRolesUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2970. c.name = name
  2971. c.undeleterolerequest = undeleterolerequest
  2972. return c
  2973. }
  2974. // Fields allows partial responses to be retrieved. See
  2975. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2976. // for more information.
  2977. func (c *OrganizationsRolesUndeleteCall) Fields(s ...googleapi.Field) *OrganizationsRolesUndeleteCall {
  2978. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2979. return c
  2980. }
  2981. // Context sets the context to be used in this call's Do method. Any
  2982. // pending HTTP request will be aborted if the provided context is
  2983. // canceled.
  2984. func (c *OrganizationsRolesUndeleteCall) Context(ctx context.Context) *OrganizationsRolesUndeleteCall {
  2985. c.ctx_ = ctx
  2986. return c
  2987. }
  2988. // Header returns an http.Header that can be modified by the caller to
  2989. // add HTTP headers to the request.
  2990. func (c *OrganizationsRolesUndeleteCall) Header() http.Header {
  2991. if c.header_ == nil {
  2992. c.header_ = make(http.Header)
  2993. }
  2994. return c.header_
  2995. }
  2996. func (c *OrganizationsRolesUndeleteCall) doRequest(alt string) (*http.Response, error) {
  2997. reqHeaders := make(http.Header)
  2998. for k, v := range c.header_ {
  2999. reqHeaders[k] = v
  3000. }
  3001. reqHeaders.Set("User-Agent", c.s.userAgent())
  3002. var body io.Reader = nil
  3003. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeleterolerequest)
  3004. if err != nil {
  3005. return nil, err
  3006. }
  3007. reqHeaders.Set("Content-Type", "application/json")
  3008. c.urlParams_.Set("alt", alt)
  3009. c.urlParams_.Set("prettyPrint", "false")
  3010. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:undelete")
  3011. urls += "?" + c.urlParams_.Encode()
  3012. req, err := http.NewRequest("POST", urls, body)
  3013. if err != nil {
  3014. return nil, err
  3015. }
  3016. req.Header = reqHeaders
  3017. googleapi.Expand(req.URL, map[string]string{
  3018. "name": c.name,
  3019. })
  3020. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3021. }
  3022. // Do executes the "iam.organizations.roles.undelete" call.
  3023. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  3024. // code is an error. Response headers are in either
  3025. // *Role.ServerResponse.Header or (if a response was returned at all) in
  3026. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3027. // whether the returned error was because http.StatusNotModified was
  3028. // returned.
  3029. func (c *OrganizationsRolesUndeleteCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  3030. gensupport.SetOptions(c.urlParams_, opts...)
  3031. res, err := c.doRequest("json")
  3032. if res != nil && res.StatusCode == http.StatusNotModified {
  3033. if res.Body != nil {
  3034. res.Body.Close()
  3035. }
  3036. return nil, &googleapi.Error{
  3037. Code: res.StatusCode,
  3038. Header: res.Header,
  3039. }
  3040. }
  3041. if err != nil {
  3042. return nil, err
  3043. }
  3044. defer googleapi.CloseBody(res)
  3045. if err := googleapi.CheckResponse(res); err != nil {
  3046. return nil, err
  3047. }
  3048. ret := &Role{
  3049. ServerResponse: googleapi.ServerResponse{
  3050. Header: res.Header,
  3051. HTTPStatusCode: res.StatusCode,
  3052. },
  3053. }
  3054. target := &ret
  3055. if err := gensupport.DecodeResponse(target, res); err != nil {
  3056. return nil, err
  3057. }
  3058. return ret, nil
  3059. // {
  3060. // "description": "Undelete a Role, bringing it back in its previous state.",
  3061. // "flatPath": "v1/organizations/{organizationsId}/roles/{rolesId}:undelete",
  3062. // "httpMethod": "POST",
  3063. // "id": "iam.organizations.roles.undelete",
  3064. // "parameterOrder": [
  3065. // "name"
  3066. // ],
  3067. // "parameters": {
  3068. // "name": {
  3069. // "description": "The resource name of the role in one of the following formats:\n`organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`\n`projects/{PROJECT_ID}/roles/{ROLE_NAME}`",
  3070. // "location": "path",
  3071. // "pattern": "^organizations/[^/]+/roles/[^/]+$",
  3072. // "required": true,
  3073. // "type": "string"
  3074. // }
  3075. // },
  3076. // "path": "v1/{+name}:undelete",
  3077. // "request": {
  3078. // "$ref": "UndeleteRoleRequest"
  3079. // },
  3080. // "response": {
  3081. // "$ref": "Role"
  3082. // },
  3083. // "scopes": [
  3084. // "https://www.googleapis.com/auth/cloud-platform"
  3085. // ]
  3086. // }
  3087. }
  3088. // method id "iam.permissions.queryTestablePermissions":
  3089. type PermissionsQueryTestablePermissionsCall struct {
  3090. s *Service
  3091. querytestablepermissionsrequest *QueryTestablePermissionsRequest
  3092. urlParams_ gensupport.URLParams
  3093. ctx_ context.Context
  3094. header_ http.Header
  3095. }
  3096. // QueryTestablePermissions: Lists the permissions testable on a
  3097. // resource.
  3098. // A permission is testable if it can be tested for an identity on a
  3099. // resource.
  3100. func (r *PermissionsService) QueryTestablePermissions(querytestablepermissionsrequest *QueryTestablePermissionsRequest) *PermissionsQueryTestablePermissionsCall {
  3101. c := &PermissionsQueryTestablePermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3102. c.querytestablepermissionsrequest = querytestablepermissionsrequest
  3103. return c
  3104. }
  3105. // Fields allows partial responses to be retrieved. See
  3106. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3107. // for more information.
  3108. func (c *PermissionsQueryTestablePermissionsCall) Fields(s ...googleapi.Field) *PermissionsQueryTestablePermissionsCall {
  3109. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3110. return c
  3111. }
  3112. // Context sets the context to be used in this call's Do method. Any
  3113. // pending HTTP request will be aborted if the provided context is
  3114. // canceled.
  3115. func (c *PermissionsQueryTestablePermissionsCall) Context(ctx context.Context) *PermissionsQueryTestablePermissionsCall {
  3116. c.ctx_ = ctx
  3117. return c
  3118. }
  3119. // Header returns an http.Header that can be modified by the caller to
  3120. // add HTTP headers to the request.
  3121. func (c *PermissionsQueryTestablePermissionsCall) Header() http.Header {
  3122. if c.header_ == nil {
  3123. c.header_ = make(http.Header)
  3124. }
  3125. return c.header_
  3126. }
  3127. func (c *PermissionsQueryTestablePermissionsCall) doRequest(alt string) (*http.Response, error) {
  3128. reqHeaders := make(http.Header)
  3129. for k, v := range c.header_ {
  3130. reqHeaders[k] = v
  3131. }
  3132. reqHeaders.Set("User-Agent", c.s.userAgent())
  3133. var body io.Reader = nil
  3134. body, err := googleapi.WithoutDataWrapper.JSONReader(c.querytestablepermissionsrequest)
  3135. if err != nil {
  3136. return nil, err
  3137. }
  3138. reqHeaders.Set("Content-Type", "application/json")
  3139. c.urlParams_.Set("alt", alt)
  3140. c.urlParams_.Set("prettyPrint", "false")
  3141. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/permissions:queryTestablePermissions")
  3142. urls += "?" + c.urlParams_.Encode()
  3143. req, err := http.NewRequest("POST", urls, body)
  3144. if err != nil {
  3145. return nil, err
  3146. }
  3147. req.Header = reqHeaders
  3148. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3149. }
  3150. // Do executes the "iam.permissions.queryTestablePermissions" call.
  3151. // Exactly one of *QueryTestablePermissionsResponse or error will be
  3152. // non-nil. Any non-2xx status code is an error. Response headers are in
  3153. // either *QueryTestablePermissionsResponse.ServerResponse.Header or (if
  3154. // a response was returned at all) in error.(*googleapi.Error).Header.
  3155. // Use googleapi.IsNotModified to check whether the returned error was
  3156. // because http.StatusNotModified was returned.
  3157. func (c *PermissionsQueryTestablePermissionsCall) Do(opts ...googleapi.CallOption) (*QueryTestablePermissionsResponse, error) {
  3158. gensupport.SetOptions(c.urlParams_, opts...)
  3159. res, err := c.doRequest("json")
  3160. if res != nil && res.StatusCode == http.StatusNotModified {
  3161. if res.Body != nil {
  3162. res.Body.Close()
  3163. }
  3164. return nil, &googleapi.Error{
  3165. Code: res.StatusCode,
  3166. Header: res.Header,
  3167. }
  3168. }
  3169. if err != nil {
  3170. return nil, err
  3171. }
  3172. defer googleapi.CloseBody(res)
  3173. if err := googleapi.CheckResponse(res); err != nil {
  3174. return nil, err
  3175. }
  3176. ret := &QueryTestablePermissionsResponse{
  3177. ServerResponse: googleapi.ServerResponse{
  3178. Header: res.Header,
  3179. HTTPStatusCode: res.StatusCode,
  3180. },
  3181. }
  3182. target := &ret
  3183. if err := gensupport.DecodeResponse(target, res); err != nil {
  3184. return nil, err
  3185. }
  3186. return ret, nil
  3187. // {
  3188. // "description": "Lists the permissions testable on a resource.\nA permission is testable if it can be tested for an identity on a resource.",
  3189. // "flatPath": "v1/permissions:queryTestablePermissions",
  3190. // "httpMethod": "POST",
  3191. // "id": "iam.permissions.queryTestablePermissions",
  3192. // "parameterOrder": [],
  3193. // "parameters": {},
  3194. // "path": "v1/permissions:queryTestablePermissions",
  3195. // "request": {
  3196. // "$ref": "QueryTestablePermissionsRequest"
  3197. // },
  3198. // "response": {
  3199. // "$ref": "QueryTestablePermissionsResponse"
  3200. // },
  3201. // "scopes": [
  3202. // "https://www.googleapis.com/auth/cloud-platform"
  3203. // ]
  3204. // }
  3205. }
  3206. // Pages invokes f for each page of results.
  3207. // A non-nil error returned from f will halt the iteration.
  3208. // The provided context supersedes any context provided to the Context method.
  3209. func (c *PermissionsQueryTestablePermissionsCall) Pages(ctx context.Context, f func(*QueryTestablePermissionsResponse) error) error {
  3210. c.ctx_ = ctx
  3211. defer func(pt string) { c.querytestablepermissionsrequest.PageToken = pt }(c.querytestablepermissionsrequest.PageToken) // reset paging to original point
  3212. for {
  3213. x, err := c.Do()
  3214. if err != nil {
  3215. return err
  3216. }
  3217. if err := f(x); err != nil {
  3218. return err
  3219. }
  3220. if x.NextPageToken == "" {
  3221. return nil
  3222. }
  3223. c.querytestablepermissionsrequest.PageToken = x.NextPageToken
  3224. }
  3225. }
  3226. // method id "iam.projects.roles.create":
  3227. type ProjectsRolesCreateCall struct {
  3228. s *Service
  3229. parent string
  3230. createrolerequest *CreateRoleRequest
  3231. urlParams_ gensupport.URLParams
  3232. ctx_ context.Context
  3233. header_ http.Header
  3234. }
  3235. // Create: Creates a new Role.
  3236. func (r *ProjectsRolesService) Create(parent string, createrolerequest *CreateRoleRequest) *ProjectsRolesCreateCall {
  3237. c := &ProjectsRolesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3238. c.parent = parent
  3239. c.createrolerequest = createrolerequest
  3240. return c
  3241. }
  3242. // Fields allows partial responses to be retrieved. See
  3243. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3244. // for more information.
  3245. func (c *ProjectsRolesCreateCall) Fields(s ...googleapi.Field) *ProjectsRolesCreateCall {
  3246. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3247. return c
  3248. }
  3249. // Context sets the context to be used in this call's Do method. Any
  3250. // pending HTTP request will be aborted if the provided context is
  3251. // canceled.
  3252. func (c *ProjectsRolesCreateCall) Context(ctx context.Context) *ProjectsRolesCreateCall {
  3253. c.ctx_ = ctx
  3254. return c
  3255. }
  3256. // Header returns an http.Header that can be modified by the caller to
  3257. // add HTTP headers to the request.
  3258. func (c *ProjectsRolesCreateCall) Header() http.Header {
  3259. if c.header_ == nil {
  3260. c.header_ = make(http.Header)
  3261. }
  3262. return c.header_
  3263. }
  3264. func (c *ProjectsRolesCreateCall) doRequest(alt string) (*http.Response, error) {
  3265. reqHeaders := make(http.Header)
  3266. for k, v := range c.header_ {
  3267. reqHeaders[k] = v
  3268. }
  3269. reqHeaders.Set("User-Agent", c.s.userAgent())
  3270. var body io.Reader = nil
  3271. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createrolerequest)
  3272. if err != nil {
  3273. return nil, err
  3274. }
  3275. reqHeaders.Set("Content-Type", "application/json")
  3276. c.urlParams_.Set("alt", alt)
  3277. c.urlParams_.Set("prettyPrint", "false")
  3278. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/roles")
  3279. urls += "?" + c.urlParams_.Encode()
  3280. req, err := http.NewRequest("POST", urls, body)
  3281. if err != nil {
  3282. return nil, err
  3283. }
  3284. req.Header = reqHeaders
  3285. googleapi.Expand(req.URL, map[string]string{
  3286. "parent": c.parent,
  3287. })
  3288. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3289. }
  3290. // Do executes the "iam.projects.roles.create" call.
  3291. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  3292. // code is an error. Response headers are in either
  3293. // *Role.ServerResponse.Header or (if a response was returned at all) in
  3294. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3295. // whether the returned error was because http.StatusNotModified was
  3296. // returned.
  3297. func (c *ProjectsRolesCreateCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  3298. gensupport.SetOptions(c.urlParams_, opts...)
  3299. res, err := c.doRequest("json")
  3300. if res != nil && res.StatusCode == http.StatusNotModified {
  3301. if res.Body != nil {
  3302. res.Body.Close()
  3303. }
  3304. return nil, &googleapi.Error{
  3305. Code: res.StatusCode,
  3306. Header: res.Header,
  3307. }
  3308. }
  3309. if err != nil {
  3310. return nil, err
  3311. }
  3312. defer googleapi.CloseBody(res)
  3313. if err := googleapi.CheckResponse(res); err != nil {
  3314. return nil, err
  3315. }
  3316. ret := &Role{
  3317. ServerResponse: googleapi.ServerResponse{
  3318. Header: res.Header,
  3319. HTTPStatusCode: res.StatusCode,
  3320. },
  3321. }
  3322. target := &ret
  3323. if err := gensupport.DecodeResponse(target, res); err != nil {
  3324. return nil, err
  3325. }
  3326. return ret, nil
  3327. // {
  3328. // "description": "Creates a new Role.",
  3329. // "flatPath": "v1/projects/{projectsId}/roles",
  3330. // "httpMethod": "POST",
  3331. // "id": "iam.projects.roles.create",
  3332. // "parameterOrder": [
  3333. // "parent"
  3334. // ],
  3335. // "parameters": {
  3336. // "parent": {
  3337. // "description": "The resource name of the parent resource in one of the following formats:\n`organizations/{ORGANIZATION_ID}`\n`projects/{PROJECT_ID}`",
  3338. // "location": "path",
  3339. // "pattern": "^projects/[^/]+$",
  3340. // "required": true,
  3341. // "type": "string"
  3342. // }
  3343. // },
  3344. // "path": "v1/{+parent}/roles",
  3345. // "request": {
  3346. // "$ref": "CreateRoleRequest"
  3347. // },
  3348. // "response": {
  3349. // "$ref": "Role"
  3350. // },
  3351. // "scopes": [
  3352. // "https://www.googleapis.com/auth/cloud-platform"
  3353. // ]
  3354. // }
  3355. }
  3356. // method id "iam.projects.roles.delete":
  3357. type ProjectsRolesDeleteCall struct {
  3358. s *Service
  3359. name string
  3360. urlParams_ gensupport.URLParams
  3361. ctx_ context.Context
  3362. header_ http.Header
  3363. }
  3364. // Delete: Soft deletes a role. The role is suspended and cannot be used
  3365. // to create new
  3366. // IAM Policy Bindings.
  3367. // The Role will not be included in `ListRoles()` unless `show_deleted`
  3368. // is set
  3369. // in the `ListRolesRequest`. The Role contains the deleted boolean
  3370. // set.
  3371. // Existing Bindings remains, but are inactive. The Role can be
  3372. // undeleted
  3373. // within 7 days. After 7 days the Role is deleted and all Bindings
  3374. // associated
  3375. // with the role are removed.
  3376. func (r *ProjectsRolesService) Delete(name string) *ProjectsRolesDeleteCall {
  3377. c := &ProjectsRolesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3378. c.name = name
  3379. return c
  3380. }
  3381. // Etag sets the optional parameter "etag": Used to perform a consistent
  3382. // read-modify-write.
  3383. func (c *ProjectsRolesDeleteCall) Etag(etag string) *ProjectsRolesDeleteCall {
  3384. c.urlParams_.Set("etag", etag)
  3385. return c
  3386. }
  3387. // Fields allows partial responses to be retrieved. See
  3388. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3389. // for more information.
  3390. func (c *ProjectsRolesDeleteCall) Fields(s ...googleapi.Field) *ProjectsRolesDeleteCall {
  3391. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3392. return c
  3393. }
  3394. // Context sets the context to be used in this call's Do method. Any
  3395. // pending HTTP request will be aborted if the provided context is
  3396. // canceled.
  3397. func (c *ProjectsRolesDeleteCall) Context(ctx context.Context) *ProjectsRolesDeleteCall {
  3398. c.ctx_ = ctx
  3399. return c
  3400. }
  3401. // Header returns an http.Header that can be modified by the caller to
  3402. // add HTTP headers to the request.
  3403. func (c *ProjectsRolesDeleteCall) Header() http.Header {
  3404. if c.header_ == nil {
  3405. c.header_ = make(http.Header)
  3406. }
  3407. return c.header_
  3408. }
  3409. func (c *ProjectsRolesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3410. reqHeaders := make(http.Header)
  3411. for k, v := range c.header_ {
  3412. reqHeaders[k] = v
  3413. }
  3414. reqHeaders.Set("User-Agent", c.s.userAgent())
  3415. var body io.Reader = nil
  3416. c.urlParams_.Set("alt", alt)
  3417. c.urlParams_.Set("prettyPrint", "false")
  3418. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3419. urls += "?" + c.urlParams_.Encode()
  3420. req, err := http.NewRequest("DELETE", urls, body)
  3421. if err != nil {
  3422. return nil, err
  3423. }
  3424. req.Header = reqHeaders
  3425. googleapi.Expand(req.URL, map[string]string{
  3426. "name": c.name,
  3427. })
  3428. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3429. }
  3430. // Do executes the "iam.projects.roles.delete" call.
  3431. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  3432. // code is an error. Response headers are in either
  3433. // *Role.ServerResponse.Header or (if a response was returned at all) in
  3434. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3435. // whether the returned error was because http.StatusNotModified was
  3436. // returned.
  3437. func (c *ProjectsRolesDeleteCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  3438. gensupport.SetOptions(c.urlParams_, opts...)
  3439. res, err := c.doRequest("json")
  3440. if res != nil && res.StatusCode == http.StatusNotModified {
  3441. if res.Body != nil {
  3442. res.Body.Close()
  3443. }
  3444. return nil, &googleapi.Error{
  3445. Code: res.StatusCode,
  3446. Header: res.Header,
  3447. }
  3448. }
  3449. if err != nil {
  3450. return nil, err
  3451. }
  3452. defer googleapi.CloseBody(res)
  3453. if err := googleapi.CheckResponse(res); err != nil {
  3454. return nil, err
  3455. }
  3456. ret := &Role{
  3457. ServerResponse: googleapi.ServerResponse{
  3458. Header: res.Header,
  3459. HTTPStatusCode: res.StatusCode,
  3460. },
  3461. }
  3462. target := &ret
  3463. if err := gensupport.DecodeResponse(target, res); err != nil {
  3464. return nil, err
  3465. }
  3466. return ret, nil
  3467. // {
  3468. // "description": "Soft deletes a role. The role is suspended and cannot be used to create new\nIAM Policy Bindings.\nThe Role will not be included in `ListRoles()` unless `show_deleted` is set\nin the `ListRolesRequest`. The Role contains the deleted boolean set.\nExisting Bindings remains, but are inactive. The Role can be undeleted\nwithin 7 days. After 7 days the Role is deleted and all Bindings associated\nwith the role are removed.",
  3469. // "flatPath": "v1/projects/{projectsId}/roles/{rolesId}",
  3470. // "httpMethod": "DELETE",
  3471. // "id": "iam.projects.roles.delete",
  3472. // "parameterOrder": [
  3473. // "name"
  3474. // ],
  3475. // "parameters": {
  3476. // "etag": {
  3477. // "description": "Used to perform a consistent read-modify-write.",
  3478. // "format": "byte",
  3479. // "location": "query",
  3480. // "type": "string"
  3481. // },
  3482. // "name": {
  3483. // "description": "The resource name of the role in one of the following formats:\n`organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`\n`projects/{PROJECT_ID}/roles/{ROLE_NAME}`",
  3484. // "location": "path",
  3485. // "pattern": "^projects/[^/]+/roles/[^/]+$",
  3486. // "required": true,
  3487. // "type": "string"
  3488. // }
  3489. // },
  3490. // "path": "v1/{+name}",
  3491. // "response": {
  3492. // "$ref": "Role"
  3493. // },
  3494. // "scopes": [
  3495. // "https://www.googleapis.com/auth/cloud-platform"
  3496. // ]
  3497. // }
  3498. }
  3499. // method id "iam.projects.roles.get":
  3500. type ProjectsRolesGetCall struct {
  3501. s *Service
  3502. name string
  3503. urlParams_ gensupport.URLParams
  3504. ifNoneMatch_ string
  3505. ctx_ context.Context
  3506. header_ http.Header
  3507. }
  3508. // Get: Gets a Role definition.
  3509. func (r *ProjectsRolesService) Get(name string) *ProjectsRolesGetCall {
  3510. c := &ProjectsRolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3511. c.name = name
  3512. return c
  3513. }
  3514. // Fields allows partial responses to be retrieved. See
  3515. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3516. // for more information.
  3517. func (c *ProjectsRolesGetCall) Fields(s ...googleapi.Field) *ProjectsRolesGetCall {
  3518. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3519. return c
  3520. }
  3521. // IfNoneMatch sets the optional parameter which makes the operation
  3522. // fail if the object's ETag matches the given value. This is useful for
  3523. // getting updates only after the object has changed since the last
  3524. // request. Use googleapi.IsNotModified to check whether the response
  3525. // error from Do is the result of In-None-Match.
  3526. func (c *ProjectsRolesGetCall) IfNoneMatch(entityTag string) *ProjectsRolesGetCall {
  3527. c.ifNoneMatch_ = entityTag
  3528. return c
  3529. }
  3530. // Context sets the context to be used in this call's Do method. Any
  3531. // pending HTTP request will be aborted if the provided context is
  3532. // canceled.
  3533. func (c *ProjectsRolesGetCall) Context(ctx context.Context) *ProjectsRolesGetCall {
  3534. c.ctx_ = ctx
  3535. return c
  3536. }
  3537. // Header returns an http.Header that can be modified by the caller to
  3538. // add HTTP headers to the request.
  3539. func (c *ProjectsRolesGetCall) Header() http.Header {
  3540. if c.header_ == nil {
  3541. c.header_ = make(http.Header)
  3542. }
  3543. return c.header_
  3544. }
  3545. func (c *ProjectsRolesGetCall) doRequest(alt string) (*http.Response, error) {
  3546. reqHeaders := make(http.Header)
  3547. for k, v := range c.header_ {
  3548. reqHeaders[k] = v
  3549. }
  3550. reqHeaders.Set("User-Agent", c.s.userAgent())
  3551. if c.ifNoneMatch_ != "" {
  3552. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3553. }
  3554. var body io.Reader = nil
  3555. c.urlParams_.Set("alt", alt)
  3556. c.urlParams_.Set("prettyPrint", "false")
  3557. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3558. urls += "?" + c.urlParams_.Encode()
  3559. req, err := http.NewRequest("GET", urls, body)
  3560. if err != nil {
  3561. return nil, err
  3562. }
  3563. req.Header = reqHeaders
  3564. googleapi.Expand(req.URL, map[string]string{
  3565. "name": c.name,
  3566. })
  3567. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3568. }
  3569. // Do executes the "iam.projects.roles.get" call.
  3570. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  3571. // code is an error. Response headers are in either
  3572. // *Role.ServerResponse.Header or (if a response was returned at all) in
  3573. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3574. // whether the returned error was because http.StatusNotModified was
  3575. // returned.
  3576. func (c *ProjectsRolesGetCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  3577. gensupport.SetOptions(c.urlParams_, opts...)
  3578. res, err := c.doRequest("json")
  3579. if res != nil && res.StatusCode == http.StatusNotModified {
  3580. if res.Body != nil {
  3581. res.Body.Close()
  3582. }
  3583. return nil, &googleapi.Error{
  3584. Code: res.StatusCode,
  3585. Header: res.Header,
  3586. }
  3587. }
  3588. if err != nil {
  3589. return nil, err
  3590. }
  3591. defer googleapi.CloseBody(res)
  3592. if err := googleapi.CheckResponse(res); err != nil {
  3593. return nil, err
  3594. }
  3595. ret := &Role{
  3596. ServerResponse: googleapi.ServerResponse{
  3597. Header: res.Header,
  3598. HTTPStatusCode: res.StatusCode,
  3599. },
  3600. }
  3601. target := &ret
  3602. if err := gensupport.DecodeResponse(target, res); err != nil {
  3603. return nil, err
  3604. }
  3605. return ret, nil
  3606. // {
  3607. // "description": "Gets a Role definition.",
  3608. // "flatPath": "v1/projects/{projectsId}/roles/{rolesId}",
  3609. // "httpMethod": "GET",
  3610. // "id": "iam.projects.roles.get",
  3611. // "parameterOrder": [
  3612. // "name"
  3613. // ],
  3614. // "parameters": {
  3615. // "name": {
  3616. // "description": "The resource name of the role in one of the following formats:\n`roles/{ROLE_NAME}`\n`organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`\n`projects/{PROJECT_ID}/roles/{ROLE_NAME}`",
  3617. // "location": "path",
  3618. // "pattern": "^projects/[^/]+/roles/[^/]+$",
  3619. // "required": true,
  3620. // "type": "string"
  3621. // }
  3622. // },
  3623. // "path": "v1/{+name}",
  3624. // "response": {
  3625. // "$ref": "Role"
  3626. // },
  3627. // "scopes": [
  3628. // "https://www.googleapis.com/auth/cloud-platform"
  3629. // ]
  3630. // }
  3631. }
  3632. // method id "iam.projects.roles.list":
  3633. type ProjectsRolesListCall struct {
  3634. s *Service
  3635. parent string
  3636. urlParams_ gensupport.URLParams
  3637. ifNoneMatch_ string
  3638. ctx_ context.Context
  3639. header_ http.Header
  3640. }
  3641. // List: Lists the Roles defined on a resource.
  3642. func (r *ProjectsRolesService) List(parent string) *ProjectsRolesListCall {
  3643. c := &ProjectsRolesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3644. c.parent = parent
  3645. return c
  3646. }
  3647. // PageSize sets the optional parameter "pageSize": Optional limit on
  3648. // the number of roles to include in the response.
  3649. func (c *ProjectsRolesListCall) PageSize(pageSize int64) *ProjectsRolesListCall {
  3650. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3651. return c
  3652. }
  3653. // PageToken sets the optional parameter "pageToken": Optional
  3654. // pagination token returned in an earlier ListRolesResponse.
  3655. func (c *ProjectsRolesListCall) PageToken(pageToken string) *ProjectsRolesListCall {
  3656. c.urlParams_.Set("pageToken", pageToken)
  3657. return c
  3658. }
  3659. // ShowDeleted sets the optional parameter "showDeleted": Include Roles
  3660. // that have been deleted.
  3661. func (c *ProjectsRolesListCall) ShowDeleted(showDeleted bool) *ProjectsRolesListCall {
  3662. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  3663. return c
  3664. }
  3665. // View sets the optional parameter "view": Optional view for the
  3666. // returned Role objects. When `FULL` is specified,
  3667. // the `includedPermissions` field is returned, which includes a list of
  3668. // all
  3669. // permissions in the role. The default value is `BASIC`, which does
  3670. // not
  3671. // return the `includedPermissions` field.
  3672. //
  3673. // Possible values:
  3674. // "BASIC"
  3675. // "FULL"
  3676. func (c *ProjectsRolesListCall) View(view string) *ProjectsRolesListCall {
  3677. c.urlParams_.Set("view", view)
  3678. return c
  3679. }
  3680. // Fields allows partial responses to be retrieved. See
  3681. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3682. // for more information.
  3683. func (c *ProjectsRolesListCall) Fields(s ...googleapi.Field) *ProjectsRolesListCall {
  3684. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3685. return c
  3686. }
  3687. // IfNoneMatch sets the optional parameter which makes the operation
  3688. // fail if the object's ETag matches the given value. This is useful for
  3689. // getting updates only after the object has changed since the last
  3690. // request. Use googleapi.IsNotModified to check whether the response
  3691. // error from Do is the result of In-None-Match.
  3692. func (c *ProjectsRolesListCall) IfNoneMatch(entityTag string) *ProjectsRolesListCall {
  3693. c.ifNoneMatch_ = entityTag
  3694. return c
  3695. }
  3696. // Context sets the context to be used in this call's Do method. Any
  3697. // pending HTTP request will be aborted if the provided context is
  3698. // canceled.
  3699. func (c *ProjectsRolesListCall) Context(ctx context.Context) *ProjectsRolesListCall {
  3700. c.ctx_ = ctx
  3701. return c
  3702. }
  3703. // Header returns an http.Header that can be modified by the caller to
  3704. // add HTTP headers to the request.
  3705. func (c *ProjectsRolesListCall) Header() http.Header {
  3706. if c.header_ == nil {
  3707. c.header_ = make(http.Header)
  3708. }
  3709. return c.header_
  3710. }
  3711. func (c *ProjectsRolesListCall) doRequest(alt string) (*http.Response, error) {
  3712. reqHeaders := make(http.Header)
  3713. for k, v := range c.header_ {
  3714. reqHeaders[k] = v
  3715. }
  3716. reqHeaders.Set("User-Agent", c.s.userAgent())
  3717. if c.ifNoneMatch_ != "" {
  3718. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3719. }
  3720. var body io.Reader = nil
  3721. c.urlParams_.Set("alt", alt)
  3722. c.urlParams_.Set("prettyPrint", "false")
  3723. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/roles")
  3724. urls += "?" + c.urlParams_.Encode()
  3725. req, err := http.NewRequest("GET", urls, body)
  3726. if err != nil {
  3727. return nil, err
  3728. }
  3729. req.Header = reqHeaders
  3730. googleapi.Expand(req.URL, map[string]string{
  3731. "parent": c.parent,
  3732. })
  3733. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3734. }
  3735. // Do executes the "iam.projects.roles.list" call.
  3736. // Exactly one of *ListRolesResponse or error will be non-nil. Any
  3737. // non-2xx status code is an error. Response headers are in either
  3738. // *ListRolesResponse.ServerResponse.Header or (if a response was
  3739. // returned at all) in error.(*googleapi.Error).Header. Use
  3740. // googleapi.IsNotModified to check whether the returned error was
  3741. // because http.StatusNotModified was returned.
  3742. func (c *ProjectsRolesListCall) Do(opts ...googleapi.CallOption) (*ListRolesResponse, error) {
  3743. gensupport.SetOptions(c.urlParams_, opts...)
  3744. res, err := c.doRequest("json")
  3745. if res != nil && res.StatusCode == http.StatusNotModified {
  3746. if res.Body != nil {
  3747. res.Body.Close()
  3748. }
  3749. return nil, &googleapi.Error{
  3750. Code: res.StatusCode,
  3751. Header: res.Header,
  3752. }
  3753. }
  3754. if err != nil {
  3755. return nil, err
  3756. }
  3757. defer googleapi.CloseBody(res)
  3758. if err := googleapi.CheckResponse(res); err != nil {
  3759. return nil, err
  3760. }
  3761. ret := &ListRolesResponse{
  3762. ServerResponse: googleapi.ServerResponse{
  3763. Header: res.Header,
  3764. HTTPStatusCode: res.StatusCode,
  3765. },
  3766. }
  3767. target := &ret
  3768. if err := gensupport.DecodeResponse(target, res); err != nil {
  3769. return nil, err
  3770. }
  3771. return ret, nil
  3772. // {
  3773. // "description": "Lists the Roles defined on a resource.",
  3774. // "flatPath": "v1/projects/{projectsId}/roles",
  3775. // "httpMethod": "GET",
  3776. // "id": "iam.projects.roles.list",
  3777. // "parameterOrder": [
  3778. // "parent"
  3779. // ],
  3780. // "parameters": {
  3781. // "pageSize": {
  3782. // "description": "Optional limit on the number of roles to include in the response.",
  3783. // "format": "int32",
  3784. // "location": "query",
  3785. // "type": "integer"
  3786. // },
  3787. // "pageToken": {
  3788. // "description": "Optional pagination token returned in an earlier ListRolesResponse.",
  3789. // "location": "query",
  3790. // "type": "string"
  3791. // },
  3792. // "parent": {
  3793. // "description": "The resource name of the parent resource in one of the following formats:\n`` (empty string) -- this refers to curated roles.\n`organizations/{ORGANIZATION_ID}`\n`projects/{PROJECT_ID}`",
  3794. // "location": "path",
  3795. // "pattern": "^projects/[^/]+$",
  3796. // "required": true,
  3797. // "type": "string"
  3798. // },
  3799. // "showDeleted": {
  3800. // "description": "Include Roles that have been deleted.",
  3801. // "location": "query",
  3802. // "type": "boolean"
  3803. // },
  3804. // "view": {
  3805. // "description": "Optional view for the returned Role objects. When `FULL` is specified,\nthe `includedPermissions` field is returned, which includes a list of all\npermissions in the role. The default value is `BASIC`, which does not\nreturn the `includedPermissions` field.",
  3806. // "enum": [
  3807. // "BASIC",
  3808. // "FULL"
  3809. // ],
  3810. // "location": "query",
  3811. // "type": "string"
  3812. // }
  3813. // },
  3814. // "path": "v1/{+parent}/roles",
  3815. // "response": {
  3816. // "$ref": "ListRolesResponse"
  3817. // },
  3818. // "scopes": [
  3819. // "https://www.googleapis.com/auth/cloud-platform"
  3820. // ]
  3821. // }
  3822. }
  3823. // Pages invokes f for each page of results.
  3824. // A non-nil error returned from f will halt the iteration.
  3825. // The provided context supersedes any context provided to the Context method.
  3826. func (c *ProjectsRolesListCall) Pages(ctx context.Context, f func(*ListRolesResponse) error) error {
  3827. c.ctx_ = ctx
  3828. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3829. for {
  3830. x, err := c.Do()
  3831. if err != nil {
  3832. return err
  3833. }
  3834. if err := f(x); err != nil {
  3835. return err
  3836. }
  3837. if x.NextPageToken == "" {
  3838. return nil
  3839. }
  3840. c.PageToken(x.NextPageToken)
  3841. }
  3842. }
  3843. // method id "iam.projects.roles.patch":
  3844. type ProjectsRolesPatchCall struct {
  3845. s *Service
  3846. name string
  3847. role *Role
  3848. urlParams_ gensupport.URLParams
  3849. ctx_ context.Context
  3850. header_ http.Header
  3851. }
  3852. // Patch: Updates a Role definition.
  3853. func (r *ProjectsRolesService) Patch(name string, role *Role) *ProjectsRolesPatchCall {
  3854. c := &ProjectsRolesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3855. c.name = name
  3856. c.role = role
  3857. return c
  3858. }
  3859. // UpdateMask sets the optional parameter "updateMask": A mask
  3860. // describing which fields in the Role have changed.
  3861. func (c *ProjectsRolesPatchCall) UpdateMask(updateMask string) *ProjectsRolesPatchCall {
  3862. c.urlParams_.Set("updateMask", updateMask)
  3863. return c
  3864. }
  3865. // Fields allows partial responses to be retrieved. See
  3866. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3867. // for more information.
  3868. func (c *ProjectsRolesPatchCall) Fields(s ...googleapi.Field) *ProjectsRolesPatchCall {
  3869. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3870. return c
  3871. }
  3872. // Context sets the context to be used in this call's Do method. Any
  3873. // pending HTTP request will be aborted if the provided context is
  3874. // canceled.
  3875. func (c *ProjectsRolesPatchCall) Context(ctx context.Context) *ProjectsRolesPatchCall {
  3876. c.ctx_ = ctx
  3877. return c
  3878. }
  3879. // Header returns an http.Header that can be modified by the caller to
  3880. // add HTTP headers to the request.
  3881. func (c *ProjectsRolesPatchCall) Header() http.Header {
  3882. if c.header_ == nil {
  3883. c.header_ = make(http.Header)
  3884. }
  3885. return c.header_
  3886. }
  3887. func (c *ProjectsRolesPatchCall) doRequest(alt string) (*http.Response, error) {
  3888. reqHeaders := make(http.Header)
  3889. for k, v := range c.header_ {
  3890. reqHeaders[k] = v
  3891. }
  3892. reqHeaders.Set("User-Agent", c.s.userAgent())
  3893. var body io.Reader = nil
  3894. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  3895. if err != nil {
  3896. return nil, err
  3897. }
  3898. reqHeaders.Set("Content-Type", "application/json")
  3899. c.urlParams_.Set("alt", alt)
  3900. c.urlParams_.Set("prettyPrint", "false")
  3901. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3902. urls += "?" + c.urlParams_.Encode()
  3903. req, err := http.NewRequest("PATCH", urls, body)
  3904. if err != nil {
  3905. return nil, err
  3906. }
  3907. req.Header = reqHeaders
  3908. googleapi.Expand(req.URL, map[string]string{
  3909. "name": c.name,
  3910. })
  3911. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3912. }
  3913. // Do executes the "iam.projects.roles.patch" call.
  3914. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  3915. // code is an error. Response headers are in either
  3916. // *Role.ServerResponse.Header or (if a response was returned at all) in
  3917. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3918. // whether the returned error was because http.StatusNotModified was
  3919. // returned.
  3920. func (c *ProjectsRolesPatchCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  3921. gensupport.SetOptions(c.urlParams_, opts...)
  3922. res, err := c.doRequest("json")
  3923. if res != nil && res.StatusCode == http.StatusNotModified {
  3924. if res.Body != nil {
  3925. res.Body.Close()
  3926. }
  3927. return nil, &googleapi.Error{
  3928. Code: res.StatusCode,
  3929. Header: res.Header,
  3930. }
  3931. }
  3932. if err != nil {
  3933. return nil, err
  3934. }
  3935. defer googleapi.CloseBody(res)
  3936. if err := googleapi.CheckResponse(res); err != nil {
  3937. return nil, err
  3938. }
  3939. ret := &Role{
  3940. ServerResponse: googleapi.ServerResponse{
  3941. Header: res.Header,
  3942. HTTPStatusCode: res.StatusCode,
  3943. },
  3944. }
  3945. target := &ret
  3946. if err := gensupport.DecodeResponse(target, res); err != nil {
  3947. return nil, err
  3948. }
  3949. return ret, nil
  3950. // {
  3951. // "description": "Updates a Role definition.",
  3952. // "flatPath": "v1/projects/{projectsId}/roles/{rolesId}",
  3953. // "httpMethod": "PATCH",
  3954. // "id": "iam.projects.roles.patch",
  3955. // "parameterOrder": [
  3956. // "name"
  3957. // ],
  3958. // "parameters": {
  3959. // "name": {
  3960. // "description": "The resource name of the role in one of the following formats:\n`roles/{ROLE_NAME}`\n`organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`\n`projects/{PROJECT_ID}/roles/{ROLE_NAME}`",
  3961. // "location": "path",
  3962. // "pattern": "^projects/[^/]+/roles/[^/]+$",
  3963. // "required": true,
  3964. // "type": "string"
  3965. // },
  3966. // "updateMask": {
  3967. // "description": "A mask describing which fields in the Role have changed.",
  3968. // "format": "google-fieldmask",
  3969. // "location": "query",
  3970. // "type": "string"
  3971. // }
  3972. // },
  3973. // "path": "v1/{+name}",
  3974. // "request": {
  3975. // "$ref": "Role"
  3976. // },
  3977. // "response": {
  3978. // "$ref": "Role"
  3979. // },
  3980. // "scopes": [
  3981. // "https://www.googleapis.com/auth/cloud-platform"
  3982. // ]
  3983. // }
  3984. }
  3985. // method id "iam.projects.roles.undelete":
  3986. type ProjectsRolesUndeleteCall struct {
  3987. s *Service
  3988. name string
  3989. undeleterolerequest *UndeleteRoleRequest
  3990. urlParams_ gensupport.URLParams
  3991. ctx_ context.Context
  3992. header_ http.Header
  3993. }
  3994. // Undelete: Undelete a Role, bringing it back in its previous state.
  3995. func (r *ProjectsRolesService) Undelete(name string, undeleterolerequest *UndeleteRoleRequest) *ProjectsRolesUndeleteCall {
  3996. c := &ProjectsRolesUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3997. c.name = name
  3998. c.undeleterolerequest = undeleterolerequest
  3999. return c
  4000. }
  4001. // Fields allows partial responses to be retrieved. See
  4002. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4003. // for more information.
  4004. func (c *ProjectsRolesUndeleteCall) Fields(s ...googleapi.Field) *ProjectsRolesUndeleteCall {
  4005. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4006. return c
  4007. }
  4008. // Context sets the context to be used in this call's Do method. Any
  4009. // pending HTTP request will be aborted if the provided context is
  4010. // canceled.
  4011. func (c *ProjectsRolesUndeleteCall) Context(ctx context.Context) *ProjectsRolesUndeleteCall {
  4012. c.ctx_ = ctx
  4013. return c
  4014. }
  4015. // Header returns an http.Header that can be modified by the caller to
  4016. // add HTTP headers to the request.
  4017. func (c *ProjectsRolesUndeleteCall) Header() http.Header {
  4018. if c.header_ == nil {
  4019. c.header_ = make(http.Header)
  4020. }
  4021. return c.header_
  4022. }
  4023. func (c *ProjectsRolesUndeleteCall) doRequest(alt string) (*http.Response, error) {
  4024. reqHeaders := make(http.Header)
  4025. for k, v := range c.header_ {
  4026. reqHeaders[k] = v
  4027. }
  4028. reqHeaders.Set("User-Agent", c.s.userAgent())
  4029. var body io.Reader = nil
  4030. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeleterolerequest)
  4031. if err != nil {
  4032. return nil, err
  4033. }
  4034. reqHeaders.Set("Content-Type", "application/json")
  4035. c.urlParams_.Set("alt", alt)
  4036. c.urlParams_.Set("prettyPrint", "false")
  4037. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:undelete")
  4038. urls += "?" + c.urlParams_.Encode()
  4039. req, err := http.NewRequest("POST", urls, body)
  4040. if err != nil {
  4041. return nil, err
  4042. }
  4043. req.Header = reqHeaders
  4044. googleapi.Expand(req.URL, map[string]string{
  4045. "name": c.name,
  4046. })
  4047. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4048. }
  4049. // Do executes the "iam.projects.roles.undelete" call.
  4050. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  4051. // code is an error. Response headers are in either
  4052. // *Role.ServerResponse.Header or (if a response was returned at all) in
  4053. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4054. // whether the returned error was because http.StatusNotModified was
  4055. // returned.
  4056. func (c *ProjectsRolesUndeleteCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  4057. gensupport.SetOptions(c.urlParams_, opts...)
  4058. res, err := c.doRequest("json")
  4059. if res != nil && res.StatusCode == http.StatusNotModified {
  4060. if res.Body != nil {
  4061. res.Body.Close()
  4062. }
  4063. return nil, &googleapi.Error{
  4064. Code: res.StatusCode,
  4065. Header: res.Header,
  4066. }
  4067. }
  4068. if err != nil {
  4069. return nil, err
  4070. }
  4071. defer googleapi.CloseBody(res)
  4072. if err := googleapi.CheckResponse(res); err != nil {
  4073. return nil, err
  4074. }
  4075. ret := &Role{
  4076. ServerResponse: googleapi.ServerResponse{
  4077. Header: res.Header,
  4078. HTTPStatusCode: res.StatusCode,
  4079. },
  4080. }
  4081. target := &ret
  4082. if err := gensupport.DecodeResponse(target, res); err != nil {
  4083. return nil, err
  4084. }
  4085. return ret, nil
  4086. // {
  4087. // "description": "Undelete a Role, bringing it back in its previous state.",
  4088. // "flatPath": "v1/projects/{projectsId}/roles/{rolesId}:undelete",
  4089. // "httpMethod": "POST",
  4090. // "id": "iam.projects.roles.undelete",
  4091. // "parameterOrder": [
  4092. // "name"
  4093. // ],
  4094. // "parameters": {
  4095. // "name": {
  4096. // "description": "The resource name of the role in one of the following formats:\n`organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`\n`projects/{PROJECT_ID}/roles/{ROLE_NAME}`",
  4097. // "location": "path",
  4098. // "pattern": "^projects/[^/]+/roles/[^/]+$",
  4099. // "required": true,
  4100. // "type": "string"
  4101. // }
  4102. // },
  4103. // "path": "v1/{+name}:undelete",
  4104. // "request": {
  4105. // "$ref": "UndeleteRoleRequest"
  4106. // },
  4107. // "response": {
  4108. // "$ref": "Role"
  4109. // },
  4110. // "scopes": [
  4111. // "https://www.googleapis.com/auth/cloud-platform"
  4112. // ]
  4113. // }
  4114. }
  4115. // method id "iam.projects.serviceAccounts.create":
  4116. type ProjectsServiceAccountsCreateCall struct {
  4117. s *Service
  4118. name string
  4119. createserviceaccountrequest *CreateServiceAccountRequest
  4120. urlParams_ gensupport.URLParams
  4121. ctx_ context.Context
  4122. header_ http.Header
  4123. }
  4124. // Create: Creates a ServiceAccount
  4125. // and returns it.
  4126. func (r *ProjectsServiceAccountsService) Create(name string, createserviceaccountrequest *CreateServiceAccountRequest) *ProjectsServiceAccountsCreateCall {
  4127. c := &ProjectsServiceAccountsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4128. c.name = name
  4129. c.createserviceaccountrequest = createserviceaccountrequest
  4130. return c
  4131. }
  4132. // Fields allows partial responses to be retrieved. See
  4133. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4134. // for more information.
  4135. func (c *ProjectsServiceAccountsCreateCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsCreateCall {
  4136. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4137. return c
  4138. }
  4139. // Context sets the context to be used in this call's Do method. Any
  4140. // pending HTTP request will be aborted if the provided context is
  4141. // canceled.
  4142. func (c *ProjectsServiceAccountsCreateCall) Context(ctx context.Context) *ProjectsServiceAccountsCreateCall {
  4143. c.ctx_ = ctx
  4144. return c
  4145. }
  4146. // Header returns an http.Header that can be modified by the caller to
  4147. // add HTTP headers to the request.
  4148. func (c *ProjectsServiceAccountsCreateCall) Header() http.Header {
  4149. if c.header_ == nil {
  4150. c.header_ = make(http.Header)
  4151. }
  4152. return c.header_
  4153. }
  4154. func (c *ProjectsServiceAccountsCreateCall) doRequest(alt string) (*http.Response, error) {
  4155. reqHeaders := make(http.Header)
  4156. for k, v := range c.header_ {
  4157. reqHeaders[k] = v
  4158. }
  4159. reqHeaders.Set("User-Agent", c.s.userAgent())
  4160. var body io.Reader = nil
  4161. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createserviceaccountrequest)
  4162. if err != nil {
  4163. return nil, err
  4164. }
  4165. reqHeaders.Set("Content-Type", "application/json")
  4166. c.urlParams_.Set("alt", alt)
  4167. c.urlParams_.Set("prettyPrint", "false")
  4168. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/serviceAccounts")
  4169. urls += "?" + c.urlParams_.Encode()
  4170. req, err := http.NewRequest("POST", urls, body)
  4171. if err != nil {
  4172. return nil, err
  4173. }
  4174. req.Header = reqHeaders
  4175. googleapi.Expand(req.URL, map[string]string{
  4176. "name": c.name,
  4177. })
  4178. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4179. }
  4180. // Do executes the "iam.projects.serviceAccounts.create" call.
  4181. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  4182. // status code is an error. Response headers are in either
  4183. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  4184. // at all) in error.(*googleapi.Error).Header. Use
  4185. // googleapi.IsNotModified to check whether the returned error was
  4186. // because http.StatusNotModified was returned.
  4187. func (c *ProjectsServiceAccountsCreateCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  4188. gensupport.SetOptions(c.urlParams_, opts...)
  4189. res, err := c.doRequest("json")
  4190. if res != nil && res.StatusCode == http.StatusNotModified {
  4191. if res.Body != nil {
  4192. res.Body.Close()
  4193. }
  4194. return nil, &googleapi.Error{
  4195. Code: res.StatusCode,
  4196. Header: res.Header,
  4197. }
  4198. }
  4199. if err != nil {
  4200. return nil, err
  4201. }
  4202. defer googleapi.CloseBody(res)
  4203. if err := googleapi.CheckResponse(res); err != nil {
  4204. return nil, err
  4205. }
  4206. ret := &ServiceAccount{
  4207. ServerResponse: googleapi.ServerResponse{
  4208. Header: res.Header,
  4209. HTTPStatusCode: res.StatusCode,
  4210. },
  4211. }
  4212. target := &ret
  4213. if err := gensupport.DecodeResponse(target, res); err != nil {
  4214. return nil, err
  4215. }
  4216. return ret, nil
  4217. // {
  4218. // "description": "Creates a ServiceAccount\nand returns it.",
  4219. // "flatPath": "v1/projects/{projectsId}/serviceAccounts",
  4220. // "httpMethod": "POST",
  4221. // "id": "iam.projects.serviceAccounts.create",
  4222. // "parameterOrder": [
  4223. // "name"
  4224. // ],
  4225. // "parameters": {
  4226. // "name": {
  4227. // "description": "Required. The resource name of the project associated with the service\naccounts, such as `projects/my-project-123`.",
  4228. // "location": "path",
  4229. // "pattern": "^projects/[^/]+$",
  4230. // "required": true,
  4231. // "type": "string"
  4232. // }
  4233. // },
  4234. // "path": "v1/{+name}/serviceAccounts",
  4235. // "request": {
  4236. // "$ref": "CreateServiceAccountRequest"
  4237. // },
  4238. // "response": {
  4239. // "$ref": "ServiceAccount"
  4240. // },
  4241. // "scopes": [
  4242. // "https://www.googleapis.com/auth/cloud-platform"
  4243. // ]
  4244. // }
  4245. }
  4246. // method id "iam.projects.serviceAccounts.delete":
  4247. type ProjectsServiceAccountsDeleteCall struct {
  4248. s *Service
  4249. name string
  4250. urlParams_ gensupport.URLParams
  4251. ctx_ context.Context
  4252. header_ http.Header
  4253. }
  4254. // Delete: Deletes a ServiceAccount.
  4255. func (r *ProjectsServiceAccountsService) Delete(name string) *ProjectsServiceAccountsDeleteCall {
  4256. c := &ProjectsServiceAccountsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4257. c.name = name
  4258. return c
  4259. }
  4260. // Fields allows partial responses to be retrieved. See
  4261. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4262. // for more information.
  4263. func (c *ProjectsServiceAccountsDeleteCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsDeleteCall {
  4264. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4265. return c
  4266. }
  4267. // Context sets the context to be used in this call's Do method. Any
  4268. // pending HTTP request will be aborted if the provided context is
  4269. // canceled.
  4270. func (c *ProjectsServiceAccountsDeleteCall) Context(ctx context.Context) *ProjectsServiceAccountsDeleteCall {
  4271. c.ctx_ = ctx
  4272. return c
  4273. }
  4274. // Header returns an http.Header that can be modified by the caller to
  4275. // add HTTP headers to the request.
  4276. func (c *ProjectsServiceAccountsDeleteCall) Header() http.Header {
  4277. if c.header_ == nil {
  4278. c.header_ = make(http.Header)
  4279. }
  4280. return c.header_
  4281. }
  4282. func (c *ProjectsServiceAccountsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4283. reqHeaders := make(http.Header)
  4284. for k, v := range c.header_ {
  4285. reqHeaders[k] = v
  4286. }
  4287. reqHeaders.Set("User-Agent", c.s.userAgent())
  4288. var body io.Reader = nil
  4289. c.urlParams_.Set("alt", alt)
  4290. c.urlParams_.Set("prettyPrint", "false")
  4291. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4292. urls += "?" + c.urlParams_.Encode()
  4293. req, err := http.NewRequest("DELETE", urls, body)
  4294. if err != nil {
  4295. return nil, err
  4296. }
  4297. req.Header = reqHeaders
  4298. googleapi.Expand(req.URL, map[string]string{
  4299. "name": c.name,
  4300. })
  4301. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4302. }
  4303. // Do executes the "iam.projects.serviceAccounts.delete" call.
  4304. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4305. // code is an error. Response headers are in either
  4306. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4307. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4308. // check whether the returned error was because http.StatusNotModified
  4309. // was returned.
  4310. func (c *ProjectsServiceAccountsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4311. gensupport.SetOptions(c.urlParams_, opts...)
  4312. res, err := c.doRequest("json")
  4313. if res != nil && res.StatusCode == http.StatusNotModified {
  4314. if res.Body != nil {
  4315. res.Body.Close()
  4316. }
  4317. return nil, &googleapi.Error{
  4318. Code: res.StatusCode,
  4319. Header: res.Header,
  4320. }
  4321. }
  4322. if err != nil {
  4323. return nil, err
  4324. }
  4325. defer googleapi.CloseBody(res)
  4326. if err := googleapi.CheckResponse(res); err != nil {
  4327. return nil, err
  4328. }
  4329. ret := &Empty{
  4330. ServerResponse: googleapi.ServerResponse{
  4331. Header: res.Header,
  4332. HTTPStatusCode: res.StatusCode,
  4333. },
  4334. }
  4335. target := &ret
  4336. if err := gensupport.DecodeResponse(target, res); err != nil {
  4337. return nil, err
  4338. }
  4339. return ret, nil
  4340. // {
  4341. // "description": "Deletes a ServiceAccount.",
  4342. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}",
  4343. // "httpMethod": "DELETE",
  4344. // "id": "iam.projects.serviceAccounts.delete",
  4345. // "parameterOrder": [
  4346. // "name"
  4347. // ],
  4348. // "parameters": {
  4349. // "name": {
  4350. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account. The `ACCOUNT` value can be the `email` address or the\n`unique_id` of the service account.",
  4351. // "location": "path",
  4352. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4353. // "required": true,
  4354. // "type": "string"
  4355. // }
  4356. // },
  4357. // "path": "v1/{+name}",
  4358. // "response": {
  4359. // "$ref": "Empty"
  4360. // },
  4361. // "scopes": [
  4362. // "https://www.googleapis.com/auth/cloud-platform"
  4363. // ]
  4364. // }
  4365. }
  4366. // method id "iam.projects.serviceAccounts.disable":
  4367. type ProjectsServiceAccountsDisableCall struct {
  4368. s *Service
  4369. name string
  4370. disableserviceaccountrequest *DisableServiceAccountRequest
  4371. urlParams_ gensupport.URLParams
  4372. ctx_ context.Context
  4373. header_ http.Header
  4374. }
  4375. // Disable: Disables a ServiceAccount.
  4376. // The API is currently in alpha phase.
  4377. func (r *ProjectsServiceAccountsService) Disable(name string, disableserviceaccountrequest *DisableServiceAccountRequest) *ProjectsServiceAccountsDisableCall {
  4378. c := &ProjectsServiceAccountsDisableCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4379. c.name = name
  4380. c.disableserviceaccountrequest = disableserviceaccountrequest
  4381. return c
  4382. }
  4383. // Fields allows partial responses to be retrieved. See
  4384. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4385. // for more information.
  4386. func (c *ProjectsServiceAccountsDisableCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsDisableCall {
  4387. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4388. return c
  4389. }
  4390. // Context sets the context to be used in this call's Do method. Any
  4391. // pending HTTP request will be aborted if the provided context is
  4392. // canceled.
  4393. func (c *ProjectsServiceAccountsDisableCall) Context(ctx context.Context) *ProjectsServiceAccountsDisableCall {
  4394. c.ctx_ = ctx
  4395. return c
  4396. }
  4397. // Header returns an http.Header that can be modified by the caller to
  4398. // add HTTP headers to the request.
  4399. func (c *ProjectsServiceAccountsDisableCall) Header() http.Header {
  4400. if c.header_ == nil {
  4401. c.header_ = make(http.Header)
  4402. }
  4403. return c.header_
  4404. }
  4405. func (c *ProjectsServiceAccountsDisableCall) doRequest(alt string) (*http.Response, error) {
  4406. reqHeaders := make(http.Header)
  4407. for k, v := range c.header_ {
  4408. reqHeaders[k] = v
  4409. }
  4410. reqHeaders.Set("User-Agent", c.s.userAgent())
  4411. var body io.Reader = nil
  4412. body, err := googleapi.WithoutDataWrapper.JSONReader(c.disableserviceaccountrequest)
  4413. if err != nil {
  4414. return nil, err
  4415. }
  4416. reqHeaders.Set("Content-Type", "application/json")
  4417. c.urlParams_.Set("alt", alt)
  4418. c.urlParams_.Set("prettyPrint", "false")
  4419. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:disable")
  4420. urls += "?" + c.urlParams_.Encode()
  4421. req, err := http.NewRequest("POST", urls, body)
  4422. if err != nil {
  4423. return nil, err
  4424. }
  4425. req.Header = reqHeaders
  4426. googleapi.Expand(req.URL, map[string]string{
  4427. "name": c.name,
  4428. })
  4429. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4430. }
  4431. // Do executes the "iam.projects.serviceAccounts.disable" call.
  4432. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4433. // code is an error. Response headers are in either
  4434. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4435. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4436. // check whether the returned error was because http.StatusNotModified
  4437. // was returned.
  4438. func (c *ProjectsServiceAccountsDisableCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4439. gensupport.SetOptions(c.urlParams_, opts...)
  4440. res, err := c.doRequest("json")
  4441. if res != nil && res.StatusCode == http.StatusNotModified {
  4442. if res.Body != nil {
  4443. res.Body.Close()
  4444. }
  4445. return nil, &googleapi.Error{
  4446. Code: res.StatusCode,
  4447. Header: res.Header,
  4448. }
  4449. }
  4450. if err != nil {
  4451. return nil, err
  4452. }
  4453. defer googleapi.CloseBody(res)
  4454. if err := googleapi.CheckResponse(res); err != nil {
  4455. return nil, err
  4456. }
  4457. ret := &Empty{
  4458. ServerResponse: googleapi.ServerResponse{
  4459. Header: res.Header,
  4460. HTTPStatusCode: res.StatusCode,
  4461. },
  4462. }
  4463. target := &ret
  4464. if err := gensupport.DecodeResponse(target, res); err != nil {
  4465. return nil, err
  4466. }
  4467. return ret, nil
  4468. // {
  4469. // "description": "Disables a ServiceAccount.\nThe API is currently in alpha phase.",
  4470. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:disable",
  4471. // "httpMethod": "POST",
  4472. // "id": "iam.projects.serviceAccounts.disable",
  4473. // "parameterOrder": [
  4474. // "name"
  4475. // ],
  4476. // "parameters": {
  4477. // "name": {
  4478. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account. The `ACCOUNT` value can be the `email` address or the\n`unique_id` of the service account.",
  4479. // "location": "path",
  4480. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4481. // "required": true,
  4482. // "type": "string"
  4483. // }
  4484. // },
  4485. // "path": "v1/{+name}:disable",
  4486. // "request": {
  4487. // "$ref": "DisableServiceAccountRequest"
  4488. // },
  4489. // "response": {
  4490. // "$ref": "Empty"
  4491. // },
  4492. // "scopes": [
  4493. // "https://www.googleapis.com/auth/cloud-platform"
  4494. // ]
  4495. // }
  4496. }
  4497. // method id "iam.projects.serviceAccounts.enable":
  4498. type ProjectsServiceAccountsEnableCall struct {
  4499. s *Service
  4500. name string
  4501. enableserviceaccountrequest *EnableServiceAccountRequest
  4502. urlParams_ gensupport.URLParams
  4503. ctx_ context.Context
  4504. header_ http.Header
  4505. }
  4506. // Enable: Enables a ServiceAccount.
  4507. // The API is currently in alpha phase.
  4508. func (r *ProjectsServiceAccountsService) Enable(name string, enableserviceaccountrequest *EnableServiceAccountRequest) *ProjectsServiceAccountsEnableCall {
  4509. c := &ProjectsServiceAccountsEnableCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4510. c.name = name
  4511. c.enableserviceaccountrequest = enableserviceaccountrequest
  4512. return c
  4513. }
  4514. // Fields allows partial responses to be retrieved. See
  4515. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4516. // for more information.
  4517. func (c *ProjectsServiceAccountsEnableCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsEnableCall {
  4518. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4519. return c
  4520. }
  4521. // Context sets the context to be used in this call's Do method. Any
  4522. // pending HTTP request will be aborted if the provided context is
  4523. // canceled.
  4524. func (c *ProjectsServiceAccountsEnableCall) Context(ctx context.Context) *ProjectsServiceAccountsEnableCall {
  4525. c.ctx_ = ctx
  4526. return c
  4527. }
  4528. // Header returns an http.Header that can be modified by the caller to
  4529. // add HTTP headers to the request.
  4530. func (c *ProjectsServiceAccountsEnableCall) Header() http.Header {
  4531. if c.header_ == nil {
  4532. c.header_ = make(http.Header)
  4533. }
  4534. return c.header_
  4535. }
  4536. func (c *ProjectsServiceAccountsEnableCall) doRequest(alt string) (*http.Response, error) {
  4537. reqHeaders := make(http.Header)
  4538. for k, v := range c.header_ {
  4539. reqHeaders[k] = v
  4540. }
  4541. reqHeaders.Set("User-Agent", c.s.userAgent())
  4542. var body io.Reader = nil
  4543. body, err := googleapi.WithoutDataWrapper.JSONReader(c.enableserviceaccountrequest)
  4544. if err != nil {
  4545. return nil, err
  4546. }
  4547. reqHeaders.Set("Content-Type", "application/json")
  4548. c.urlParams_.Set("alt", alt)
  4549. c.urlParams_.Set("prettyPrint", "false")
  4550. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:enable")
  4551. urls += "?" + c.urlParams_.Encode()
  4552. req, err := http.NewRequest("POST", urls, body)
  4553. if err != nil {
  4554. return nil, err
  4555. }
  4556. req.Header = reqHeaders
  4557. googleapi.Expand(req.URL, map[string]string{
  4558. "name": c.name,
  4559. })
  4560. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4561. }
  4562. // Do executes the "iam.projects.serviceAccounts.enable" call.
  4563. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4564. // code is an error. Response headers are in either
  4565. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4566. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4567. // check whether the returned error was because http.StatusNotModified
  4568. // was returned.
  4569. func (c *ProjectsServiceAccountsEnableCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4570. gensupport.SetOptions(c.urlParams_, opts...)
  4571. res, err := c.doRequest("json")
  4572. if res != nil && res.StatusCode == http.StatusNotModified {
  4573. if res.Body != nil {
  4574. res.Body.Close()
  4575. }
  4576. return nil, &googleapi.Error{
  4577. Code: res.StatusCode,
  4578. Header: res.Header,
  4579. }
  4580. }
  4581. if err != nil {
  4582. return nil, err
  4583. }
  4584. defer googleapi.CloseBody(res)
  4585. if err := googleapi.CheckResponse(res); err != nil {
  4586. return nil, err
  4587. }
  4588. ret := &Empty{
  4589. ServerResponse: googleapi.ServerResponse{
  4590. Header: res.Header,
  4591. HTTPStatusCode: res.StatusCode,
  4592. },
  4593. }
  4594. target := &ret
  4595. if err := gensupport.DecodeResponse(target, res); err != nil {
  4596. return nil, err
  4597. }
  4598. return ret, nil
  4599. // {
  4600. // "description": "Enables a ServiceAccount.\n The API is currently in alpha phase.",
  4601. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:enable",
  4602. // "httpMethod": "POST",
  4603. // "id": "iam.projects.serviceAccounts.enable",
  4604. // "parameterOrder": [
  4605. // "name"
  4606. // ],
  4607. // "parameters": {
  4608. // "name": {
  4609. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}'.\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account.",
  4610. // "location": "path",
  4611. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4612. // "required": true,
  4613. // "type": "string"
  4614. // }
  4615. // },
  4616. // "path": "v1/{+name}:enable",
  4617. // "request": {
  4618. // "$ref": "EnableServiceAccountRequest"
  4619. // },
  4620. // "response": {
  4621. // "$ref": "Empty"
  4622. // },
  4623. // "scopes": [
  4624. // "https://www.googleapis.com/auth/cloud-platform"
  4625. // ]
  4626. // }
  4627. }
  4628. // method id "iam.projects.serviceAccounts.get":
  4629. type ProjectsServiceAccountsGetCall struct {
  4630. s *Service
  4631. name string
  4632. urlParams_ gensupport.URLParams
  4633. ifNoneMatch_ string
  4634. ctx_ context.Context
  4635. header_ http.Header
  4636. }
  4637. // Get: Gets a ServiceAccount.
  4638. func (r *ProjectsServiceAccountsService) Get(name string) *ProjectsServiceAccountsGetCall {
  4639. c := &ProjectsServiceAccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4640. c.name = name
  4641. return c
  4642. }
  4643. // Fields allows partial responses to be retrieved. See
  4644. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4645. // for more information.
  4646. func (c *ProjectsServiceAccountsGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsGetCall {
  4647. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4648. return c
  4649. }
  4650. // IfNoneMatch sets the optional parameter which makes the operation
  4651. // fail if the object's ETag matches the given value. This is useful for
  4652. // getting updates only after the object has changed since the last
  4653. // request. Use googleapi.IsNotModified to check whether the response
  4654. // error from Do is the result of In-None-Match.
  4655. func (c *ProjectsServiceAccountsGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsGetCall {
  4656. c.ifNoneMatch_ = entityTag
  4657. return c
  4658. }
  4659. // Context sets the context to be used in this call's Do method. Any
  4660. // pending HTTP request will be aborted if the provided context is
  4661. // canceled.
  4662. func (c *ProjectsServiceAccountsGetCall) Context(ctx context.Context) *ProjectsServiceAccountsGetCall {
  4663. c.ctx_ = ctx
  4664. return c
  4665. }
  4666. // Header returns an http.Header that can be modified by the caller to
  4667. // add HTTP headers to the request.
  4668. func (c *ProjectsServiceAccountsGetCall) Header() http.Header {
  4669. if c.header_ == nil {
  4670. c.header_ = make(http.Header)
  4671. }
  4672. return c.header_
  4673. }
  4674. func (c *ProjectsServiceAccountsGetCall) doRequest(alt string) (*http.Response, error) {
  4675. reqHeaders := make(http.Header)
  4676. for k, v := range c.header_ {
  4677. reqHeaders[k] = v
  4678. }
  4679. reqHeaders.Set("User-Agent", c.s.userAgent())
  4680. if c.ifNoneMatch_ != "" {
  4681. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4682. }
  4683. var body io.Reader = nil
  4684. c.urlParams_.Set("alt", alt)
  4685. c.urlParams_.Set("prettyPrint", "false")
  4686. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4687. urls += "?" + c.urlParams_.Encode()
  4688. req, err := http.NewRequest("GET", urls, body)
  4689. if err != nil {
  4690. return nil, err
  4691. }
  4692. req.Header = reqHeaders
  4693. googleapi.Expand(req.URL, map[string]string{
  4694. "name": c.name,
  4695. })
  4696. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4697. }
  4698. // Do executes the "iam.projects.serviceAccounts.get" call.
  4699. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  4700. // status code is an error. Response headers are in either
  4701. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  4702. // at all) in error.(*googleapi.Error).Header. Use
  4703. // googleapi.IsNotModified to check whether the returned error was
  4704. // because http.StatusNotModified was returned.
  4705. func (c *ProjectsServiceAccountsGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  4706. gensupport.SetOptions(c.urlParams_, opts...)
  4707. res, err := c.doRequest("json")
  4708. if res != nil && res.StatusCode == http.StatusNotModified {
  4709. if res.Body != nil {
  4710. res.Body.Close()
  4711. }
  4712. return nil, &googleapi.Error{
  4713. Code: res.StatusCode,
  4714. Header: res.Header,
  4715. }
  4716. }
  4717. if err != nil {
  4718. return nil, err
  4719. }
  4720. defer googleapi.CloseBody(res)
  4721. if err := googleapi.CheckResponse(res); err != nil {
  4722. return nil, err
  4723. }
  4724. ret := &ServiceAccount{
  4725. ServerResponse: googleapi.ServerResponse{
  4726. Header: res.Header,
  4727. HTTPStatusCode: res.StatusCode,
  4728. },
  4729. }
  4730. target := &ret
  4731. if err := gensupport.DecodeResponse(target, res); err != nil {
  4732. return nil, err
  4733. }
  4734. return ret, nil
  4735. // {
  4736. // "description": "Gets a ServiceAccount.",
  4737. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}",
  4738. // "httpMethod": "GET",
  4739. // "id": "iam.projects.serviceAccounts.get",
  4740. // "parameterOrder": [
  4741. // "name"
  4742. // ],
  4743. // "parameters": {
  4744. // "name": {
  4745. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account. The `ACCOUNT` value can be the `email` address or the\n`unique_id` of the service account.",
  4746. // "location": "path",
  4747. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4748. // "required": true,
  4749. // "type": "string"
  4750. // }
  4751. // },
  4752. // "path": "v1/{+name}",
  4753. // "response": {
  4754. // "$ref": "ServiceAccount"
  4755. // },
  4756. // "scopes": [
  4757. // "https://www.googleapis.com/auth/cloud-platform"
  4758. // ]
  4759. // }
  4760. }
  4761. // method id "iam.projects.serviceAccounts.getIamPolicy":
  4762. type ProjectsServiceAccountsGetIamPolicyCall struct {
  4763. s *Service
  4764. resource string
  4765. urlParams_ gensupport.URLParams
  4766. ctx_ context.Context
  4767. header_ http.Header
  4768. }
  4769. // GetIamPolicy: Returns the Cloud IAM access control policy for
  4770. // a
  4771. // ServiceAccount.
  4772. //
  4773. // Note: Service accounts are both
  4774. // [resources
  4775. // and
  4776. // identities](/iam/docs/service-accounts#service_account_permissions
  4777. // ). This
  4778. // method treats the service account as a resource. It returns the Cloud
  4779. // IAM
  4780. // policy that reflects what members have access to the service
  4781. // account.
  4782. //
  4783. // This method does not return what resources the service account has
  4784. // access
  4785. // to. To see if a service account has access to a resource, call
  4786. // the
  4787. // `getIamPolicy` method on the target resource. For example, to view
  4788. // grants
  4789. // for a project, call
  4790. // the
  4791. // [projects.getIamPolicy](/resource-manager/reference/rest/v1/projec
  4792. // ts/getIamPolicy)
  4793. // method.
  4794. func (r *ProjectsServiceAccountsService) GetIamPolicy(resource string) *ProjectsServiceAccountsGetIamPolicyCall {
  4795. c := &ProjectsServiceAccountsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4796. c.resource = resource
  4797. return c
  4798. }
  4799. // Fields allows partial responses to be retrieved. See
  4800. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4801. // for more information.
  4802. func (c *ProjectsServiceAccountsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsGetIamPolicyCall {
  4803. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4804. return c
  4805. }
  4806. // Context sets the context to be used in this call's Do method. Any
  4807. // pending HTTP request will be aborted if the provided context is
  4808. // canceled.
  4809. func (c *ProjectsServiceAccountsGetIamPolicyCall) Context(ctx context.Context) *ProjectsServiceAccountsGetIamPolicyCall {
  4810. c.ctx_ = ctx
  4811. return c
  4812. }
  4813. // Header returns an http.Header that can be modified by the caller to
  4814. // add HTTP headers to the request.
  4815. func (c *ProjectsServiceAccountsGetIamPolicyCall) Header() http.Header {
  4816. if c.header_ == nil {
  4817. c.header_ = make(http.Header)
  4818. }
  4819. return c.header_
  4820. }
  4821. func (c *ProjectsServiceAccountsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4822. reqHeaders := make(http.Header)
  4823. for k, v := range c.header_ {
  4824. reqHeaders[k] = v
  4825. }
  4826. reqHeaders.Set("User-Agent", c.s.userAgent())
  4827. var body io.Reader = nil
  4828. c.urlParams_.Set("alt", alt)
  4829. c.urlParams_.Set("prettyPrint", "false")
  4830. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  4831. urls += "?" + c.urlParams_.Encode()
  4832. req, err := http.NewRequest("POST", urls, body)
  4833. if err != nil {
  4834. return nil, err
  4835. }
  4836. req.Header = reqHeaders
  4837. googleapi.Expand(req.URL, map[string]string{
  4838. "resource": c.resource,
  4839. })
  4840. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4841. }
  4842. // Do executes the "iam.projects.serviceAccounts.getIamPolicy" call.
  4843. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4844. // code is an error. Response headers are in either
  4845. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4846. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4847. // check whether the returned error was because http.StatusNotModified
  4848. // was returned.
  4849. func (c *ProjectsServiceAccountsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4850. gensupport.SetOptions(c.urlParams_, opts...)
  4851. res, err := c.doRequest("json")
  4852. if res != nil && res.StatusCode == http.StatusNotModified {
  4853. if res.Body != nil {
  4854. res.Body.Close()
  4855. }
  4856. return nil, &googleapi.Error{
  4857. Code: res.StatusCode,
  4858. Header: res.Header,
  4859. }
  4860. }
  4861. if err != nil {
  4862. return nil, err
  4863. }
  4864. defer googleapi.CloseBody(res)
  4865. if err := googleapi.CheckResponse(res); err != nil {
  4866. return nil, err
  4867. }
  4868. ret := &Policy{
  4869. ServerResponse: googleapi.ServerResponse{
  4870. Header: res.Header,
  4871. HTTPStatusCode: res.StatusCode,
  4872. },
  4873. }
  4874. target := &ret
  4875. if err := gensupport.DecodeResponse(target, res); err != nil {
  4876. return nil, err
  4877. }
  4878. return ret, nil
  4879. // {
  4880. // "description": "Returns the Cloud IAM access control policy for a\nServiceAccount.\n\nNote: Service accounts are both\n[resources and\nidentities](/iam/docs/service-accounts#service_account_permissions). This\nmethod treats the service account as a resource. It returns the Cloud IAM\npolicy that reflects what members have access to the service account.\n\nThis method does not return what resources the service account has access\nto. To see if a service account has access to a resource, call the\n`getIamPolicy` method on the target resource. For example, to view grants\nfor a project, call the\n[projects.getIamPolicy](/resource-manager/reference/rest/v1/projects/getIamPolicy)\nmethod.",
  4881. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:getIamPolicy",
  4882. // "httpMethod": "POST",
  4883. // "id": "iam.projects.serviceAccounts.getIamPolicy",
  4884. // "parameterOrder": [
  4885. // "resource"
  4886. // ],
  4887. // "parameters": {
  4888. // "resource": {
  4889. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  4890. // "location": "path",
  4891. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4892. // "required": true,
  4893. // "type": "string"
  4894. // }
  4895. // },
  4896. // "path": "v1/{+resource}:getIamPolicy",
  4897. // "response": {
  4898. // "$ref": "Policy"
  4899. // },
  4900. // "scopes": [
  4901. // "https://www.googleapis.com/auth/cloud-platform"
  4902. // ]
  4903. // }
  4904. }
  4905. // method id "iam.projects.serviceAccounts.list":
  4906. type ProjectsServiceAccountsListCall struct {
  4907. s *Service
  4908. name string
  4909. urlParams_ gensupport.URLParams
  4910. ifNoneMatch_ string
  4911. ctx_ context.Context
  4912. header_ http.Header
  4913. }
  4914. // List: Lists ServiceAccounts for a project.
  4915. func (r *ProjectsServiceAccountsService) List(name string) *ProjectsServiceAccountsListCall {
  4916. c := &ProjectsServiceAccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4917. c.name = name
  4918. return c
  4919. }
  4920. // PageSize sets the optional parameter "pageSize": Optional limit on
  4921. // the number of service accounts to include in the
  4922. // response. Further accounts can subsequently be obtained by including
  4923. // the
  4924. // ListServiceAccountsResponse.next_page_token
  4925. // in a subsequent request.
  4926. func (c *ProjectsServiceAccountsListCall) PageSize(pageSize int64) *ProjectsServiceAccountsListCall {
  4927. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4928. return c
  4929. }
  4930. // PageToken sets the optional parameter "pageToken": Optional
  4931. // pagination token returned in an
  4932. // earlier
  4933. // ListServiceAccountsResponse.next_page_token.
  4934. func (c *ProjectsServiceAccountsListCall) PageToken(pageToken string) *ProjectsServiceAccountsListCall {
  4935. c.urlParams_.Set("pageToken", pageToken)
  4936. return c
  4937. }
  4938. // Fields allows partial responses to be retrieved. See
  4939. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4940. // for more information.
  4941. func (c *ProjectsServiceAccountsListCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsListCall {
  4942. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4943. return c
  4944. }
  4945. // IfNoneMatch sets the optional parameter which makes the operation
  4946. // fail if the object's ETag matches the given value. This is useful for
  4947. // getting updates only after the object has changed since the last
  4948. // request. Use googleapi.IsNotModified to check whether the response
  4949. // error from Do is the result of In-None-Match.
  4950. func (c *ProjectsServiceAccountsListCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsListCall {
  4951. c.ifNoneMatch_ = entityTag
  4952. return c
  4953. }
  4954. // Context sets the context to be used in this call's Do method. Any
  4955. // pending HTTP request will be aborted if the provided context is
  4956. // canceled.
  4957. func (c *ProjectsServiceAccountsListCall) Context(ctx context.Context) *ProjectsServiceAccountsListCall {
  4958. c.ctx_ = ctx
  4959. return c
  4960. }
  4961. // Header returns an http.Header that can be modified by the caller to
  4962. // add HTTP headers to the request.
  4963. func (c *ProjectsServiceAccountsListCall) Header() http.Header {
  4964. if c.header_ == nil {
  4965. c.header_ = make(http.Header)
  4966. }
  4967. return c.header_
  4968. }
  4969. func (c *ProjectsServiceAccountsListCall) doRequest(alt string) (*http.Response, error) {
  4970. reqHeaders := make(http.Header)
  4971. for k, v := range c.header_ {
  4972. reqHeaders[k] = v
  4973. }
  4974. reqHeaders.Set("User-Agent", c.s.userAgent())
  4975. if c.ifNoneMatch_ != "" {
  4976. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4977. }
  4978. var body io.Reader = nil
  4979. c.urlParams_.Set("alt", alt)
  4980. c.urlParams_.Set("prettyPrint", "false")
  4981. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/serviceAccounts")
  4982. urls += "?" + c.urlParams_.Encode()
  4983. req, err := http.NewRequest("GET", urls, body)
  4984. if err != nil {
  4985. return nil, err
  4986. }
  4987. req.Header = reqHeaders
  4988. googleapi.Expand(req.URL, map[string]string{
  4989. "name": c.name,
  4990. })
  4991. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4992. }
  4993. // Do executes the "iam.projects.serviceAccounts.list" call.
  4994. // Exactly one of *ListServiceAccountsResponse or error will be non-nil.
  4995. // Any non-2xx status code is an error. Response headers are in either
  4996. // *ListServiceAccountsResponse.ServerResponse.Header or (if a response
  4997. // was returned at all) in error.(*googleapi.Error).Header. Use
  4998. // googleapi.IsNotModified to check whether the returned error was
  4999. // because http.StatusNotModified was returned.
  5000. func (c *ProjectsServiceAccountsListCall) Do(opts ...googleapi.CallOption) (*ListServiceAccountsResponse, error) {
  5001. gensupport.SetOptions(c.urlParams_, opts...)
  5002. res, err := c.doRequest("json")
  5003. if res != nil && res.StatusCode == http.StatusNotModified {
  5004. if res.Body != nil {
  5005. res.Body.Close()
  5006. }
  5007. return nil, &googleapi.Error{
  5008. Code: res.StatusCode,
  5009. Header: res.Header,
  5010. }
  5011. }
  5012. if err != nil {
  5013. return nil, err
  5014. }
  5015. defer googleapi.CloseBody(res)
  5016. if err := googleapi.CheckResponse(res); err != nil {
  5017. return nil, err
  5018. }
  5019. ret := &ListServiceAccountsResponse{
  5020. ServerResponse: googleapi.ServerResponse{
  5021. Header: res.Header,
  5022. HTTPStatusCode: res.StatusCode,
  5023. },
  5024. }
  5025. target := &ret
  5026. if err := gensupport.DecodeResponse(target, res); err != nil {
  5027. return nil, err
  5028. }
  5029. return ret, nil
  5030. // {
  5031. // "description": "Lists ServiceAccounts for a project.",
  5032. // "flatPath": "v1/projects/{projectsId}/serviceAccounts",
  5033. // "httpMethod": "GET",
  5034. // "id": "iam.projects.serviceAccounts.list",
  5035. // "parameterOrder": [
  5036. // "name"
  5037. // ],
  5038. // "parameters": {
  5039. // "name": {
  5040. // "description": "Required. The resource name of the project associated with the service\naccounts, such as `projects/my-project-123`.",
  5041. // "location": "path",
  5042. // "pattern": "^projects/[^/]+$",
  5043. // "required": true,
  5044. // "type": "string"
  5045. // },
  5046. // "pageSize": {
  5047. // "description": "Optional limit on the number of service accounts to include in the\nresponse. Further accounts can subsequently be obtained by including the\nListServiceAccountsResponse.next_page_token\nin a subsequent request.",
  5048. // "format": "int32",
  5049. // "location": "query",
  5050. // "type": "integer"
  5051. // },
  5052. // "pageToken": {
  5053. // "description": "Optional pagination token returned in an earlier\nListServiceAccountsResponse.next_page_token.",
  5054. // "location": "query",
  5055. // "type": "string"
  5056. // }
  5057. // },
  5058. // "path": "v1/{+name}/serviceAccounts",
  5059. // "response": {
  5060. // "$ref": "ListServiceAccountsResponse"
  5061. // },
  5062. // "scopes": [
  5063. // "https://www.googleapis.com/auth/cloud-platform"
  5064. // ]
  5065. // }
  5066. }
  5067. // Pages invokes f for each page of results.
  5068. // A non-nil error returned from f will halt the iteration.
  5069. // The provided context supersedes any context provided to the Context method.
  5070. func (c *ProjectsServiceAccountsListCall) Pages(ctx context.Context, f func(*ListServiceAccountsResponse) error) error {
  5071. c.ctx_ = ctx
  5072. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5073. for {
  5074. x, err := c.Do()
  5075. if err != nil {
  5076. return err
  5077. }
  5078. if err := f(x); err != nil {
  5079. return err
  5080. }
  5081. if x.NextPageToken == "" {
  5082. return nil
  5083. }
  5084. c.PageToken(x.NextPageToken)
  5085. }
  5086. }
  5087. // method id "iam.projects.serviceAccounts.patch":
  5088. type ProjectsServiceAccountsPatchCall struct {
  5089. s *Service
  5090. name string
  5091. patchserviceaccountrequest *PatchServiceAccountRequest
  5092. urlParams_ gensupport.URLParams
  5093. ctx_ context.Context
  5094. header_ http.Header
  5095. }
  5096. // Patch: Patches a ServiceAccount.
  5097. //
  5098. // Currently, only the following fields are updatable:
  5099. // `display_name` and `description`.
  5100. //
  5101. // Only fields specified in the request are guaranteed to be returned
  5102. // in
  5103. // the response. Other fields in the response may be empty.
  5104. //
  5105. // Note: The field mask is required.
  5106. func (r *ProjectsServiceAccountsService) Patch(name string, patchserviceaccountrequest *PatchServiceAccountRequest) *ProjectsServiceAccountsPatchCall {
  5107. c := &ProjectsServiceAccountsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5108. c.name = name
  5109. c.patchserviceaccountrequest = patchserviceaccountrequest
  5110. return c
  5111. }
  5112. // Fields allows partial responses to be retrieved. See
  5113. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5114. // for more information.
  5115. func (c *ProjectsServiceAccountsPatchCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsPatchCall {
  5116. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5117. return c
  5118. }
  5119. // Context sets the context to be used in this call's Do method. Any
  5120. // pending HTTP request will be aborted if the provided context is
  5121. // canceled.
  5122. func (c *ProjectsServiceAccountsPatchCall) Context(ctx context.Context) *ProjectsServiceAccountsPatchCall {
  5123. c.ctx_ = ctx
  5124. return c
  5125. }
  5126. // Header returns an http.Header that can be modified by the caller to
  5127. // add HTTP headers to the request.
  5128. func (c *ProjectsServiceAccountsPatchCall) Header() http.Header {
  5129. if c.header_ == nil {
  5130. c.header_ = make(http.Header)
  5131. }
  5132. return c.header_
  5133. }
  5134. func (c *ProjectsServiceAccountsPatchCall) doRequest(alt string) (*http.Response, error) {
  5135. reqHeaders := make(http.Header)
  5136. for k, v := range c.header_ {
  5137. reqHeaders[k] = v
  5138. }
  5139. reqHeaders.Set("User-Agent", c.s.userAgent())
  5140. var body io.Reader = nil
  5141. body, err := googleapi.WithoutDataWrapper.JSONReader(c.patchserviceaccountrequest)
  5142. if err != nil {
  5143. return nil, err
  5144. }
  5145. reqHeaders.Set("Content-Type", "application/json")
  5146. c.urlParams_.Set("alt", alt)
  5147. c.urlParams_.Set("prettyPrint", "false")
  5148. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5149. urls += "?" + c.urlParams_.Encode()
  5150. req, err := http.NewRequest("PATCH", urls, body)
  5151. if err != nil {
  5152. return nil, err
  5153. }
  5154. req.Header = reqHeaders
  5155. googleapi.Expand(req.URL, map[string]string{
  5156. "name": c.name,
  5157. })
  5158. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5159. }
  5160. // Do executes the "iam.projects.serviceAccounts.patch" call.
  5161. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  5162. // status code is an error. Response headers are in either
  5163. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  5164. // at all) in error.(*googleapi.Error).Header. Use
  5165. // googleapi.IsNotModified to check whether the returned error was
  5166. // because http.StatusNotModified was returned.
  5167. func (c *ProjectsServiceAccountsPatchCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  5168. gensupport.SetOptions(c.urlParams_, opts...)
  5169. res, err := c.doRequest("json")
  5170. if res != nil && res.StatusCode == http.StatusNotModified {
  5171. if res.Body != nil {
  5172. res.Body.Close()
  5173. }
  5174. return nil, &googleapi.Error{
  5175. Code: res.StatusCode,
  5176. Header: res.Header,
  5177. }
  5178. }
  5179. if err != nil {
  5180. return nil, err
  5181. }
  5182. defer googleapi.CloseBody(res)
  5183. if err := googleapi.CheckResponse(res); err != nil {
  5184. return nil, err
  5185. }
  5186. ret := &ServiceAccount{
  5187. ServerResponse: googleapi.ServerResponse{
  5188. Header: res.Header,
  5189. HTTPStatusCode: res.StatusCode,
  5190. },
  5191. }
  5192. target := &ret
  5193. if err := gensupport.DecodeResponse(target, res); err != nil {
  5194. return nil, err
  5195. }
  5196. return ret, nil
  5197. // {
  5198. // "description": "Patches a ServiceAccount.\n\nCurrently, only the following fields are updatable:\n`display_name` and `description`.\n\nOnly fields specified in the request are guaranteed to be returned in\nthe response. Other fields in the response may be empty.\n\nNote: The field mask is required.",
  5199. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}",
  5200. // "httpMethod": "PATCH",
  5201. // "id": "iam.projects.serviceAccounts.patch",
  5202. // "parameterOrder": [
  5203. // "name"
  5204. // ],
  5205. // "parameters": {
  5206. // "name": {
  5207. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.\n\nRequests using `-` as a wildcard for the `PROJECT_ID` will infer the\nproject from the `account` and the `ACCOUNT` value can be the `email`\naddress or the `unique_id` of the service account.\n\nIn responses the resource name will always be in the format\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.",
  5208. // "location": "path",
  5209. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  5210. // "required": true,
  5211. // "type": "string"
  5212. // }
  5213. // },
  5214. // "path": "v1/{+name}",
  5215. // "request": {
  5216. // "$ref": "PatchServiceAccountRequest"
  5217. // },
  5218. // "response": {
  5219. // "$ref": "ServiceAccount"
  5220. // },
  5221. // "scopes": [
  5222. // "https://www.googleapis.com/auth/cloud-platform"
  5223. // ]
  5224. // }
  5225. }
  5226. // method id "iam.projects.serviceAccounts.setIamPolicy":
  5227. type ProjectsServiceAccountsSetIamPolicyCall struct {
  5228. s *Service
  5229. resource string
  5230. setiampolicyrequest *SetIamPolicyRequest
  5231. urlParams_ gensupport.URLParams
  5232. ctx_ context.Context
  5233. header_ http.Header
  5234. }
  5235. // SetIamPolicy: Sets the Cloud IAM access control policy for
  5236. // a
  5237. // ServiceAccount.
  5238. //
  5239. // Note: Service accounts are both
  5240. // [resources
  5241. // and
  5242. // identities](/iam/docs/service-accounts#service_account_permissions
  5243. // ). This
  5244. // method treats the service account as a resource. Use it to grant
  5245. // members
  5246. // access to the service account, such as when they need to impersonate
  5247. // it.
  5248. //
  5249. // This method does not grant the service account access to other
  5250. // resources,
  5251. // such as projects. To grant a service account access to resources,
  5252. // include
  5253. // the service account in the Cloud IAM policy for the desired resource,
  5254. // then
  5255. // call the appropriate `setIamPolicy` method on the target resource.
  5256. // For
  5257. // example, to grant a service account access to a project, call
  5258. // the
  5259. // [projects.setIamPolicy](/resource-manager/reference/rest/v1/projec
  5260. // ts/setIamPolicy)
  5261. // method.
  5262. func (r *ProjectsServiceAccountsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsServiceAccountsSetIamPolicyCall {
  5263. c := &ProjectsServiceAccountsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5264. c.resource = resource
  5265. c.setiampolicyrequest = setiampolicyrequest
  5266. return c
  5267. }
  5268. // Fields allows partial responses to be retrieved. See
  5269. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5270. // for more information.
  5271. func (c *ProjectsServiceAccountsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSetIamPolicyCall {
  5272. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5273. return c
  5274. }
  5275. // Context sets the context to be used in this call's Do method. Any
  5276. // pending HTTP request will be aborted if the provided context is
  5277. // canceled.
  5278. func (c *ProjectsServiceAccountsSetIamPolicyCall) Context(ctx context.Context) *ProjectsServiceAccountsSetIamPolicyCall {
  5279. c.ctx_ = ctx
  5280. return c
  5281. }
  5282. // Header returns an http.Header that can be modified by the caller to
  5283. // add HTTP headers to the request.
  5284. func (c *ProjectsServiceAccountsSetIamPolicyCall) Header() http.Header {
  5285. if c.header_ == nil {
  5286. c.header_ = make(http.Header)
  5287. }
  5288. return c.header_
  5289. }
  5290. func (c *ProjectsServiceAccountsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5291. reqHeaders := make(http.Header)
  5292. for k, v := range c.header_ {
  5293. reqHeaders[k] = v
  5294. }
  5295. reqHeaders.Set("User-Agent", c.s.userAgent())
  5296. var body io.Reader = nil
  5297. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  5298. if err != nil {
  5299. return nil, err
  5300. }
  5301. reqHeaders.Set("Content-Type", "application/json")
  5302. c.urlParams_.Set("alt", alt)
  5303. c.urlParams_.Set("prettyPrint", "false")
  5304. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  5305. urls += "?" + c.urlParams_.Encode()
  5306. req, err := http.NewRequest("POST", urls, body)
  5307. if err != nil {
  5308. return nil, err
  5309. }
  5310. req.Header = reqHeaders
  5311. googleapi.Expand(req.URL, map[string]string{
  5312. "resource": c.resource,
  5313. })
  5314. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5315. }
  5316. // Do executes the "iam.projects.serviceAccounts.setIamPolicy" call.
  5317. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5318. // code is an error. Response headers are in either
  5319. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5320. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5321. // check whether the returned error was because http.StatusNotModified
  5322. // was returned.
  5323. func (c *ProjectsServiceAccountsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5324. gensupport.SetOptions(c.urlParams_, opts...)
  5325. res, err := c.doRequest("json")
  5326. if res != nil && res.StatusCode == http.StatusNotModified {
  5327. if res.Body != nil {
  5328. res.Body.Close()
  5329. }
  5330. return nil, &googleapi.Error{
  5331. Code: res.StatusCode,
  5332. Header: res.Header,
  5333. }
  5334. }
  5335. if err != nil {
  5336. return nil, err
  5337. }
  5338. defer googleapi.CloseBody(res)
  5339. if err := googleapi.CheckResponse(res); err != nil {
  5340. return nil, err
  5341. }
  5342. ret := &Policy{
  5343. ServerResponse: googleapi.ServerResponse{
  5344. Header: res.Header,
  5345. HTTPStatusCode: res.StatusCode,
  5346. },
  5347. }
  5348. target := &ret
  5349. if err := gensupport.DecodeResponse(target, res); err != nil {
  5350. return nil, err
  5351. }
  5352. return ret, nil
  5353. // {
  5354. // "description": "Sets the Cloud IAM access control policy for a\nServiceAccount.\n\nNote: Service accounts are both\n[resources and\nidentities](/iam/docs/service-accounts#service_account_permissions). This\nmethod treats the service account as a resource. Use it to grant members\naccess to the service account, such as when they need to impersonate it.\n\nThis method does not grant the service account access to other resources,\nsuch as projects. To grant a service account access to resources, include\nthe service account in the Cloud IAM policy for the desired resource, then\ncall the appropriate `setIamPolicy` method on the target resource. For\nexample, to grant a service account access to a project, call the\n[projects.setIamPolicy](/resource-manager/reference/rest/v1/projects/setIamPolicy)\nmethod.",
  5355. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:setIamPolicy",
  5356. // "httpMethod": "POST",
  5357. // "id": "iam.projects.serviceAccounts.setIamPolicy",
  5358. // "parameterOrder": [
  5359. // "resource"
  5360. // ],
  5361. // "parameters": {
  5362. // "resource": {
  5363. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  5364. // "location": "path",
  5365. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  5366. // "required": true,
  5367. // "type": "string"
  5368. // }
  5369. // },
  5370. // "path": "v1/{+resource}:setIamPolicy",
  5371. // "request": {
  5372. // "$ref": "SetIamPolicyRequest"
  5373. // },
  5374. // "response": {
  5375. // "$ref": "Policy"
  5376. // },
  5377. // "scopes": [
  5378. // "https://www.googleapis.com/auth/cloud-platform"
  5379. // ]
  5380. // }
  5381. }
  5382. // method id "iam.projects.serviceAccounts.signBlob":
  5383. type ProjectsServiceAccountsSignBlobCall struct {
  5384. s *Service
  5385. name string
  5386. signblobrequest *SignBlobRequest
  5387. urlParams_ gensupport.URLParams
  5388. ctx_ context.Context
  5389. header_ http.Header
  5390. }
  5391. // SignBlob: **Note**: This method is in the process of being
  5392. // deprecated. Call
  5393. // the
  5394. // [`signBlob()`](/iam/credentials/reference/rest/v1/projects.service
  5395. // Accounts/signBlob)
  5396. // method of the Cloud IAM Service Account Credentials API
  5397. // instead.
  5398. //
  5399. // Signs a blob using a service account's system-managed private key.
  5400. func (r *ProjectsServiceAccountsService) SignBlob(name string, signblobrequest *SignBlobRequest) *ProjectsServiceAccountsSignBlobCall {
  5401. c := &ProjectsServiceAccountsSignBlobCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5402. c.name = name
  5403. c.signblobrequest = signblobrequest
  5404. return c
  5405. }
  5406. // Fields allows partial responses to be retrieved. See
  5407. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5408. // for more information.
  5409. func (c *ProjectsServiceAccountsSignBlobCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSignBlobCall {
  5410. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5411. return c
  5412. }
  5413. // Context sets the context to be used in this call's Do method. Any
  5414. // pending HTTP request will be aborted if the provided context is
  5415. // canceled.
  5416. func (c *ProjectsServiceAccountsSignBlobCall) Context(ctx context.Context) *ProjectsServiceAccountsSignBlobCall {
  5417. c.ctx_ = ctx
  5418. return c
  5419. }
  5420. // Header returns an http.Header that can be modified by the caller to
  5421. // add HTTP headers to the request.
  5422. func (c *ProjectsServiceAccountsSignBlobCall) Header() http.Header {
  5423. if c.header_ == nil {
  5424. c.header_ = make(http.Header)
  5425. }
  5426. return c.header_
  5427. }
  5428. func (c *ProjectsServiceAccountsSignBlobCall) doRequest(alt string) (*http.Response, error) {
  5429. reqHeaders := make(http.Header)
  5430. for k, v := range c.header_ {
  5431. reqHeaders[k] = v
  5432. }
  5433. reqHeaders.Set("User-Agent", c.s.userAgent())
  5434. var body io.Reader = nil
  5435. body, err := googleapi.WithoutDataWrapper.JSONReader(c.signblobrequest)
  5436. if err != nil {
  5437. return nil, err
  5438. }
  5439. reqHeaders.Set("Content-Type", "application/json")
  5440. c.urlParams_.Set("alt", alt)
  5441. c.urlParams_.Set("prettyPrint", "false")
  5442. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:signBlob")
  5443. urls += "?" + c.urlParams_.Encode()
  5444. req, err := http.NewRequest("POST", urls, body)
  5445. if err != nil {
  5446. return nil, err
  5447. }
  5448. req.Header = reqHeaders
  5449. googleapi.Expand(req.URL, map[string]string{
  5450. "name": c.name,
  5451. })
  5452. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5453. }
  5454. // Do executes the "iam.projects.serviceAccounts.signBlob" call.
  5455. // Exactly one of *SignBlobResponse or error will be non-nil. Any
  5456. // non-2xx status code is an error. Response headers are in either
  5457. // *SignBlobResponse.ServerResponse.Header or (if a response was
  5458. // returned at all) in error.(*googleapi.Error).Header. Use
  5459. // googleapi.IsNotModified to check whether the returned error was
  5460. // because http.StatusNotModified was returned.
  5461. func (c *ProjectsServiceAccountsSignBlobCall) Do(opts ...googleapi.CallOption) (*SignBlobResponse, error) {
  5462. gensupport.SetOptions(c.urlParams_, opts...)
  5463. res, err := c.doRequest("json")
  5464. if res != nil && res.StatusCode == http.StatusNotModified {
  5465. if res.Body != nil {
  5466. res.Body.Close()
  5467. }
  5468. return nil, &googleapi.Error{
  5469. Code: res.StatusCode,
  5470. Header: res.Header,
  5471. }
  5472. }
  5473. if err != nil {
  5474. return nil, err
  5475. }
  5476. defer googleapi.CloseBody(res)
  5477. if err := googleapi.CheckResponse(res); err != nil {
  5478. return nil, err
  5479. }
  5480. ret := &SignBlobResponse{
  5481. ServerResponse: googleapi.ServerResponse{
  5482. Header: res.Header,
  5483. HTTPStatusCode: res.StatusCode,
  5484. },
  5485. }
  5486. target := &ret
  5487. if err := gensupport.DecodeResponse(target, res); err != nil {
  5488. return nil, err
  5489. }
  5490. return ret, nil
  5491. // {
  5492. // "description": "**Note**: This method is in the process of being deprecated. Call the\n[`signBlob()`](/iam/credentials/reference/rest/v1/projects.serviceAccounts/signBlob)\nmethod of the Cloud IAM Service Account Credentials API instead.\n\nSigns a blob using a service account's system-managed private key.",
  5493. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signBlob",
  5494. // "httpMethod": "POST",
  5495. // "id": "iam.projects.serviceAccounts.signBlob",
  5496. // "parameterOrder": [
  5497. // "name"
  5498. // ],
  5499. // "parameters": {
  5500. // "name": {
  5501. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account. The `ACCOUNT` value can be the `email` address or the\n`unique_id` of the service account.",
  5502. // "location": "path",
  5503. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  5504. // "required": true,
  5505. // "type": "string"
  5506. // }
  5507. // },
  5508. // "path": "v1/{+name}:signBlob",
  5509. // "request": {
  5510. // "$ref": "SignBlobRequest"
  5511. // },
  5512. // "response": {
  5513. // "$ref": "SignBlobResponse"
  5514. // },
  5515. // "scopes": [
  5516. // "https://www.googleapis.com/auth/cloud-platform"
  5517. // ]
  5518. // }
  5519. }
  5520. // method id "iam.projects.serviceAccounts.signJwt":
  5521. type ProjectsServiceAccountsSignJwtCall struct {
  5522. s *Service
  5523. name string
  5524. signjwtrequest *SignJwtRequest
  5525. urlParams_ gensupport.URLParams
  5526. ctx_ context.Context
  5527. header_ http.Header
  5528. }
  5529. // SignJwt: **Note**: This method is in the process of being deprecated.
  5530. // Call
  5531. // the
  5532. // [`signJwt()`](/iam/credentials/reference/rest/v1/projects.serviceA
  5533. // ccounts/signJwt)
  5534. // method of the Cloud IAM Service Account Credentials API
  5535. // instead.
  5536. //
  5537. // Signs a JWT using a service account's system-managed private key.
  5538. //
  5539. // If no expiry time (`exp`) is provided in the `SignJwtRequest`, IAM
  5540. // sets an
  5541. // an expiry time of one hour by default. If you request an expiry time
  5542. // of
  5543. // more than one hour, the request will fail.
  5544. func (r *ProjectsServiceAccountsService) SignJwt(name string, signjwtrequest *SignJwtRequest) *ProjectsServiceAccountsSignJwtCall {
  5545. c := &ProjectsServiceAccountsSignJwtCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5546. c.name = name
  5547. c.signjwtrequest = signjwtrequest
  5548. return c
  5549. }
  5550. // Fields allows partial responses to be retrieved. See
  5551. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5552. // for more information.
  5553. func (c *ProjectsServiceAccountsSignJwtCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSignJwtCall {
  5554. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5555. return c
  5556. }
  5557. // Context sets the context to be used in this call's Do method. Any
  5558. // pending HTTP request will be aborted if the provided context is
  5559. // canceled.
  5560. func (c *ProjectsServiceAccountsSignJwtCall) Context(ctx context.Context) *ProjectsServiceAccountsSignJwtCall {
  5561. c.ctx_ = ctx
  5562. return c
  5563. }
  5564. // Header returns an http.Header that can be modified by the caller to
  5565. // add HTTP headers to the request.
  5566. func (c *ProjectsServiceAccountsSignJwtCall) Header() http.Header {
  5567. if c.header_ == nil {
  5568. c.header_ = make(http.Header)
  5569. }
  5570. return c.header_
  5571. }
  5572. func (c *ProjectsServiceAccountsSignJwtCall) doRequest(alt string) (*http.Response, error) {
  5573. reqHeaders := make(http.Header)
  5574. for k, v := range c.header_ {
  5575. reqHeaders[k] = v
  5576. }
  5577. reqHeaders.Set("User-Agent", c.s.userAgent())
  5578. var body io.Reader = nil
  5579. body, err := googleapi.WithoutDataWrapper.JSONReader(c.signjwtrequest)
  5580. if err != nil {
  5581. return nil, err
  5582. }
  5583. reqHeaders.Set("Content-Type", "application/json")
  5584. c.urlParams_.Set("alt", alt)
  5585. c.urlParams_.Set("prettyPrint", "false")
  5586. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:signJwt")
  5587. urls += "?" + c.urlParams_.Encode()
  5588. req, err := http.NewRequest("POST", urls, body)
  5589. if err != nil {
  5590. return nil, err
  5591. }
  5592. req.Header = reqHeaders
  5593. googleapi.Expand(req.URL, map[string]string{
  5594. "name": c.name,
  5595. })
  5596. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5597. }
  5598. // Do executes the "iam.projects.serviceAccounts.signJwt" call.
  5599. // Exactly one of *SignJwtResponse or error will be non-nil. Any non-2xx
  5600. // status code is an error. Response headers are in either
  5601. // *SignJwtResponse.ServerResponse.Header or (if a response was returned
  5602. // at all) in error.(*googleapi.Error).Header. Use
  5603. // googleapi.IsNotModified to check whether the returned error was
  5604. // because http.StatusNotModified was returned.
  5605. func (c *ProjectsServiceAccountsSignJwtCall) Do(opts ...googleapi.CallOption) (*SignJwtResponse, error) {
  5606. gensupport.SetOptions(c.urlParams_, opts...)
  5607. res, err := c.doRequest("json")
  5608. if res != nil && res.StatusCode == http.StatusNotModified {
  5609. if res.Body != nil {
  5610. res.Body.Close()
  5611. }
  5612. return nil, &googleapi.Error{
  5613. Code: res.StatusCode,
  5614. Header: res.Header,
  5615. }
  5616. }
  5617. if err != nil {
  5618. return nil, err
  5619. }
  5620. defer googleapi.CloseBody(res)
  5621. if err := googleapi.CheckResponse(res); err != nil {
  5622. return nil, err
  5623. }
  5624. ret := &SignJwtResponse{
  5625. ServerResponse: googleapi.ServerResponse{
  5626. Header: res.Header,
  5627. HTTPStatusCode: res.StatusCode,
  5628. },
  5629. }
  5630. target := &ret
  5631. if err := gensupport.DecodeResponse(target, res); err != nil {
  5632. return nil, err
  5633. }
  5634. return ret, nil
  5635. // {
  5636. // "description": "**Note**: This method is in the process of being deprecated. Call the\n[`signJwt()`](/iam/credentials/reference/rest/v1/projects.serviceAccounts/signJwt)\nmethod of the Cloud IAM Service Account Credentials API instead.\n\nSigns a JWT using a service account's system-managed private key.\n\nIf no expiry time (`exp`) is provided in the `SignJwtRequest`, IAM sets an\nan expiry time of one hour by default. If you request an expiry time of\nmore than one hour, the request will fail.",
  5637. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signJwt",
  5638. // "httpMethod": "POST",
  5639. // "id": "iam.projects.serviceAccounts.signJwt",
  5640. // "parameterOrder": [
  5641. // "name"
  5642. // ],
  5643. // "parameters": {
  5644. // "name": {
  5645. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account. The `ACCOUNT` value can be the `email` address or the\n`unique_id` of the service account.",
  5646. // "location": "path",
  5647. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  5648. // "required": true,
  5649. // "type": "string"
  5650. // }
  5651. // },
  5652. // "path": "v1/{+name}:signJwt",
  5653. // "request": {
  5654. // "$ref": "SignJwtRequest"
  5655. // },
  5656. // "response": {
  5657. // "$ref": "SignJwtResponse"
  5658. // },
  5659. // "scopes": [
  5660. // "https://www.googleapis.com/auth/cloud-platform"
  5661. // ]
  5662. // }
  5663. }
  5664. // method id "iam.projects.serviceAccounts.testIamPermissions":
  5665. type ProjectsServiceAccountsTestIamPermissionsCall struct {
  5666. s *Service
  5667. resource string
  5668. testiampermissionsrequest *TestIamPermissionsRequest
  5669. urlParams_ gensupport.URLParams
  5670. ctx_ context.Context
  5671. header_ http.Header
  5672. }
  5673. // TestIamPermissions: Tests the specified permissions against the IAM
  5674. // access control policy
  5675. // for a ServiceAccount.
  5676. func (r *ProjectsServiceAccountsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsServiceAccountsTestIamPermissionsCall {
  5677. c := &ProjectsServiceAccountsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5678. c.resource = resource
  5679. c.testiampermissionsrequest = testiampermissionsrequest
  5680. return c
  5681. }
  5682. // Fields allows partial responses to be retrieved. See
  5683. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5684. // for more information.
  5685. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsTestIamPermissionsCall {
  5686. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5687. return c
  5688. }
  5689. // Context sets the context to be used in this call's Do method. Any
  5690. // pending HTTP request will be aborted if the provided context is
  5691. // canceled.
  5692. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsServiceAccountsTestIamPermissionsCall {
  5693. c.ctx_ = ctx
  5694. return c
  5695. }
  5696. // Header returns an http.Header that can be modified by the caller to
  5697. // add HTTP headers to the request.
  5698. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Header() http.Header {
  5699. if c.header_ == nil {
  5700. c.header_ = make(http.Header)
  5701. }
  5702. return c.header_
  5703. }
  5704. func (c *ProjectsServiceAccountsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  5705. reqHeaders := make(http.Header)
  5706. for k, v := range c.header_ {
  5707. reqHeaders[k] = v
  5708. }
  5709. reqHeaders.Set("User-Agent", c.s.userAgent())
  5710. var body io.Reader = nil
  5711. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  5712. if err != nil {
  5713. return nil, err
  5714. }
  5715. reqHeaders.Set("Content-Type", "application/json")
  5716. c.urlParams_.Set("alt", alt)
  5717. c.urlParams_.Set("prettyPrint", "false")
  5718. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  5719. urls += "?" + c.urlParams_.Encode()
  5720. req, err := http.NewRequest("POST", urls, body)
  5721. if err != nil {
  5722. return nil, err
  5723. }
  5724. req.Header = reqHeaders
  5725. googleapi.Expand(req.URL, map[string]string{
  5726. "resource": c.resource,
  5727. })
  5728. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5729. }
  5730. // Do executes the "iam.projects.serviceAccounts.testIamPermissions" call.
  5731. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  5732. // Any non-2xx status code is an error. Response headers are in either
  5733. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  5734. // was returned at all) in error.(*googleapi.Error).Header. Use
  5735. // googleapi.IsNotModified to check whether the returned error was
  5736. // because http.StatusNotModified was returned.
  5737. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  5738. gensupport.SetOptions(c.urlParams_, opts...)
  5739. res, err := c.doRequest("json")
  5740. if res != nil && res.StatusCode == http.StatusNotModified {
  5741. if res.Body != nil {
  5742. res.Body.Close()
  5743. }
  5744. return nil, &googleapi.Error{
  5745. Code: res.StatusCode,
  5746. Header: res.Header,
  5747. }
  5748. }
  5749. if err != nil {
  5750. return nil, err
  5751. }
  5752. defer googleapi.CloseBody(res)
  5753. if err := googleapi.CheckResponse(res); err != nil {
  5754. return nil, err
  5755. }
  5756. ret := &TestIamPermissionsResponse{
  5757. ServerResponse: googleapi.ServerResponse{
  5758. Header: res.Header,
  5759. HTTPStatusCode: res.StatusCode,
  5760. },
  5761. }
  5762. target := &ret
  5763. if err := gensupport.DecodeResponse(target, res); err != nil {
  5764. return nil, err
  5765. }
  5766. return ret, nil
  5767. // {
  5768. // "description": "Tests the specified permissions against the IAM access control policy\nfor a ServiceAccount.",
  5769. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:testIamPermissions",
  5770. // "httpMethod": "POST",
  5771. // "id": "iam.projects.serviceAccounts.testIamPermissions",
  5772. // "parameterOrder": [
  5773. // "resource"
  5774. // ],
  5775. // "parameters": {
  5776. // "resource": {
  5777. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  5778. // "location": "path",
  5779. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  5780. // "required": true,
  5781. // "type": "string"
  5782. // }
  5783. // },
  5784. // "path": "v1/{+resource}:testIamPermissions",
  5785. // "request": {
  5786. // "$ref": "TestIamPermissionsRequest"
  5787. // },
  5788. // "response": {
  5789. // "$ref": "TestIamPermissionsResponse"
  5790. // },
  5791. // "scopes": [
  5792. // "https://www.googleapis.com/auth/cloud-platform"
  5793. // ]
  5794. // }
  5795. }
  5796. // method id "iam.projects.serviceAccounts.undelete":
  5797. type ProjectsServiceAccountsUndeleteCall struct {
  5798. s *Service
  5799. name string
  5800. undeleteserviceaccountrequest *UndeleteServiceAccountRequest
  5801. urlParams_ gensupport.URLParams
  5802. ctx_ context.Context
  5803. header_ http.Header
  5804. }
  5805. // Undelete: Restores a deleted ServiceAccount.
  5806. // This is to be used as an action of last resort. A service account
  5807. // may
  5808. // not always be restorable.
  5809. func (r *ProjectsServiceAccountsService) Undelete(name string, undeleteserviceaccountrequest *UndeleteServiceAccountRequest) *ProjectsServiceAccountsUndeleteCall {
  5810. c := &ProjectsServiceAccountsUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5811. c.name = name
  5812. c.undeleteserviceaccountrequest = undeleteserviceaccountrequest
  5813. return c
  5814. }
  5815. // Fields allows partial responses to be retrieved. See
  5816. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5817. // for more information.
  5818. func (c *ProjectsServiceAccountsUndeleteCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsUndeleteCall {
  5819. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5820. return c
  5821. }
  5822. // Context sets the context to be used in this call's Do method. Any
  5823. // pending HTTP request will be aborted if the provided context is
  5824. // canceled.
  5825. func (c *ProjectsServiceAccountsUndeleteCall) Context(ctx context.Context) *ProjectsServiceAccountsUndeleteCall {
  5826. c.ctx_ = ctx
  5827. return c
  5828. }
  5829. // Header returns an http.Header that can be modified by the caller to
  5830. // add HTTP headers to the request.
  5831. func (c *ProjectsServiceAccountsUndeleteCall) Header() http.Header {
  5832. if c.header_ == nil {
  5833. c.header_ = make(http.Header)
  5834. }
  5835. return c.header_
  5836. }
  5837. func (c *ProjectsServiceAccountsUndeleteCall) doRequest(alt string) (*http.Response, error) {
  5838. reqHeaders := make(http.Header)
  5839. for k, v := range c.header_ {
  5840. reqHeaders[k] = v
  5841. }
  5842. reqHeaders.Set("User-Agent", c.s.userAgent())
  5843. var body io.Reader = nil
  5844. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeleteserviceaccountrequest)
  5845. if err != nil {
  5846. return nil, err
  5847. }
  5848. reqHeaders.Set("Content-Type", "application/json")
  5849. c.urlParams_.Set("alt", alt)
  5850. c.urlParams_.Set("prettyPrint", "false")
  5851. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:undelete")
  5852. urls += "?" + c.urlParams_.Encode()
  5853. req, err := http.NewRequest("POST", urls, body)
  5854. if err != nil {
  5855. return nil, err
  5856. }
  5857. req.Header = reqHeaders
  5858. googleapi.Expand(req.URL, map[string]string{
  5859. "name": c.name,
  5860. })
  5861. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5862. }
  5863. // Do executes the "iam.projects.serviceAccounts.undelete" call.
  5864. // Exactly one of *UndeleteServiceAccountResponse or error will be
  5865. // non-nil. Any non-2xx status code is an error. Response headers are in
  5866. // either *UndeleteServiceAccountResponse.ServerResponse.Header or (if a
  5867. // response was returned at all) in error.(*googleapi.Error).Header. Use
  5868. // googleapi.IsNotModified to check whether the returned error was
  5869. // because http.StatusNotModified was returned.
  5870. func (c *ProjectsServiceAccountsUndeleteCall) Do(opts ...googleapi.CallOption) (*UndeleteServiceAccountResponse, error) {
  5871. gensupport.SetOptions(c.urlParams_, opts...)
  5872. res, err := c.doRequest("json")
  5873. if res != nil && res.StatusCode == http.StatusNotModified {
  5874. if res.Body != nil {
  5875. res.Body.Close()
  5876. }
  5877. return nil, &googleapi.Error{
  5878. Code: res.StatusCode,
  5879. Header: res.Header,
  5880. }
  5881. }
  5882. if err != nil {
  5883. return nil, err
  5884. }
  5885. defer googleapi.CloseBody(res)
  5886. if err := googleapi.CheckResponse(res); err != nil {
  5887. return nil, err
  5888. }
  5889. ret := &UndeleteServiceAccountResponse{
  5890. ServerResponse: googleapi.ServerResponse{
  5891. Header: res.Header,
  5892. HTTPStatusCode: res.StatusCode,
  5893. },
  5894. }
  5895. target := &ret
  5896. if err := gensupport.DecodeResponse(target, res); err != nil {
  5897. return nil, err
  5898. }
  5899. return ret, nil
  5900. // {
  5901. // "description": "Restores a deleted ServiceAccount.\nThis is to be used as an action of last resort. A service account may\nnot always be restorable.",
  5902. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:undelete",
  5903. // "httpMethod": "POST",
  5904. // "id": "iam.projects.serviceAccounts.undelete",
  5905. // "parameterOrder": [
  5906. // "name"
  5907. // ],
  5908. // "parameters": {
  5909. // "name": {
  5910. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}'.\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account.",
  5911. // "location": "path",
  5912. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  5913. // "required": true,
  5914. // "type": "string"
  5915. // }
  5916. // },
  5917. // "path": "v1/{+name}:undelete",
  5918. // "request": {
  5919. // "$ref": "UndeleteServiceAccountRequest"
  5920. // },
  5921. // "response": {
  5922. // "$ref": "UndeleteServiceAccountResponse"
  5923. // },
  5924. // "scopes": [
  5925. // "https://www.googleapis.com/auth/cloud-platform"
  5926. // ]
  5927. // }
  5928. }
  5929. // method id "iam.projects.serviceAccounts.update":
  5930. type ProjectsServiceAccountsUpdateCall struct {
  5931. s *Service
  5932. name string
  5933. serviceaccount *ServiceAccount
  5934. urlParams_ gensupport.URLParams
  5935. ctx_ context.Context
  5936. header_ http.Header
  5937. }
  5938. // Update: Note: This method is in the process of being deprecated.
  5939. // Use
  5940. // PatchServiceAccount instead.
  5941. //
  5942. // Updates a ServiceAccount.
  5943. //
  5944. // Currently, only the following fields are updatable:
  5945. // `display_name` .
  5946. // The `etag` is mandatory.
  5947. func (r *ProjectsServiceAccountsService) Update(name string, serviceaccount *ServiceAccount) *ProjectsServiceAccountsUpdateCall {
  5948. c := &ProjectsServiceAccountsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5949. c.name = name
  5950. c.serviceaccount = serviceaccount
  5951. return c
  5952. }
  5953. // Fields allows partial responses to be retrieved. See
  5954. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5955. // for more information.
  5956. func (c *ProjectsServiceAccountsUpdateCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsUpdateCall {
  5957. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5958. return c
  5959. }
  5960. // Context sets the context to be used in this call's Do method. Any
  5961. // pending HTTP request will be aborted if the provided context is
  5962. // canceled.
  5963. func (c *ProjectsServiceAccountsUpdateCall) Context(ctx context.Context) *ProjectsServiceAccountsUpdateCall {
  5964. c.ctx_ = ctx
  5965. return c
  5966. }
  5967. // Header returns an http.Header that can be modified by the caller to
  5968. // add HTTP headers to the request.
  5969. func (c *ProjectsServiceAccountsUpdateCall) Header() http.Header {
  5970. if c.header_ == nil {
  5971. c.header_ = make(http.Header)
  5972. }
  5973. return c.header_
  5974. }
  5975. func (c *ProjectsServiceAccountsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5976. reqHeaders := make(http.Header)
  5977. for k, v := range c.header_ {
  5978. reqHeaders[k] = v
  5979. }
  5980. reqHeaders.Set("User-Agent", c.s.userAgent())
  5981. var body io.Reader = nil
  5982. body, err := googleapi.WithoutDataWrapper.JSONReader(c.serviceaccount)
  5983. if err != nil {
  5984. return nil, err
  5985. }
  5986. reqHeaders.Set("Content-Type", "application/json")
  5987. c.urlParams_.Set("alt", alt)
  5988. c.urlParams_.Set("prettyPrint", "false")
  5989. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5990. urls += "?" + c.urlParams_.Encode()
  5991. req, err := http.NewRequest("PUT", urls, body)
  5992. if err != nil {
  5993. return nil, err
  5994. }
  5995. req.Header = reqHeaders
  5996. googleapi.Expand(req.URL, map[string]string{
  5997. "name": c.name,
  5998. })
  5999. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6000. }
  6001. // Do executes the "iam.projects.serviceAccounts.update" call.
  6002. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  6003. // status code is an error. Response headers are in either
  6004. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  6005. // at all) in error.(*googleapi.Error).Header. Use
  6006. // googleapi.IsNotModified to check whether the returned error was
  6007. // because http.StatusNotModified was returned.
  6008. func (c *ProjectsServiceAccountsUpdateCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  6009. gensupport.SetOptions(c.urlParams_, opts...)
  6010. res, err := c.doRequest("json")
  6011. if res != nil && res.StatusCode == http.StatusNotModified {
  6012. if res.Body != nil {
  6013. res.Body.Close()
  6014. }
  6015. return nil, &googleapi.Error{
  6016. Code: res.StatusCode,
  6017. Header: res.Header,
  6018. }
  6019. }
  6020. if err != nil {
  6021. return nil, err
  6022. }
  6023. defer googleapi.CloseBody(res)
  6024. if err := googleapi.CheckResponse(res); err != nil {
  6025. return nil, err
  6026. }
  6027. ret := &ServiceAccount{
  6028. ServerResponse: googleapi.ServerResponse{
  6029. Header: res.Header,
  6030. HTTPStatusCode: res.StatusCode,
  6031. },
  6032. }
  6033. target := &ret
  6034. if err := gensupport.DecodeResponse(target, res); err != nil {
  6035. return nil, err
  6036. }
  6037. return ret, nil
  6038. // {
  6039. // "description": "Note: This method is in the process of being deprecated. Use\nPatchServiceAccount instead.\n\nUpdates a ServiceAccount.\n\nCurrently, only the following fields are updatable:\n`display_name` .\nThe `etag` is mandatory.",
  6040. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}",
  6041. // "httpMethod": "PUT",
  6042. // "id": "iam.projects.serviceAccounts.update",
  6043. // "parameterOrder": [
  6044. // "name"
  6045. // ],
  6046. // "parameters": {
  6047. // "name": {
  6048. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.\n\nRequests using `-` as a wildcard for the `PROJECT_ID` will infer the\nproject from the `account` and the `ACCOUNT` value can be the `email`\naddress or the `unique_id` of the service account.\n\nIn responses the resource name will always be in the format\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.",
  6049. // "location": "path",
  6050. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  6051. // "required": true,
  6052. // "type": "string"
  6053. // }
  6054. // },
  6055. // "path": "v1/{+name}",
  6056. // "request": {
  6057. // "$ref": "ServiceAccount"
  6058. // },
  6059. // "response": {
  6060. // "$ref": "ServiceAccount"
  6061. // },
  6062. // "scopes": [
  6063. // "https://www.googleapis.com/auth/cloud-platform"
  6064. // ]
  6065. // }
  6066. }
  6067. // method id "iam.projects.serviceAccounts.keys.create":
  6068. type ProjectsServiceAccountsKeysCreateCall struct {
  6069. s *Service
  6070. name string
  6071. createserviceaccountkeyrequest *CreateServiceAccountKeyRequest
  6072. urlParams_ gensupport.URLParams
  6073. ctx_ context.Context
  6074. header_ http.Header
  6075. }
  6076. // Create: Creates a ServiceAccountKey
  6077. // and returns it.
  6078. func (r *ProjectsServiceAccountsKeysService) Create(name string, createserviceaccountkeyrequest *CreateServiceAccountKeyRequest) *ProjectsServiceAccountsKeysCreateCall {
  6079. c := &ProjectsServiceAccountsKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6080. c.name = name
  6081. c.createserviceaccountkeyrequest = createserviceaccountkeyrequest
  6082. return c
  6083. }
  6084. // Fields allows partial responses to be retrieved. See
  6085. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6086. // for more information.
  6087. func (c *ProjectsServiceAccountsKeysCreateCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysCreateCall {
  6088. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6089. return c
  6090. }
  6091. // Context sets the context to be used in this call's Do method. Any
  6092. // pending HTTP request will be aborted if the provided context is
  6093. // canceled.
  6094. func (c *ProjectsServiceAccountsKeysCreateCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysCreateCall {
  6095. c.ctx_ = ctx
  6096. return c
  6097. }
  6098. // Header returns an http.Header that can be modified by the caller to
  6099. // add HTTP headers to the request.
  6100. func (c *ProjectsServiceAccountsKeysCreateCall) Header() http.Header {
  6101. if c.header_ == nil {
  6102. c.header_ = make(http.Header)
  6103. }
  6104. return c.header_
  6105. }
  6106. func (c *ProjectsServiceAccountsKeysCreateCall) doRequest(alt string) (*http.Response, error) {
  6107. reqHeaders := make(http.Header)
  6108. for k, v := range c.header_ {
  6109. reqHeaders[k] = v
  6110. }
  6111. reqHeaders.Set("User-Agent", c.s.userAgent())
  6112. var body io.Reader = nil
  6113. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createserviceaccountkeyrequest)
  6114. if err != nil {
  6115. return nil, err
  6116. }
  6117. reqHeaders.Set("Content-Type", "application/json")
  6118. c.urlParams_.Set("alt", alt)
  6119. c.urlParams_.Set("prettyPrint", "false")
  6120. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/keys")
  6121. urls += "?" + c.urlParams_.Encode()
  6122. req, err := http.NewRequest("POST", urls, body)
  6123. if err != nil {
  6124. return nil, err
  6125. }
  6126. req.Header = reqHeaders
  6127. googleapi.Expand(req.URL, map[string]string{
  6128. "name": c.name,
  6129. })
  6130. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6131. }
  6132. // Do executes the "iam.projects.serviceAccounts.keys.create" call.
  6133. // Exactly one of *ServiceAccountKey or error will be non-nil. Any
  6134. // non-2xx status code is an error. Response headers are in either
  6135. // *ServiceAccountKey.ServerResponse.Header or (if a response was
  6136. // returned at all) in error.(*googleapi.Error).Header. Use
  6137. // googleapi.IsNotModified to check whether the returned error was
  6138. // because http.StatusNotModified was returned.
  6139. func (c *ProjectsServiceAccountsKeysCreateCall) Do(opts ...googleapi.CallOption) (*ServiceAccountKey, error) {
  6140. gensupport.SetOptions(c.urlParams_, opts...)
  6141. res, err := c.doRequest("json")
  6142. if res != nil && res.StatusCode == http.StatusNotModified {
  6143. if res.Body != nil {
  6144. res.Body.Close()
  6145. }
  6146. return nil, &googleapi.Error{
  6147. Code: res.StatusCode,
  6148. Header: res.Header,
  6149. }
  6150. }
  6151. if err != nil {
  6152. return nil, err
  6153. }
  6154. defer googleapi.CloseBody(res)
  6155. if err := googleapi.CheckResponse(res); err != nil {
  6156. return nil, err
  6157. }
  6158. ret := &ServiceAccountKey{
  6159. ServerResponse: googleapi.ServerResponse{
  6160. Header: res.Header,
  6161. HTTPStatusCode: res.StatusCode,
  6162. },
  6163. }
  6164. target := &ret
  6165. if err := gensupport.DecodeResponse(target, res); err != nil {
  6166. return nil, err
  6167. }
  6168. return ret, nil
  6169. // {
  6170. // "description": "Creates a ServiceAccountKey\nand returns it.",
  6171. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys",
  6172. // "httpMethod": "POST",
  6173. // "id": "iam.projects.serviceAccounts.keys.create",
  6174. // "parameterOrder": [
  6175. // "name"
  6176. // ],
  6177. // "parameters": {
  6178. // "name": {
  6179. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account. The `ACCOUNT` value can be the `email` address or the\n`unique_id` of the service account.",
  6180. // "location": "path",
  6181. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  6182. // "required": true,
  6183. // "type": "string"
  6184. // }
  6185. // },
  6186. // "path": "v1/{+name}/keys",
  6187. // "request": {
  6188. // "$ref": "CreateServiceAccountKeyRequest"
  6189. // },
  6190. // "response": {
  6191. // "$ref": "ServiceAccountKey"
  6192. // },
  6193. // "scopes": [
  6194. // "https://www.googleapis.com/auth/cloud-platform"
  6195. // ]
  6196. // }
  6197. }
  6198. // method id "iam.projects.serviceAccounts.keys.delete":
  6199. type ProjectsServiceAccountsKeysDeleteCall struct {
  6200. s *Service
  6201. name string
  6202. urlParams_ gensupport.URLParams
  6203. ctx_ context.Context
  6204. header_ http.Header
  6205. }
  6206. // Delete: Deletes a ServiceAccountKey.
  6207. func (r *ProjectsServiceAccountsKeysService) Delete(name string) *ProjectsServiceAccountsKeysDeleteCall {
  6208. c := &ProjectsServiceAccountsKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6209. c.name = name
  6210. return c
  6211. }
  6212. // Fields allows partial responses to be retrieved. See
  6213. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6214. // for more information.
  6215. func (c *ProjectsServiceAccountsKeysDeleteCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysDeleteCall {
  6216. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6217. return c
  6218. }
  6219. // Context sets the context to be used in this call's Do method. Any
  6220. // pending HTTP request will be aborted if the provided context is
  6221. // canceled.
  6222. func (c *ProjectsServiceAccountsKeysDeleteCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysDeleteCall {
  6223. c.ctx_ = ctx
  6224. return c
  6225. }
  6226. // Header returns an http.Header that can be modified by the caller to
  6227. // add HTTP headers to the request.
  6228. func (c *ProjectsServiceAccountsKeysDeleteCall) Header() http.Header {
  6229. if c.header_ == nil {
  6230. c.header_ = make(http.Header)
  6231. }
  6232. return c.header_
  6233. }
  6234. func (c *ProjectsServiceAccountsKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
  6235. reqHeaders := make(http.Header)
  6236. for k, v := range c.header_ {
  6237. reqHeaders[k] = v
  6238. }
  6239. reqHeaders.Set("User-Agent", c.s.userAgent())
  6240. var body io.Reader = nil
  6241. c.urlParams_.Set("alt", alt)
  6242. c.urlParams_.Set("prettyPrint", "false")
  6243. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  6244. urls += "?" + c.urlParams_.Encode()
  6245. req, err := http.NewRequest("DELETE", urls, body)
  6246. if err != nil {
  6247. return nil, err
  6248. }
  6249. req.Header = reqHeaders
  6250. googleapi.Expand(req.URL, map[string]string{
  6251. "name": c.name,
  6252. })
  6253. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6254. }
  6255. // Do executes the "iam.projects.serviceAccounts.keys.delete" call.
  6256. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  6257. // code is an error. Response headers are in either
  6258. // *Empty.ServerResponse.Header or (if a response was returned at all)
  6259. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6260. // check whether the returned error was because http.StatusNotModified
  6261. // was returned.
  6262. func (c *ProjectsServiceAccountsKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  6263. gensupport.SetOptions(c.urlParams_, opts...)
  6264. res, err := c.doRequest("json")
  6265. if res != nil && res.StatusCode == http.StatusNotModified {
  6266. if res.Body != nil {
  6267. res.Body.Close()
  6268. }
  6269. return nil, &googleapi.Error{
  6270. Code: res.StatusCode,
  6271. Header: res.Header,
  6272. }
  6273. }
  6274. if err != nil {
  6275. return nil, err
  6276. }
  6277. defer googleapi.CloseBody(res)
  6278. if err := googleapi.CheckResponse(res); err != nil {
  6279. return nil, err
  6280. }
  6281. ret := &Empty{
  6282. ServerResponse: googleapi.ServerResponse{
  6283. Header: res.Header,
  6284. HTTPStatusCode: res.StatusCode,
  6285. },
  6286. }
  6287. target := &ret
  6288. if err := gensupport.DecodeResponse(target, res); err != nil {
  6289. return nil, err
  6290. }
  6291. return ret, nil
  6292. // {
  6293. // "description": "Deletes a ServiceAccountKey.",
  6294. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}",
  6295. // "httpMethod": "DELETE",
  6296. // "id": "iam.projects.serviceAccounts.keys.delete",
  6297. // "parameterOrder": [
  6298. // "name"
  6299. // ],
  6300. // "parameters": {
  6301. // "name": {
  6302. // "description": "The resource name of the service account key in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account. The `ACCOUNT` value can be the `email` address or the\n`unique_id` of the service account.",
  6303. // "location": "path",
  6304. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+/keys/[^/]+$",
  6305. // "required": true,
  6306. // "type": "string"
  6307. // }
  6308. // },
  6309. // "path": "v1/{+name}",
  6310. // "response": {
  6311. // "$ref": "Empty"
  6312. // },
  6313. // "scopes": [
  6314. // "https://www.googleapis.com/auth/cloud-platform"
  6315. // ]
  6316. // }
  6317. }
  6318. // method id "iam.projects.serviceAccounts.keys.get":
  6319. type ProjectsServiceAccountsKeysGetCall struct {
  6320. s *Service
  6321. name string
  6322. urlParams_ gensupport.URLParams
  6323. ifNoneMatch_ string
  6324. ctx_ context.Context
  6325. header_ http.Header
  6326. }
  6327. // Get: Gets the ServiceAccountKey
  6328. // by key id.
  6329. func (r *ProjectsServiceAccountsKeysService) Get(name string) *ProjectsServiceAccountsKeysGetCall {
  6330. c := &ProjectsServiceAccountsKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6331. c.name = name
  6332. return c
  6333. }
  6334. // PublicKeyType sets the optional parameter "publicKeyType": The output
  6335. // format of the public key requested.
  6336. // X509_PEM is the default output format.
  6337. //
  6338. // Possible values:
  6339. // "TYPE_NONE"
  6340. // "TYPE_X509_PEM_FILE"
  6341. // "TYPE_RAW_PUBLIC_KEY"
  6342. func (c *ProjectsServiceAccountsKeysGetCall) PublicKeyType(publicKeyType string) *ProjectsServiceAccountsKeysGetCall {
  6343. c.urlParams_.Set("publicKeyType", publicKeyType)
  6344. return c
  6345. }
  6346. // Fields allows partial responses to be retrieved. See
  6347. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6348. // for more information.
  6349. func (c *ProjectsServiceAccountsKeysGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysGetCall {
  6350. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6351. return c
  6352. }
  6353. // IfNoneMatch sets the optional parameter which makes the operation
  6354. // fail if the object's ETag matches the given value. This is useful for
  6355. // getting updates only after the object has changed since the last
  6356. // request. Use googleapi.IsNotModified to check whether the response
  6357. // error from Do is the result of In-None-Match.
  6358. func (c *ProjectsServiceAccountsKeysGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsKeysGetCall {
  6359. c.ifNoneMatch_ = entityTag
  6360. return c
  6361. }
  6362. // Context sets the context to be used in this call's Do method. Any
  6363. // pending HTTP request will be aborted if the provided context is
  6364. // canceled.
  6365. func (c *ProjectsServiceAccountsKeysGetCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysGetCall {
  6366. c.ctx_ = ctx
  6367. return c
  6368. }
  6369. // Header returns an http.Header that can be modified by the caller to
  6370. // add HTTP headers to the request.
  6371. func (c *ProjectsServiceAccountsKeysGetCall) Header() http.Header {
  6372. if c.header_ == nil {
  6373. c.header_ = make(http.Header)
  6374. }
  6375. return c.header_
  6376. }
  6377. func (c *ProjectsServiceAccountsKeysGetCall) doRequest(alt string) (*http.Response, error) {
  6378. reqHeaders := make(http.Header)
  6379. for k, v := range c.header_ {
  6380. reqHeaders[k] = v
  6381. }
  6382. reqHeaders.Set("User-Agent", c.s.userAgent())
  6383. if c.ifNoneMatch_ != "" {
  6384. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6385. }
  6386. var body io.Reader = nil
  6387. c.urlParams_.Set("alt", alt)
  6388. c.urlParams_.Set("prettyPrint", "false")
  6389. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  6390. urls += "?" + c.urlParams_.Encode()
  6391. req, err := http.NewRequest("GET", urls, body)
  6392. if err != nil {
  6393. return nil, err
  6394. }
  6395. req.Header = reqHeaders
  6396. googleapi.Expand(req.URL, map[string]string{
  6397. "name": c.name,
  6398. })
  6399. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6400. }
  6401. // Do executes the "iam.projects.serviceAccounts.keys.get" call.
  6402. // Exactly one of *ServiceAccountKey or error will be non-nil. Any
  6403. // non-2xx status code is an error. Response headers are in either
  6404. // *ServiceAccountKey.ServerResponse.Header or (if a response was
  6405. // returned at all) in error.(*googleapi.Error).Header. Use
  6406. // googleapi.IsNotModified to check whether the returned error was
  6407. // because http.StatusNotModified was returned.
  6408. func (c *ProjectsServiceAccountsKeysGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccountKey, error) {
  6409. gensupport.SetOptions(c.urlParams_, opts...)
  6410. res, err := c.doRequest("json")
  6411. if res != nil && res.StatusCode == http.StatusNotModified {
  6412. if res.Body != nil {
  6413. res.Body.Close()
  6414. }
  6415. return nil, &googleapi.Error{
  6416. Code: res.StatusCode,
  6417. Header: res.Header,
  6418. }
  6419. }
  6420. if err != nil {
  6421. return nil, err
  6422. }
  6423. defer googleapi.CloseBody(res)
  6424. if err := googleapi.CheckResponse(res); err != nil {
  6425. return nil, err
  6426. }
  6427. ret := &ServiceAccountKey{
  6428. ServerResponse: googleapi.ServerResponse{
  6429. Header: res.Header,
  6430. HTTPStatusCode: res.StatusCode,
  6431. },
  6432. }
  6433. target := &ret
  6434. if err := gensupport.DecodeResponse(target, res); err != nil {
  6435. return nil, err
  6436. }
  6437. return ret, nil
  6438. // {
  6439. // "description": "Gets the ServiceAccountKey\nby key id.",
  6440. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}",
  6441. // "httpMethod": "GET",
  6442. // "id": "iam.projects.serviceAccounts.keys.get",
  6443. // "parameterOrder": [
  6444. // "name"
  6445. // ],
  6446. // "parameters": {
  6447. // "name": {
  6448. // "description": "The resource name of the service account key in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.\n\nUsing `-` as a wildcard for the `PROJECT_ID` will infer the project from\nthe account. The `ACCOUNT` value can be the `email` address or the\n`unique_id` of the service account.",
  6449. // "location": "path",
  6450. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+/keys/[^/]+$",
  6451. // "required": true,
  6452. // "type": "string"
  6453. // },
  6454. // "publicKeyType": {
  6455. // "description": "The output format of the public key requested.\nX509_PEM is the default output format.",
  6456. // "enum": [
  6457. // "TYPE_NONE",
  6458. // "TYPE_X509_PEM_FILE",
  6459. // "TYPE_RAW_PUBLIC_KEY"
  6460. // ],
  6461. // "location": "query",
  6462. // "type": "string"
  6463. // }
  6464. // },
  6465. // "path": "v1/{+name}",
  6466. // "response": {
  6467. // "$ref": "ServiceAccountKey"
  6468. // },
  6469. // "scopes": [
  6470. // "https://www.googleapis.com/auth/cloud-platform"
  6471. // ]
  6472. // }
  6473. }
  6474. // method id "iam.projects.serviceAccounts.keys.list":
  6475. type ProjectsServiceAccountsKeysListCall struct {
  6476. s *Service
  6477. name string
  6478. urlParams_ gensupport.URLParams
  6479. ifNoneMatch_ string
  6480. ctx_ context.Context
  6481. header_ http.Header
  6482. }
  6483. // List: Lists ServiceAccountKeys.
  6484. func (r *ProjectsServiceAccountsKeysService) List(name string) *ProjectsServiceAccountsKeysListCall {
  6485. c := &ProjectsServiceAccountsKeysListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6486. c.name = name
  6487. return c
  6488. }
  6489. // KeyTypes sets the optional parameter "keyTypes": Filters the types of
  6490. // keys the user wants to include in the list
  6491. // response. Duplicate key types are not allowed. If no key type
  6492. // is provided, all keys are returned.
  6493. //
  6494. // Possible values:
  6495. // "KEY_TYPE_UNSPECIFIED"
  6496. // "USER_MANAGED"
  6497. // "SYSTEM_MANAGED"
  6498. func (c *ProjectsServiceAccountsKeysListCall) KeyTypes(keyTypes ...string) *ProjectsServiceAccountsKeysListCall {
  6499. c.urlParams_.SetMulti("keyTypes", append([]string{}, keyTypes...))
  6500. return c
  6501. }
  6502. // Fields allows partial responses to be retrieved. See
  6503. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6504. // for more information.
  6505. func (c *ProjectsServiceAccountsKeysListCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysListCall {
  6506. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6507. return c
  6508. }
  6509. // IfNoneMatch sets the optional parameter which makes the operation
  6510. // fail if the object's ETag matches the given value. This is useful for
  6511. // getting updates only after the object has changed since the last
  6512. // request. Use googleapi.IsNotModified to check whether the response
  6513. // error from Do is the result of In-None-Match.
  6514. func (c *ProjectsServiceAccountsKeysListCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsKeysListCall {
  6515. c.ifNoneMatch_ = entityTag
  6516. return c
  6517. }
  6518. // Context sets the context to be used in this call's Do method. Any
  6519. // pending HTTP request will be aborted if the provided context is
  6520. // canceled.
  6521. func (c *ProjectsServiceAccountsKeysListCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysListCall {
  6522. c.ctx_ = ctx
  6523. return c
  6524. }
  6525. // Header returns an http.Header that can be modified by the caller to
  6526. // add HTTP headers to the request.
  6527. func (c *ProjectsServiceAccountsKeysListCall) Header() http.Header {
  6528. if c.header_ == nil {
  6529. c.header_ = make(http.Header)
  6530. }
  6531. return c.header_
  6532. }
  6533. func (c *ProjectsServiceAccountsKeysListCall) doRequest(alt string) (*http.Response, error) {
  6534. reqHeaders := make(http.Header)
  6535. for k, v := range c.header_ {
  6536. reqHeaders[k] = v
  6537. }
  6538. reqHeaders.Set("User-Agent", c.s.userAgent())
  6539. if c.ifNoneMatch_ != "" {
  6540. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6541. }
  6542. var body io.Reader = nil
  6543. c.urlParams_.Set("alt", alt)
  6544. c.urlParams_.Set("prettyPrint", "false")
  6545. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/keys")
  6546. urls += "?" + c.urlParams_.Encode()
  6547. req, err := http.NewRequest("GET", urls, body)
  6548. if err != nil {
  6549. return nil, err
  6550. }
  6551. req.Header = reqHeaders
  6552. googleapi.Expand(req.URL, map[string]string{
  6553. "name": c.name,
  6554. })
  6555. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6556. }
  6557. // Do executes the "iam.projects.serviceAccounts.keys.list" call.
  6558. // Exactly one of *ListServiceAccountKeysResponse or error will be
  6559. // non-nil. Any non-2xx status code is an error. Response headers are in
  6560. // either *ListServiceAccountKeysResponse.ServerResponse.Header or (if a
  6561. // response was returned at all) in error.(*googleapi.Error).Header. Use
  6562. // googleapi.IsNotModified to check whether the returned error was
  6563. // because http.StatusNotModified was returned.
  6564. func (c *ProjectsServiceAccountsKeysListCall) Do(opts ...googleapi.CallOption) (*ListServiceAccountKeysResponse, error) {
  6565. gensupport.SetOptions(c.urlParams_, opts...)
  6566. res, err := c.doRequest("json")
  6567. if res != nil && res.StatusCode == http.StatusNotModified {
  6568. if res.Body != nil {
  6569. res.Body.Close()
  6570. }
  6571. return nil, &googleapi.Error{
  6572. Code: res.StatusCode,
  6573. Header: res.Header,
  6574. }
  6575. }
  6576. if err != nil {
  6577. return nil, err
  6578. }
  6579. defer googleapi.CloseBody(res)
  6580. if err := googleapi.CheckResponse(res); err != nil {
  6581. return nil, err
  6582. }
  6583. ret := &ListServiceAccountKeysResponse{
  6584. ServerResponse: googleapi.ServerResponse{
  6585. Header: res.Header,
  6586. HTTPStatusCode: res.StatusCode,
  6587. },
  6588. }
  6589. target := &ret
  6590. if err := gensupport.DecodeResponse(target, res); err != nil {
  6591. return nil, err
  6592. }
  6593. return ret, nil
  6594. // {
  6595. // "description": "Lists ServiceAccountKeys.",
  6596. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys",
  6597. // "httpMethod": "GET",
  6598. // "id": "iam.projects.serviceAccounts.keys.list",
  6599. // "parameterOrder": [
  6600. // "name"
  6601. // ],
  6602. // "parameters": {
  6603. // "keyTypes": {
  6604. // "description": "Filters the types of keys the user wants to include in the list\nresponse. Duplicate key types are not allowed. If no key type\nis provided, all keys are returned.",
  6605. // "enum": [
  6606. // "KEY_TYPE_UNSPECIFIED",
  6607. // "USER_MANAGED",
  6608. // "SYSTEM_MANAGED"
  6609. // ],
  6610. // "location": "query",
  6611. // "repeated": true,
  6612. // "type": "string"
  6613. // },
  6614. // "name": {
  6615. // "description": "The resource name of the service account in the following format:\n`projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.\n\nUsing `-` as a wildcard for the `PROJECT_ID`, will infer the project from\nthe account. The `ACCOUNT` value can be the `email` address or the\n`unique_id` of the service account.",
  6616. // "location": "path",
  6617. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  6618. // "required": true,
  6619. // "type": "string"
  6620. // }
  6621. // },
  6622. // "path": "v1/{+name}/keys",
  6623. // "response": {
  6624. // "$ref": "ListServiceAccountKeysResponse"
  6625. // },
  6626. // "scopes": [
  6627. // "https://www.googleapis.com/auth/cloud-platform"
  6628. // ]
  6629. // }
  6630. }
  6631. // method id "iam.roles.get":
  6632. type RolesGetCall struct {
  6633. s *Service
  6634. name string
  6635. urlParams_ gensupport.URLParams
  6636. ifNoneMatch_ string
  6637. ctx_ context.Context
  6638. header_ http.Header
  6639. }
  6640. // Get: Gets a Role definition.
  6641. func (r *RolesService) Get(name string) *RolesGetCall {
  6642. c := &RolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6643. c.name = name
  6644. return c
  6645. }
  6646. // Fields allows partial responses to be retrieved. See
  6647. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6648. // for more information.
  6649. func (c *RolesGetCall) Fields(s ...googleapi.Field) *RolesGetCall {
  6650. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6651. return c
  6652. }
  6653. // IfNoneMatch sets the optional parameter which makes the operation
  6654. // fail if the object's ETag matches the given value. This is useful for
  6655. // getting updates only after the object has changed since the last
  6656. // request. Use googleapi.IsNotModified to check whether the response
  6657. // error from Do is the result of In-None-Match.
  6658. func (c *RolesGetCall) IfNoneMatch(entityTag string) *RolesGetCall {
  6659. c.ifNoneMatch_ = entityTag
  6660. return c
  6661. }
  6662. // Context sets the context to be used in this call's Do method. Any
  6663. // pending HTTP request will be aborted if the provided context is
  6664. // canceled.
  6665. func (c *RolesGetCall) Context(ctx context.Context) *RolesGetCall {
  6666. c.ctx_ = ctx
  6667. return c
  6668. }
  6669. // Header returns an http.Header that can be modified by the caller to
  6670. // add HTTP headers to the request.
  6671. func (c *RolesGetCall) Header() http.Header {
  6672. if c.header_ == nil {
  6673. c.header_ = make(http.Header)
  6674. }
  6675. return c.header_
  6676. }
  6677. func (c *RolesGetCall) doRequest(alt string) (*http.Response, error) {
  6678. reqHeaders := make(http.Header)
  6679. for k, v := range c.header_ {
  6680. reqHeaders[k] = v
  6681. }
  6682. reqHeaders.Set("User-Agent", c.s.userAgent())
  6683. if c.ifNoneMatch_ != "" {
  6684. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6685. }
  6686. var body io.Reader = nil
  6687. c.urlParams_.Set("alt", alt)
  6688. c.urlParams_.Set("prettyPrint", "false")
  6689. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  6690. urls += "?" + c.urlParams_.Encode()
  6691. req, err := http.NewRequest("GET", urls, body)
  6692. if err != nil {
  6693. return nil, err
  6694. }
  6695. req.Header = reqHeaders
  6696. googleapi.Expand(req.URL, map[string]string{
  6697. "name": c.name,
  6698. })
  6699. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6700. }
  6701. // Do executes the "iam.roles.get" call.
  6702. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  6703. // code is an error. Response headers are in either
  6704. // *Role.ServerResponse.Header or (if a response was returned at all) in
  6705. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6706. // whether the returned error was because http.StatusNotModified was
  6707. // returned.
  6708. func (c *RolesGetCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  6709. gensupport.SetOptions(c.urlParams_, opts...)
  6710. res, err := c.doRequest("json")
  6711. if res != nil && res.StatusCode == http.StatusNotModified {
  6712. if res.Body != nil {
  6713. res.Body.Close()
  6714. }
  6715. return nil, &googleapi.Error{
  6716. Code: res.StatusCode,
  6717. Header: res.Header,
  6718. }
  6719. }
  6720. if err != nil {
  6721. return nil, err
  6722. }
  6723. defer googleapi.CloseBody(res)
  6724. if err := googleapi.CheckResponse(res); err != nil {
  6725. return nil, err
  6726. }
  6727. ret := &Role{
  6728. ServerResponse: googleapi.ServerResponse{
  6729. Header: res.Header,
  6730. HTTPStatusCode: res.StatusCode,
  6731. },
  6732. }
  6733. target := &ret
  6734. if err := gensupport.DecodeResponse(target, res); err != nil {
  6735. return nil, err
  6736. }
  6737. return ret, nil
  6738. // {
  6739. // "description": "Gets a Role definition.",
  6740. // "flatPath": "v1/roles/{rolesId}",
  6741. // "httpMethod": "GET",
  6742. // "id": "iam.roles.get",
  6743. // "parameterOrder": [
  6744. // "name"
  6745. // ],
  6746. // "parameters": {
  6747. // "name": {
  6748. // "description": "The resource name of the role in one of the following formats:\n`roles/{ROLE_NAME}`\n`organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME}`\n`projects/{PROJECT_ID}/roles/{ROLE_NAME}`",
  6749. // "location": "path",
  6750. // "pattern": "^roles/[^/]+$",
  6751. // "required": true,
  6752. // "type": "string"
  6753. // }
  6754. // },
  6755. // "path": "v1/{+name}",
  6756. // "response": {
  6757. // "$ref": "Role"
  6758. // },
  6759. // "scopes": [
  6760. // "https://www.googleapis.com/auth/cloud-platform"
  6761. // ]
  6762. // }
  6763. }
  6764. // method id "iam.roles.list":
  6765. type RolesListCall struct {
  6766. s *Service
  6767. urlParams_ gensupport.URLParams
  6768. ifNoneMatch_ string
  6769. ctx_ context.Context
  6770. header_ http.Header
  6771. }
  6772. // List: Lists the Roles defined on a resource.
  6773. func (r *RolesService) List() *RolesListCall {
  6774. c := &RolesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6775. return c
  6776. }
  6777. // PageSize sets the optional parameter "pageSize": Optional limit on
  6778. // the number of roles to include in the response.
  6779. func (c *RolesListCall) PageSize(pageSize int64) *RolesListCall {
  6780. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6781. return c
  6782. }
  6783. // PageToken sets the optional parameter "pageToken": Optional
  6784. // pagination token returned in an earlier ListRolesResponse.
  6785. func (c *RolesListCall) PageToken(pageToken string) *RolesListCall {
  6786. c.urlParams_.Set("pageToken", pageToken)
  6787. return c
  6788. }
  6789. // Parent sets the optional parameter "parent": The resource name of the
  6790. // parent resource in one of the following formats:
  6791. // `` (empty string) -- this refers to curated
  6792. // roles.
  6793. // `organizations/{ORGANIZATION_ID}`
  6794. // `projects/{PROJECT_ID}`
  6795. func (c *RolesListCall) Parent(parent string) *RolesListCall {
  6796. c.urlParams_.Set("parent", parent)
  6797. return c
  6798. }
  6799. // ShowDeleted sets the optional parameter "showDeleted": Include Roles
  6800. // that have been deleted.
  6801. func (c *RolesListCall) ShowDeleted(showDeleted bool) *RolesListCall {
  6802. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  6803. return c
  6804. }
  6805. // View sets the optional parameter "view": Optional view for the
  6806. // returned Role objects. When `FULL` is specified,
  6807. // the `includedPermissions` field is returned, which includes a list of
  6808. // all
  6809. // permissions in the role. The default value is `BASIC`, which does
  6810. // not
  6811. // return the `includedPermissions` field.
  6812. //
  6813. // Possible values:
  6814. // "BASIC"
  6815. // "FULL"
  6816. func (c *RolesListCall) View(view string) *RolesListCall {
  6817. c.urlParams_.Set("view", view)
  6818. return c
  6819. }
  6820. // Fields allows partial responses to be retrieved. See
  6821. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6822. // for more information.
  6823. func (c *RolesListCall) Fields(s ...googleapi.Field) *RolesListCall {
  6824. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6825. return c
  6826. }
  6827. // IfNoneMatch sets the optional parameter which makes the operation
  6828. // fail if the object's ETag matches the given value. This is useful for
  6829. // getting updates only after the object has changed since the last
  6830. // request. Use googleapi.IsNotModified to check whether the response
  6831. // error from Do is the result of In-None-Match.
  6832. func (c *RolesListCall) IfNoneMatch(entityTag string) *RolesListCall {
  6833. c.ifNoneMatch_ = entityTag
  6834. return c
  6835. }
  6836. // Context sets the context to be used in this call's Do method. Any
  6837. // pending HTTP request will be aborted if the provided context is
  6838. // canceled.
  6839. func (c *RolesListCall) Context(ctx context.Context) *RolesListCall {
  6840. c.ctx_ = ctx
  6841. return c
  6842. }
  6843. // Header returns an http.Header that can be modified by the caller to
  6844. // add HTTP headers to the request.
  6845. func (c *RolesListCall) Header() http.Header {
  6846. if c.header_ == nil {
  6847. c.header_ = make(http.Header)
  6848. }
  6849. return c.header_
  6850. }
  6851. func (c *RolesListCall) doRequest(alt string) (*http.Response, error) {
  6852. reqHeaders := make(http.Header)
  6853. for k, v := range c.header_ {
  6854. reqHeaders[k] = v
  6855. }
  6856. reqHeaders.Set("User-Agent", c.s.userAgent())
  6857. if c.ifNoneMatch_ != "" {
  6858. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6859. }
  6860. var body io.Reader = nil
  6861. c.urlParams_.Set("alt", alt)
  6862. c.urlParams_.Set("prettyPrint", "false")
  6863. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/roles")
  6864. urls += "?" + c.urlParams_.Encode()
  6865. req, err := http.NewRequest("GET", urls, body)
  6866. if err != nil {
  6867. return nil, err
  6868. }
  6869. req.Header = reqHeaders
  6870. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6871. }
  6872. // Do executes the "iam.roles.list" call.
  6873. // Exactly one of *ListRolesResponse or error will be non-nil. Any
  6874. // non-2xx status code is an error. Response headers are in either
  6875. // *ListRolesResponse.ServerResponse.Header or (if a response was
  6876. // returned at all) in error.(*googleapi.Error).Header. Use
  6877. // googleapi.IsNotModified to check whether the returned error was
  6878. // because http.StatusNotModified was returned.
  6879. func (c *RolesListCall) Do(opts ...googleapi.CallOption) (*ListRolesResponse, error) {
  6880. gensupport.SetOptions(c.urlParams_, opts...)
  6881. res, err := c.doRequest("json")
  6882. if res != nil && res.StatusCode == http.StatusNotModified {
  6883. if res.Body != nil {
  6884. res.Body.Close()
  6885. }
  6886. return nil, &googleapi.Error{
  6887. Code: res.StatusCode,
  6888. Header: res.Header,
  6889. }
  6890. }
  6891. if err != nil {
  6892. return nil, err
  6893. }
  6894. defer googleapi.CloseBody(res)
  6895. if err := googleapi.CheckResponse(res); err != nil {
  6896. return nil, err
  6897. }
  6898. ret := &ListRolesResponse{
  6899. ServerResponse: googleapi.ServerResponse{
  6900. Header: res.Header,
  6901. HTTPStatusCode: res.StatusCode,
  6902. },
  6903. }
  6904. target := &ret
  6905. if err := gensupport.DecodeResponse(target, res); err != nil {
  6906. return nil, err
  6907. }
  6908. return ret, nil
  6909. // {
  6910. // "description": "Lists the Roles defined on a resource.",
  6911. // "flatPath": "v1/roles",
  6912. // "httpMethod": "GET",
  6913. // "id": "iam.roles.list",
  6914. // "parameterOrder": [],
  6915. // "parameters": {
  6916. // "pageSize": {
  6917. // "description": "Optional limit on the number of roles to include in the response.",
  6918. // "format": "int32",
  6919. // "location": "query",
  6920. // "type": "integer"
  6921. // },
  6922. // "pageToken": {
  6923. // "description": "Optional pagination token returned in an earlier ListRolesResponse.",
  6924. // "location": "query",
  6925. // "type": "string"
  6926. // },
  6927. // "parent": {
  6928. // "description": "The resource name of the parent resource in one of the following formats:\n`` (empty string) -- this refers to curated roles.\n`organizations/{ORGANIZATION_ID}`\n`projects/{PROJECT_ID}`",
  6929. // "location": "query",
  6930. // "type": "string"
  6931. // },
  6932. // "showDeleted": {
  6933. // "description": "Include Roles that have been deleted.",
  6934. // "location": "query",
  6935. // "type": "boolean"
  6936. // },
  6937. // "view": {
  6938. // "description": "Optional view for the returned Role objects. When `FULL` is specified,\nthe `includedPermissions` field is returned, which includes a list of all\npermissions in the role. The default value is `BASIC`, which does not\nreturn the `includedPermissions` field.",
  6939. // "enum": [
  6940. // "BASIC",
  6941. // "FULL"
  6942. // ],
  6943. // "location": "query",
  6944. // "type": "string"
  6945. // }
  6946. // },
  6947. // "path": "v1/roles",
  6948. // "response": {
  6949. // "$ref": "ListRolesResponse"
  6950. // },
  6951. // "scopes": [
  6952. // "https://www.googleapis.com/auth/cloud-platform"
  6953. // ]
  6954. // }
  6955. }
  6956. // Pages invokes f for each page of results.
  6957. // A non-nil error returned from f will halt the iteration.
  6958. // The provided context supersedes any context provided to the Context method.
  6959. func (c *RolesListCall) Pages(ctx context.Context, f func(*ListRolesResponse) error) error {
  6960. c.ctx_ = ctx
  6961. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6962. for {
  6963. x, err := c.Do()
  6964. if err != nil {
  6965. return err
  6966. }
  6967. if err := f(x); err != nil {
  6968. return err
  6969. }
  6970. if x.NextPageToken == "" {
  6971. return nil
  6972. }
  6973. c.PageToken(x.NextPageToken)
  6974. }
  6975. }
  6976. // method id "iam.roles.queryGrantableRoles":
  6977. type RolesQueryGrantableRolesCall struct {
  6978. s *Service
  6979. querygrantablerolesrequest *QueryGrantableRolesRequest
  6980. urlParams_ gensupport.URLParams
  6981. ctx_ context.Context
  6982. header_ http.Header
  6983. }
  6984. // QueryGrantableRoles: Queries roles that can be granted on a
  6985. // particular resource.
  6986. // A role is grantable if it can be used as the role in a binding for a
  6987. // policy
  6988. // for that resource.
  6989. func (r *RolesService) QueryGrantableRoles(querygrantablerolesrequest *QueryGrantableRolesRequest) *RolesQueryGrantableRolesCall {
  6990. c := &RolesQueryGrantableRolesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6991. c.querygrantablerolesrequest = querygrantablerolesrequest
  6992. return c
  6993. }
  6994. // Fields allows partial responses to be retrieved. See
  6995. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6996. // for more information.
  6997. func (c *RolesQueryGrantableRolesCall) Fields(s ...googleapi.Field) *RolesQueryGrantableRolesCall {
  6998. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6999. return c
  7000. }
  7001. // Context sets the context to be used in this call's Do method. Any
  7002. // pending HTTP request will be aborted if the provided context is
  7003. // canceled.
  7004. func (c *RolesQueryGrantableRolesCall) Context(ctx context.Context) *RolesQueryGrantableRolesCall {
  7005. c.ctx_ = ctx
  7006. return c
  7007. }
  7008. // Header returns an http.Header that can be modified by the caller to
  7009. // add HTTP headers to the request.
  7010. func (c *RolesQueryGrantableRolesCall) Header() http.Header {
  7011. if c.header_ == nil {
  7012. c.header_ = make(http.Header)
  7013. }
  7014. return c.header_
  7015. }
  7016. func (c *RolesQueryGrantableRolesCall) doRequest(alt string) (*http.Response, error) {
  7017. reqHeaders := make(http.Header)
  7018. for k, v := range c.header_ {
  7019. reqHeaders[k] = v
  7020. }
  7021. reqHeaders.Set("User-Agent", c.s.userAgent())
  7022. var body io.Reader = nil
  7023. body, err := googleapi.WithoutDataWrapper.JSONReader(c.querygrantablerolesrequest)
  7024. if err != nil {
  7025. return nil, err
  7026. }
  7027. reqHeaders.Set("Content-Type", "application/json")
  7028. c.urlParams_.Set("alt", alt)
  7029. c.urlParams_.Set("prettyPrint", "false")
  7030. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/roles:queryGrantableRoles")
  7031. urls += "?" + c.urlParams_.Encode()
  7032. req, err := http.NewRequest("POST", urls, body)
  7033. if err != nil {
  7034. return nil, err
  7035. }
  7036. req.Header = reqHeaders
  7037. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7038. }
  7039. // Do executes the "iam.roles.queryGrantableRoles" call.
  7040. // Exactly one of *QueryGrantableRolesResponse or error will be non-nil.
  7041. // Any non-2xx status code is an error. Response headers are in either
  7042. // *QueryGrantableRolesResponse.ServerResponse.Header or (if a response
  7043. // was returned at all) in error.(*googleapi.Error).Header. Use
  7044. // googleapi.IsNotModified to check whether the returned error was
  7045. // because http.StatusNotModified was returned.
  7046. func (c *RolesQueryGrantableRolesCall) Do(opts ...googleapi.CallOption) (*QueryGrantableRolesResponse, error) {
  7047. gensupport.SetOptions(c.urlParams_, opts...)
  7048. res, err := c.doRequest("json")
  7049. if res != nil && res.StatusCode == http.StatusNotModified {
  7050. if res.Body != nil {
  7051. res.Body.Close()
  7052. }
  7053. return nil, &googleapi.Error{
  7054. Code: res.StatusCode,
  7055. Header: res.Header,
  7056. }
  7057. }
  7058. if err != nil {
  7059. return nil, err
  7060. }
  7061. defer googleapi.CloseBody(res)
  7062. if err := googleapi.CheckResponse(res); err != nil {
  7063. return nil, err
  7064. }
  7065. ret := &QueryGrantableRolesResponse{
  7066. ServerResponse: googleapi.ServerResponse{
  7067. Header: res.Header,
  7068. HTTPStatusCode: res.StatusCode,
  7069. },
  7070. }
  7071. target := &ret
  7072. if err := gensupport.DecodeResponse(target, res); err != nil {
  7073. return nil, err
  7074. }
  7075. return ret, nil
  7076. // {
  7077. // "description": "Queries roles that can be granted on a particular resource.\nA role is grantable if it can be used as the role in a binding for a policy\nfor that resource.",
  7078. // "flatPath": "v1/roles:queryGrantableRoles",
  7079. // "httpMethod": "POST",
  7080. // "id": "iam.roles.queryGrantableRoles",
  7081. // "parameterOrder": [],
  7082. // "parameters": {},
  7083. // "path": "v1/roles:queryGrantableRoles",
  7084. // "request": {
  7085. // "$ref": "QueryGrantableRolesRequest"
  7086. // },
  7087. // "response": {
  7088. // "$ref": "QueryGrantableRolesResponse"
  7089. // },
  7090. // "scopes": [
  7091. // "https://www.googleapis.com/auth/cloud-platform"
  7092. // ]
  7093. // }
  7094. }
  7095. // Pages invokes f for each page of results.
  7096. // A non-nil error returned from f will halt the iteration.
  7097. // The provided context supersedes any context provided to the Context method.
  7098. func (c *RolesQueryGrantableRolesCall) Pages(ctx context.Context, f func(*QueryGrantableRolesResponse) error) error {
  7099. c.ctx_ = ctx
  7100. defer func(pt string) { c.querygrantablerolesrequest.PageToken = pt }(c.querygrantablerolesrequest.PageToken) // reset paging to original point
  7101. for {
  7102. x, err := c.Do()
  7103. if err != nil {
  7104. return err
  7105. }
  7106. if err := f(x); err != nil {
  7107. return err
  7108. }
  7109. if x.NextPageToken == "" {
  7110. return nil
  7111. }
  7112. c.querygrantablerolesrequest.PageToken = x.NextPageToken
  7113. }
  7114. }