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

6356 lines
214 KiB

  1. // Package iam provides access to the Identity and Access Management (IAM) API.
  2. //
  3. // See https://cloud.google.com/iam/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/iam/v1"
  8. // ...
  9. // iamService, err := iam.New(oauthHttpClient)
  10. package iam // import "google.golang.org/api/iam/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "iam:v1"
  41. const apiName = "iam"
  42. const apiVersion = "v1"
  43. const basePath = "https://iam.googleapis.com/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage your data across Google Cloud Platform services
  47. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  48. )
  49. func New(client *http.Client) (*Service, error) {
  50. if client == nil {
  51. return nil, errors.New("client is nil")
  52. }
  53. s := &Service{client: client, BasePath: basePath}
  54. s.IamPolicies = NewIamPoliciesService(s)
  55. s.Organizations = NewOrganizationsService(s)
  56. s.Permissions = NewPermissionsService(s)
  57. s.Projects = NewProjectsService(s)
  58. s.Roles = NewRolesService(s)
  59. return s, nil
  60. }
  61. type Service struct {
  62. client *http.Client
  63. BasePath string // API endpoint base URL
  64. UserAgent string // optional additional User-Agent fragment
  65. IamPolicies *IamPoliciesService
  66. Organizations *OrganizationsService
  67. Permissions *PermissionsService
  68. Projects *ProjectsService
  69. Roles *RolesService
  70. }
  71. func (s *Service) userAgent() string {
  72. if s.UserAgent == "" {
  73. return googleapi.UserAgent
  74. }
  75. return googleapi.UserAgent + " " + s.UserAgent
  76. }
  77. func NewIamPoliciesService(s *Service) *IamPoliciesService {
  78. rs := &IamPoliciesService{s: s}
  79. return rs
  80. }
  81. type IamPoliciesService struct {
  82. s *Service
  83. }
  84. func NewOrganizationsService(s *Service) *OrganizationsService {
  85. rs := &OrganizationsService{s: s}
  86. rs.Roles = NewOrganizationsRolesService(s)
  87. return rs
  88. }
  89. type OrganizationsService struct {
  90. s *Service
  91. Roles *OrganizationsRolesService
  92. }
  93. func NewOrganizationsRolesService(s *Service) *OrganizationsRolesService {
  94. rs := &OrganizationsRolesService{s: s}
  95. return rs
  96. }
  97. type OrganizationsRolesService struct {
  98. s *Service
  99. }
  100. func NewPermissionsService(s *Service) *PermissionsService {
  101. rs := &PermissionsService{s: s}
  102. return rs
  103. }
  104. type PermissionsService struct {
  105. s *Service
  106. }
  107. func NewProjectsService(s *Service) *ProjectsService {
  108. rs := &ProjectsService{s: s}
  109. rs.Roles = NewProjectsRolesService(s)
  110. rs.ServiceAccounts = NewProjectsServiceAccountsService(s)
  111. return rs
  112. }
  113. type ProjectsService struct {
  114. s *Service
  115. Roles *ProjectsRolesService
  116. ServiceAccounts *ProjectsServiceAccountsService
  117. }
  118. func NewProjectsRolesService(s *Service) *ProjectsRolesService {
  119. rs := &ProjectsRolesService{s: s}
  120. return rs
  121. }
  122. type ProjectsRolesService struct {
  123. s *Service
  124. }
  125. func NewProjectsServiceAccountsService(s *Service) *ProjectsServiceAccountsService {
  126. rs := &ProjectsServiceAccountsService{s: s}
  127. rs.Keys = NewProjectsServiceAccountsKeysService(s)
  128. return rs
  129. }
  130. type ProjectsServiceAccountsService struct {
  131. s *Service
  132. Keys *ProjectsServiceAccountsKeysService
  133. }
  134. func NewProjectsServiceAccountsKeysService(s *Service) *ProjectsServiceAccountsKeysService {
  135. rs := &ProjectsServiceAccountsKeysService{s: s}
  136. return rs
  137. }
  138. type ProjectsServiceAccountsKeysService struct {
  139. s *Service
  140. }
  141. func NewRolesService(s *Service) *RolesService {
  142. rs := &RolesService{s: s}
  143. return rs
  144. }
  145. type RolesService struct {
  146. s *Service
  147. }
  148. // AuditConfig: Specifies the audit configuration for a service.
  149. // The configuration determines which permission types are logged, and
  150. // what
  151. // identities, if any, are exempted from logging.
  152. // An AuditConfig must have one or more AuditLogConfigs.
  153. //
  154. // If there are AuditConfigs for both `allServices` and a specific
  155. // service,
  156. // the union of the two AuditConfigs is used for that service: the
  157. // log_types
  158. // specified in each AuditConfig are enabled, and the exempted_members
  159. // in each
  160. // AuditLogConfig are exempted.
  161. //
  162. // Example Policy with multiple AuditConfigs:
  163. //
  164. // {
  165. // "audit_configs": [
  166. // {
  167. // "service": "allServices"
  168. // "audit_log_configs": [
  169. // {
  170. // "log_type": "DATA_READ",
  171. // "exempted_members": [
  172. // "user:foo@gmail.com"
  173. // ]
  174. // },
  175. // {
  176. // "log_type": "DATA_WRITE",
  177. // },
  178. // {
  179. // "log_type": "ADMIN_READ",
  180. // }
  181. // ]
  182. // },
  183. // {
  184. // "service": "fooservice.googleapis.com"
  185. // "audit_log_configs": [
  186. // {
  187. // "log_type": "DATA_READ",
  188. // },
  189. // {
  190. // "log_type": "DATA_WRITE",
  191. // "exempted_members": [
  192. // "user:bar@gmail.com"
  193. // ]
  194. // }
  195. // ]
  196. // }
  197. // ]
  198. // }
  199. //
  200. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  201. // ADMIN_READ
  202. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  203. // and
  204. // bar@gmail.com from DATA_WRITE logging.
  205. type AuditConfig struct {
  206. // AuditLogConfigs: The configuration for logging of each type of
  207. // permission.
  208. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  209. // Service: Specifies a service that will be enabled for audit
  210. // logging.
  211. // For example, `storage.googleapis.com`,
  212. // `cloudsql.googleapis.com`.
  213. // `allServices` is a special value that covers all services.
  214. Service string `json:"service,omitempty"`
  215. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  216. // unconditionally include in API requests. By default, fields with
  217. // empty values are omitted from API requests. However, any non-pointer,
  218. // non-interface field appearing in ForceSendFields will be sent to the
  219. // server regardless of whether the field is empty or not. This may be
  220. // used to include empty fields in Patch requests.
  221. ForceSendFields []string `json:"-"`
  222. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  223. // include in API requests with the JSON null value. By default, fields
  224. // with empty values are omitted from API requests. However, any field
  225. // with an empty value appearing in NullFields will be sent to the
  226. // server as null. It is an error if a field in this list has a
  227. // non-empty value. This may be used to include null fields in Patch
  228. // requests.
  229. NullFields []string `json:"-"`
  230. }
  231. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  232. type NoMethod AuditConfig
  233. raw := NoMethod(*s)
  234. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  235. }
  236. // AuditData: Audit log information specific to Cloud IAM. This message
  237. // is serialized
  238. // as an `Any` type in the `ServiceData` message of an
  239. // `AuditLog` message.
  240. type AuditData struct {
  241. // PolicyDelta: Policy delta between the original policy and the newly
  242. // set policy.
  243. PolicyDelta *PolicyDelta `json:"policyDelta,omitempty"`
  244. // ForceSendFields is a list of field names (e.g. "PolicyDelta") to
  245. // unconditionally include in API requests. By default, fields with
  246. // empty values are omitted from API requests. However, any non-pointer,
  247. // non-interface field appearing in ForceSendFields will be sent to the
  248. // server regardless of whether the field is empty or not. This may be
  249. // used to include empty fields in Patch requests.
  250. ForceSendFields []string `json:"-"`
  251. // NullFields is a list of field names (e.g. "PolicyDelta") to include
  252. // in API requests with the JSON null value. By default, fields with
  253. // empty values are omitted from API requests. However, any field with
  254. // an empty value appearing in NullFields will be sent to the server as
  255. // null. It is an error if a field in this list has a non-empty value.
  256. // This may be used to include null fields in Patch requests.
  257. NullFields []string `json:"-"`
  258. }
  259. func (s *AuditData) MarshalJSON() ([]byte, error) {
  260. type NoMethod AuditData
  261. raw := NoMethod(*s)
  262. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  263. }
  264. // AuditLogConfig: Provides the configuration for logging a type of
  265. // permissions.
  266. // Example:
  267. //
  268. // {
  269. // "audit_log_configs": [
  270. // {
  271. // "log_type": "DATA_READ",
  272. // "exempted_members": [
  273. // "user:foo@gmail.com"
  274. // ]
  275. // },
  276. // {
  277. // "log_type": "DATA_WRITE",
  278. // }
  279. // ]
  280. // }
  281. //
  282. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  283. // exempting
  284. // foo@gmail.com from DATA_READ logging.
  285. type AuditLogConfig struct {
  286. // ExemptedMembers: Specifies the identities that do not cause logging
  287. // for this type of
  288. // permission.
  289. // Follows the same format of Binding.members.
  290. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  291. // LogType: The log type that this config enables.
  292. //
  293. // Possible values:
  294. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  295. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  296. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  297. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  298. LogType string `json:"logType,omitempty"`
  299. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  300. // unconditionally include in API requests. By default, fields with
  301. // empty values are omitted from API requests. However, any non-pointer,
  302. // non-interface field appearing in ForceSendFields will be sent to the
  303. // server regardless of whether the field is empty or not. This may be
  304. // used to include empty fields in Patch requests.
  305. ForceSendFields []string `json:"-"`
  306. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  307. // include in API requests with the JSON null value. By default, fields
  308. // with empty values are omitted from API requests. However, any field
  309. // with an empty value appearing in NullFields will be sent to the
  310. // server as null. It is an error if a field in this list has a
  311. // non-empty value. This may be used to include null fields in Patch
  312. // requests.
  313. NullFields []string `json:"-"`
  314. }
  315. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  316. type NoMethod AuditLogConfig
  317. raw := NoMethod(*s)
  318. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  319. }
  320. // AuditableService: Contains information about an auditable service.
  321. type AuditableService struct {
  322. // Name: Public name of the service.
  323. // For example, the service name for Cloud IAM is 'iam.googleapis.com'.
  324. Name string `json:"name,omitempty"`
  325. // ForceSendFields is a list of field names (e.g. "Name") to
  326. // unconditionally include in API requests. By default, fields with
  327. // empty values are omitted from API requests. However, any non-pointer,
  328. // non-interface field appearing in ForceSendFields will be sent to the
  329. // server regardless of whether the field is empty or not. This may be
  330. // used to include empty fields in Patch requests.
  331. ForceSendFields []string `json:"-"`
  332. // NullFields is a list of field names (e.g. "Name") to include in API
  333. // requests with the JSON null value. By default, fields with empty
  334. // values are omitted from API requests. However, any field with an
  335. // empty value appearing in NullFields will be sent to the server as
  336. // null. It is an error if a field in this list has a non-empty value.
  337. // This may be used to include null fields in Patch requests.
  338. NullFields []string `json:"-"`
  339. }
  340. func (s *AuditableService) MarshalJSON() ([]byte, error) {
  341. type NoMethod AuditableService
  342. raw := NoMethod(*s)
  343. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  344. }
  345. // Binding: Associates `members` with a `role`.
  346. type Binding struct {
  347. // Members: Specifies the identities requesting access for a Cloud
  348. // Platform resource.
  349. // `members` can have the following values:
  350. //
  351. // * `allUsers`: A special identifier that represents anyone who is
  352. // on the internet; with or without a Google account.
  353. //
  354. // * `allAuthenticatedUsers`: A special identifier that represents
  355. // anyone
  356. // who is authenticated with a Google account or a service
  357. // account.
  358. //
  359. // * `user:{emailid}`: An email address that represents a specific
  360. // Google
  361. // account. For example, `alice@gmail.com` .
  362. //
  363. //
  364. // * `serviceAccount:{emailid}`: An email address that represents a
  365. // service
  366. // account. For example,
  367. // `my-other-app@appspot.gserviceaccount.com`.
  368. //
  369. // * `group:{emailid}`: An email address that represents a Google
  370. // group.
  371. // For example, `admins@example.com`.
  372. //
  373. //
  374. // * `domain:{domain}`: A Google Apps domain name that represents all
  375. // the
  376. // users of that domain. For example, `google.com` or
  377. // `example.com`.
  378. //
  379. //
  380. Members []string `json:"members,omitempty"`
  381. // Role: Role that is assigned to `members`.
  382. // For example, `roles/viewer`, `roles/editor`, or
  383. // `roles/owner`.
  384. // Required
  385. Role string `json:"role,omitempty"`
  386. // ForceSendFields is a list of field names (e.g. "Members") to
  387. // unconditionally include in API requests. By default, fields with
  388. // empty values are omitted from API requests. However, any non-pointer,
  389. // non-interface field appearing in ForceSendFields will be sent to the
  390. // server regardless of whether the field is empty or not. This may be
  391. // used to include empty fields in Patch requests.
  392. ForceSendFields []string `json:"-"`
  393. // NullFields is a list of field names (e.g. "Members") to include in
  394. // API requests with the JSON null value. By default, fields with empty
  395. // values are omitted from API requests. However, any field with an
  396. // empty value appearing in NullFields will be sent to the server as
  397. // null. It is an error if a field in this list has a non-empty value.
  398. // This may be used to include null fields in Patch requests.
  399. NullFields []string `json:"-"`
  400. }
  401. func (s *Binding) MarshalJSON() ([]byte, error) {
  402. type NoMethod Binding
  403. raw := NoMethod(*s)
  404. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  405. }
  406. // BindingDelta: One delta entry for Binding. Each individual change
  407. // (only one member in each
  408. // entry) to a binding will be a separate entry.
  409. type BindingDelta struct {
  410. // Action: The action that was performed on a Binding.
  411. // Required
  412. //
  413. // Possible values:
  414. // "ACTION_UNSPECIFIED" - Unspecified.
  415. // "ADD" - Addition of a Binding.
  416. // "REMOVE" - Removal of a Binding.
  417. Action string `json:"action,omitempty"`
  418. // Member: A single identity requesting access for a Cloud Platform
  419. // resource.
  420. // Follows the same format of Binding.members.
  421. // Required
  422. Member string `json:"member,omitempty"`
  423. // Role: Role that is assigned to `members`.
  424. // For example, `roles/viewer`, `roles/editor`, or
  425. // `roles/owner`.
  426. // Required
  427. Role string `json:"role,omitempty"`
  428. // ForceSendFields is a list of field names (e.g. "Action") to
  429. // unconditionally include in API requests. By default, fields with
  430. // empty values are omitted from API requests. However, any non-pointer,
  431. // non-interface field appearing in ForceSendFields will be sent to the
  432. // server regardless of whether the field is empty or not. This may be
  433. // used to include empty fields in Patch requests.
  434. ForceSendFields []string `json:"-"`
  435. // NullFields is a list of field names (e.g. "Action") to include in API
  436. // requests with the JSON null value. By default, fields with empty
  437. // values are omitted from API requests. However, any field with an
  438. // empty value appearing in NullFields will be sent to the server as
  439. // null. It is an error if a field in this list has a non-empty value.
  440. // This may be used to include null fields in Patch requests.
  441. NullFields []string `json:"-"`
  442. }
  443. func (s *BindingDelta) MarshalJSON() ([]byte, error) {
  444. type NoMethod BindingDelta
  445. raw := NoMethod(*s)
  446. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  447. }
  448. // CreateRoleRequest: The request to create a new role.
  449. type CreateRoleRequest struct {
  450. // Role: The Role resource to create.
  451. Role *Role `json:"role,omitempty"`
  452. // RoleId: The role id to use for this role.
  453. RoleId string `json:"roleId,omitempty"`
  454. // ForceSendFields is a list of field names (e.g. "Role") to
  455. // unconditionally include in API requests. By default, fields with
  456. // empty values are omitted from API requests. However, any non-pointer,
  457. // non-interface field appearing in ForceSendFields will be sent to the
  458. // server regardless of whether the field is empty or not. This may be
  459. // used to include empty fields in Patch requests.
  460. ForceSendFields []string `json:"-"`
  461. // NullFields is a list of field names (e.g. "Role") to include in API
  462. // requests with the JSON null value. By default, fields with empty
  463. // values are omitted from API requests. However, any field with an
  464. // empty value appearing in NullFields will be sent to the server as
  465. // null. It is an error if a field in this list has a non-empty value.
  466. // This may be used to include null fields in Patch requests.
  467. NullFields []string `json:"-"`
  468. }
  469. func (s *CreateRoleRequest) MarshalJSON() ([]byte, error) {
  470. type NoMethod CreateRoleRequest
  471. raw := NoMethod(*s)
  472. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  473. }
  474. // CreateServiceAccountKeyRequest: The service account key create
  475. // request.
  476. type CreateServiceAccountKeyRequest struct {
  477. // KeyAlgorithm: Which type of key and algorithm to use for the key.
  478. // The default is currently a 2K RSA key. However this may change in
  479. // the
  480. // future.
  481. //
  482. // Possible values:
  483. // "KEY_ALG_UNSPECIFIED" - An unspecified key algorithm.
  484. // "KEY_ALG_RSA_1024" - 1k RSA Key.
  485. // "KEY_ALG_RSA_2048" - 2k RSA Key.
  486. KeyAlgorithm string `json:"keyAlgorithm,omitempty"`
  487. // PrivateKeyType: The output format of the private key. The default
  488. // value is
  489. // `TYPE_GOOGLE_CREDENTIALS_FILE`, which is the Google Credentials
  490. // File
  491. // format.
  492. //
  493. // Possible values:
  494. // "TYPE_UNSPECIFIED" - Unspecified. Equivalent to
  495. // `TYPE_GOOGLE_CREDENTIALS_FILE`.
  496. // "TYPE_PKCS12_FILE" - PKCS12 format.
  497. // The password for the PKCS12 file is `notasecret`.
  498. // For more information, see https://tools.ietf.org/html/rfc7292.
  499. // "TYPE_GOOGLE_CREDENTIALS_FILE" - Google Credentials File format.
  500. PrivateKeyType string `json:"privateKeyType,omitempty"`
  501. // ForceSendFields is a list of field names (e.g. "KeyAlgorithm") to
  502. // unconditionally include in API requests. By default, fields with
  503. // empty values are omitted from API requests. However, any non-pointer,
  504. // non-interface field appearing in ForceSendFields will be sent to the
  505. // server regardless of whether the field is empty or not. This may be
  506. // used to include empty fields in Patch requests.
  507. ForceSendFields []string `json:"-"`
  508. // NullFields is a list of field names (e.g. "KeyAlgorithm") to include
  509. // in API requests with the JSON null value. By default, fields with
  510. // empty values are omitted from API requests. However, any field with
  511. // an empty value appearing in NullFields will be sent to the server as
  512. // null. It is an error if a field in this list has a non-empty value.
  513. // This may be used to include null fields in Patch requests.
  514. NullFields []string `json:"-"`
  515. }
  516. func (s *CreateServiceAccountKeyRequest) MarshalJSON() ([]byte, error) {
  517. type NoMethod CreateServiceAccountKeyRequest
  518. raw := NoMethod(*s)
  519. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  520. }
  521. // CreateServiceAccountRequest: The service account create request.
  522. type CreateServiceAccountRequest struct {
  523. // AccountId: Required. The account id that is used to generate the
  524. // service account
  525. // email address and a stable unique id. It is unique within a
  526. // project,
  527. // must be 6-30 characters long, and match the regular
  528. // expression
  529. // `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
  530. AccountId string `json:"accountId,omitempty"`
  531. // ServiceAccount: The ServiceAccount resource to create.
  532. // Currently, only the following values are user
  533. // assignable:
  534. // `display_name` .
  535. ServiceAccount *ServiceAccount `json:"serviceAccount,omitempty"`
  536. // ForceSendFields is a list of field names (e.g. "AccountId") to
  537. // unconditionally include in API requests. By default, fields with
  538. // empty values are omitted from API requests. However, any non-pointer,
  539. // non-interface field appearing in ForceSendFields will be sent to the
  540. // server regardless of whether the field is empty or not. This may be
  541. // used to include empty fields in Patch requests.
  542. ForceSendFields []string `json:"-"`
  543. // NullFields is a list of field names (e.g. "AccountId") to include in
  544. // API requests with the JSON null value. By default, fields with empty
  545. // values are omitted from API requests. However, any field with an
  546. // empty value appearing in NullFields will be sent to the server as
  547. // null. It is an error if a field in this list has a non-empty value.
  548. // This may be used to include null fields in Patch requests.
  549. NullFields []string `json:"-"`
  550. }
  551. func (s *CreateServiceAccountRequest) MarshalJSON() ([]byte, error) {
  552. type NoMethod CreateServiceAccountRequest
  553. raw := NoMethod(*s)
  554. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  555. }
  556. // Empty: A generic empty message that you can re-use to avoid defining
  557. // duplicated
  558. // empty messages in your APIs. A typical example is to use it as the
  559. // request
  560. // or the response type of an API method. For instance:
  561. //
  562. // service Foo {
  563. // rpc Bar(google.protobuf.Empty) returns
  564. // (google.protobuf.Empty);
  565. // }
  566. //
  567. // The JSON representation for `Empty` is empty JSON object `{}`.
  568. type Empty struct {
  569. // ServerResponse contains the HTTP response code and headers from the
  570. // server.
  571. googleapi.ServerResponse `json:"-"`
  572. }
  573. // ListRolesResponse: The response containing the roles defined under a
  574. // resource.
  575. type ListRolesResponse struct {
  576. // NextPageToken: To retrieve the next page of results,
  577. // set
  578. // `ListRolesRequest.page_token` to this value.
  579. NextPageToken string `json:"nextPageToken,omitempty"`
  580. // Roles: The Roles defined on this resource.
  581. Roles []*Role `json:"roles,omitempty"`
  582. // ServerResponse contains the HTTP response code and headers from the
  583. // server.
  584. googleapi.ServerResponse `json:"-"`
  585. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  586. // unconditionally include in API requests. By default, fields with
  587. // empty values are omitted from API requests. However, any non-pointer,
  588. // non-interface field appearing in ForceSendFields will be sent to the
  589. // server regardless of whether the field is empty or not. This may be
  590. // used to include empty fields in Patch requests.
  591. ForceSendFields []string `json:"-"`
  592. // NullFields is a list of field names (e.g. "NextPageToken") to include
  593. // in API requests with the JSON null value. By default, fields with
  594. // empty values are omitted from API requests. However, any field with
  595. // an empty value appearing in NullFields will be sent to the server as
  596. // null. It is an error if a field in this list has a non-empty value.
  597. // This may be used to include null fields in Patch requests.
  598. NullFields []string `json:"-"`
  599. }
  600. func (s *ListRolesResponse) MarshalJSON() ([]byte, error) {
  601. type NoMethod ListRolesResponse
  602. raw := NoMethod(*s)
  603. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  604. }
  605. // ListServiceAccountKeysResponse: The service account keys list
  606. // response.
  607. type ListServiceAccountKeysResponse struct {
  608. // Keys: The public keys for the service account.
  609. Keys []*ServiceAccountKey `json:"keys,omitempty"`
  610. // ServerResponse contains the HTTP response code and headers from the
  611. // server.
  612. googleapi.ServerResponse `json:"-"`
  613. // ForceSendFields is a list of field names (e.g. "Keys") to
  614. // unconditionally include in API requests. By default, fields with
  615. // empty values are omitted from API requests. However, any non-pointer,
  616. // non-interface field appearing in ForceSendFields will be sent to the
  617. // server regardless of whether the field is empty or not. This may be
  618. // used to include empty fields in Patch requests.
  619. ForceSendFields []string `json:"-"`
  620. // NullFields is a list of field names (e.g. "Keys") to include in API
  621. // requests with the JSON null value. By default, fields with empty
  622. // values are omitted from API requests. However, any field with an
  623. // empty value appearing in NullFields will be sent to the server as
  624. // null. It is an error if a field in this list has a non-empty value.
  625. // This may be used to include null fields in Patch requests.
  626. NullFields []string `json:"-"`
  627. }
  628. func (s *ListServiceAccountKeysResponse) MarshalJSON() ([]byte, error) {
  629. type NoMethod ListServiceAccountKeysResponse
  630. raw := NoMethod(*s)
  631. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  632. }
  633. // ListServiceAccountsResponse: The service account list response.
  634. type ListServiceAccountsResponse struct {
  635. // Accounts: The list of matching service accounts.
  636. Accounts []*ServiceAccount `json:"accounts,omitempty"`
  637. // NextPageToken: To retrieve the next page of results,
  638. // set
  639. // ListServiceAccountsRequest.page_token
  640. // to this value.
  641. NextPageToken string `json:"nextPageToken,omitempty"`
  642. // ServerResponse contains the HTTP response code and headers from the
  643. // server.
  644. googleapi.ServerResponse `json:"-"`
  645. // ForceSendFields is a list of field names (e.g. "Accounts") to
  646. // unconditionally include in API requests. By default, fields with
  647. // empty values are omitted from API requests. However, any non-pointer,
  648. // non-interface field appearing in ForceSendFields will be sent to the
  649. // server regardless of whether the field is empty or not. This may be
  650. // used to include empty fields in Patch requests.
  651. ForceSendFields []string `json:"-"`
  652. // NullFields is a list of field names (e.g. "Accounts") to include in
  653. // API requests with the JSON null value. By default, fields with empty
  654. // values are omitted from API requests. However, any field with an
  655. // empty value appearing in NullFields will be sent to the server as
  656. // null. It is an error if a field in this list has a non-empty value.
  657. // This may be used to include null fields in Patch requests.
  658. NullFields []string `json:"-"`
  659. }
  660. func (s *ListServiceAccountsResponse) MarshalJSON() ([]byte, error) {
  661. type NoMethod ListServiceAccountsResponse
  662. raw := NoMethod(*s)
  663. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  664. }
  665. // Permission: A permission which can be included by a role.
  666. type Permission struct {
  667. // ApiDisabled: The service API associated with the permission is not
  668. // enabled.
  669. ApiDisabled bool `json:"apiDisabled,omitempty"`
  670. // CustomRolesSupportLevel: The current custom role support level.
  671. //
  672. // Possible values:
  673. // "SUPPORTED" - Permission is fully supported for custom role use.
  674. // "TESTING" - Permission is being tested to check custom role
  675. // compatibility.
  676. // "NOT_SUPPORTED" - Permission is not supported for custom role use.
  677. CustomRolesSupportLevel string `json:"customRolesSupportLevel,omitempty"`
  678. // Description: A brief description of what this Permission is used for.
  679. Description string `json:"description,omitempty"`
  680. // Name: The name of this Permission.
  681. Name string `json:"name,omitempty"`
  682. // OnlyInPredefinedRoles: This permission can ONLY be used in predefined
  683. // roles.
  684. OnlyInPredefinedRoles bool `json:"onlyInPredefinedRoles,omitempty"`
  685. // Stage: The current launch stage of the permission.
  686. //
  687. // Possible values:
  688. // "ALPHA" - The permission is currently in an alpha phase.
  689. // "BETA" - The permission is currently in a beta phase.
  690. // "GA" - The permission is generally available.
  691. // "DEPRECATED" - The permission is being deprecated.
  692. Stage string `json:"stage,omitempty"`
  693. // Title: The title of this Permission.
  694. Title string `json:"title,omitempty"`
  695. // ForceSendFields is a list of field names (e.g. "ApiDisabled") to
  696. // unconditionally include in API requests. By default, fields with
  697. // empty values are omitted from API requests. However, any non-pointer,
  698. // non-interface field appearing in ForceSendFields will be sent to the
  699. // server regardless of whether the field is empty or not. This may be
  700. // used to include empty fields in Patch requests.
  701. ForceSendFields []string `json:"-"`
  702. // NullFields is a list of field names (e.g. "ApiDisabled") to include
  703. // in API requests with the JSON null value. By default, fields with
  704. // empty values are omitted from API requests. However, any field with
  705. // an empty value appearing in NullFields will be sent to the server as
  706. // null. It is an error if a field in this list has a non-empty value.
  707. // This may be used to include null fields in Patch requests.
  708. NullFields []string `json:"-"`
  709. }
  710. func (s *Permission) MarshalJSON() ([]byte, error) {
  711. type NoMethod Permission
  712. raw := NoMethod(*s)
  713. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  714. }
  715. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  716. // used to
  717. // specify access control policies for Cloud Platform resources.
  718. //
  719. //
  720. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  721. // of
  722. // `members` to a `role`, where the members can be user accounts, Google
  723. // groups,
  724. // Google domains, and service accounts. A `role` is a named list of
  725. // permissions
  726. // defined by IAM.
  727. //
  728. // **JSON Example**
  729. //
  730. // {
  731. // "bindings": [
  732. // {
  733. // "role": "roles/owner",
  734. // "members": [
  735. // "user:mike@example.com",
  736. // "group:admins@example.com",
  737. // "domain:google.com",
  738. //
  739. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  740. // ]
  741. // },
  742. // {
  743. // "role": "roles/viewer",
  744. // "members": ["user:sean@example.com"]
  745. // }
  746. // ]
  747. // }
  748. //
  749. // **YAML Example**
  750. //
  751. // bindings:
  752. // - members:
  753. // - user:mike@example.com
  754. // - group:admins@example.com
  755. // - domain:google.com
  756. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  757. // role: roles/owner
  758. // - members:
  759. // - user:sean@example.com
  760. // role: roles/viewer
  761. //
  762. //
  763. // For a description of IAM and its features, see the
  764. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  765. type Policy struct {
  766. // AuditConfigs: Specifies cloud audit logging configuration for this
  767. // policy.
  768. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  769. // Bindings: Associates a list of `members` to a `role`.
  770. // `bindings` with no members will result in an error.
  771. Bindings []*Binding `json:"bindings,omitempty"`
  772. // Etag: `etag` is used for optimistic concurrency control as a way to
  773. // help
  774. // prevent simultaneous updates of a policy from overwriting each
  775. // other.
  776. // It is strongly suggested that systems make use of the `etag` in
  777. // the
  778. // read-modify-write cycle to perform policy updates in order to avoid
  779. // race
  780. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  781. // and
  782. // systems are expected to put that etag in the request to
  783. // `setIamPolicy` to
  784. // ensure that their change will be applied to the same version of the
  785. // policy.
  786. //
  787. // If no `etag` is provided in the call to `setIamPolicy`, then the
  788. // existing
  789. // policy is overwritten blindly.
  790. Etag string `json:"etag,omitempty"`
  791. // Version: Deprecated.
  792. Version int64 `json:"version,omitempty"`
  793. // ServerResponse contains the HTTP response code and headers from the
  794. // server.
  795. googleapi.ServerResponse `json:"-"`
  796. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  797. // unconditionally include in API requests. By default, fields with
  798. // empty values are omitted from API requests. However, any non-pointer,
  799. // non-interface field appearing in ForceSendFields will be sent to the
  800. // server regardless of whether the field is empty or not. This may be
  801. // used to include empty fields in Patch requests.
  802. ForceSendFields []string `json:"-"`
  803. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  804. // in API requests with the JSON null value. By default, fields with
  805. // empty values are omitted from API requests. However, any field with
  806. // an empty value appearing in NullFields will be sent to the server as
  807. // null. It is an error if a field in this list has a non-empty value.
  808. // This may be used to include null fields in Patch requests.
  809. NullFields []string `json:"-"`
  810. }
  811. func (s *Policy) MarshalJSON() ([]byte, error) {
  812. type NoMethod Policy
  813. raw := NoMethod(*s)
  814. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  815. }
  816. // PolicyDelta: The difference delta between two policies.
  817. type PolicyDelta struct {
  818. // BindingDeltas: The delta for Bindings between two policies.
  819. BindingDeltas []*BindingDelta `json:"bindingDeltas,omitempty"`
  820. // ForceSendFields is a list of field names (e.g. "BindingDeltas") to
  821. // unconditionally include in API requests. By default, fields with
  822. // empty values are omitted from API requests. However, any non-pointer,
  823. // non-interface field appearing in ForceSendFields will be sent to the
  824. // server regardless of whether the field is empty or not. This may be
  825. // used to include empty fields in Patch requests.
  826. ForceSendFields []string `json:"-"`
  827. // NullFields is a list of field names (e.g. "BindingDeltas") to include
  828. // in API requests with the JSON null value. By default, fields with
  829. // empty values are omitted from API requests. However, any field with
  830. // an empty value appearing in NullFields will be sent to the server as
  831. // null. It is an error if a field in this list has a non-empty value.
  832. // This may be used to include null fields in Patch requests.
  833. NullFields []string `json:"-"`
  834. }
  835. func (s *PolicyDelta) MarshalJSON() ([]byte, error) {
  836. type NoMethod PolicyDelta
  837. raw := NoMethod(*s)
  838. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  839. }
  840. // QueryAuditableServicesRequest: A request to get the list of auditable
  841. // services for a resource.
  842. type QueryAuditableServicesRequest struct {
  843. // FullResourceName: Required. The full resource name to query from the
  844. // list of auditable
  845. // services.
  846. //
  847. // The name follows the Google Cloud Platform resource format.
  848. // For example, a Cloud Platform project with id `my-project` will be
  849. // named
  850. // `//cloudresourcemanager.googleapis.com/projects/my-project`.
  851. FullResourceName string `json:"fullResourceName,omitempty"`
  852. // ForceSendFields is a list of field names (e.g. "FullResourceName") to
  853. // unconditionally include in API requests. By default, fields with
  854. // empty values are omitted from API requests. However, any non-pointer,
  855. // non-interface field appearing in ForceSendFields will be sent to the
  856. // server regardless of whether the field is empty or not. This may be
  857. // used to include empty fields in Patch requests.
  858. ForceSendFields []string `json:"-"`
  859. // NullFields is a list of field names (e.g. "FullResourceName") to
  860. // include in API requests with the JSON null value. By default, fields
  861. // with empty values are omitted from API requests. However, any field
  862. // with an empty value appearing in NullFields will be sent to the
  863. // server as null. It is an error if a field in this list has a
  864. // non-empty value. This may be used to include null fields in Patch
  865. // requests.
  866. NullFields []string `json:"-"`
  867. }
  868. func (s *QueryAuditableServicesRequest) MarshalJSON() ([]byte, error) {
  869. type NoMethod QueryAuditableServicesRequest
  870. raw := NoMethod(*s)
  871. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  872. }
  873. // QueryAuditableServicesResponse: A response containing a list of
  874. // auditable services for a resource.
  875. type QueryAuditableServicesResponse struct {
  876. // Services: The auditable services for a resource.
  877. Services []*AuditableService `json:"services,omitempty"`
  878. // ServerResponse contains the HTTP response code and headers from the
  879. // server.
  880. googleapi.ServerResponse `json:"-"`
  881. // ForceSendFields is a list of field names (e.g. "Services") to
  882. // unconditionally include in API requests. By default, fields with
  883. // empty values are omitted from API requests. However, any non-pointer,
  884. // non-interface field appearing in ForceSendFields will be sent to the
  885. // server regardless of whether the field is empty or not. This may be
  886. // used to include empty fields in Patch requests.
  887. ForceSendFields []string `json:"-"`
  888. // NullFields is a list of field names (e.g. "Services") to include in
  889. // API requests with the JSON null value. By default, fields with empty
  890. // values are omitted from API requests. However, any field with an
  891. // empty value appearing in NullFields will be sent to the server as
  892. // null. It is an error if a field in this list has a non-empty value.
  893. // This may be used to include null fields in Patch requests.
  894. NullFields []string `json:"-"`
  895. }
  896. func (s *QueryAuditableServicesResponse) MarshalJSON() ([]byte, error) {
  897. type NoMethod QueryAuditableServicesResponse
  898. raw := NoMethod(*s)
  899. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  900. }
  901. // QueryGrantableRolesRequest: The grantable role query request.
  902. type QueryGrantableRolesRequest struct {
  903. // FullResourceName: Required. The full resource name to query from the
  904. // list of grantable roles.
  905. //
  906. // The name follows the Google Cloud Platform resource format.
  907. // For example, a Cloud Platform project with id `my-project` will be
  908. // named
  909. // `//cloudresourcemanager.googleapis.com/projects/my-project`.
  910. FullResourceName string `json:"fullResourceName,omitempty"`
  911. // PageSize: Optional limit on the number of roles to include in the
  912. // response.
  913. PageSize int64 `json:"pageSize,omitempty"`
  914. // PageToken: Optional pagination token returned in an
  915. // earlier
  916. // QueryGrantableRolesResponse.
  917. PageToken string `json:"pageToken,omitempty"`
  918. // Possible values:
  919. // "BASIC" - Omits the `included_permissions` field.
  920. // This is the default value.
  921. // "FULL" - Returns all fields.
  922. View string `json:"view,omitempty"`
  923. // ForceSendFields is a list of field names (e.g. "FullResourceName") to
  924. // unconditionally include in API requests. By default, fields with
  925. // empty values are omitted from API requests. However, any non-pointer,
  926. // non-interface field appearing in ForceSendFields will be sent to the
  927. // server regardless of whether the field is empty or not. This may be
  928. // used to include empty fields in Patch requests.
  929. ForceSendFields []string `json:"-"`
  930. // NullFields is a list of field names (e.g. "FullResourceName") to
  931. // include in API requests with the JSON null value. By default, fields
  932. // with empty values are omitted from API requests. However, any field
  933. // with an empty value appearing in NullFields will be sent to the
  934. // server as null. It is an error if a field in this list has a
  935. // non-empty value. This may be used to include null fields in Patch
  936. // requests.
  937. NullFields []string `json:"-"`
  938. }
  939. func (s *QueryGrantableRolesRequest) MarshalJSON() ([]byte, error) {
  940. type NoMethod QueryGrantableRolesRequest
  941. raw := NoMethod(*s)
  942. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  943. }
  944. // QueryGrantableRolesResponse: The grantable role query response.
  945. type QueryGrantableRolesResponse struct {
  946. // NextPageToken: To retrieve the next page of results,
  947. // set
  948. // `QueryGrantableRolesRequest.page_token` to this value.
  949. NextPageToken string `json:"nextPageToken,omitempty"`
  950. // Roles: The list of matching roles.
  951. Roles []*Role `json:"roles,omitempty"`
  952. // ServerResponse contains the HTTP response code and headers from the
  953. // server.
  954. googleapi.ServerResponse `json:"-"`
  955. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  956. // unconditionally include in API requests. By default, fields with
  957. // empty values are omitted from API requests. However, any non-pointer,
  958. // non-interface field appearing in ForceSendFields will be sent to the
  959. // server regardless of whether the field is empty or not. This may be
  960. // used to include empty fields in Patch requests.
  961. ForceSendFields []string `json:"-"`
  962. // NullFields is a list of field names (e.g. "NextPageToken") to include
  963. // in API requests with the JSON null value. By default, fields with
  964. // empty values are omitted from API requests. However, any field with
  965. // an empty value appearing in NullFields will be sent to the server as
  966. // null. It is an error if a field in this list has a non-empty value.
  967. // This may be used to include null fields in Patch requests.
  968. NullFields []string `json:"-"`
  969. }
  970. func (s *QueryGrantableRolesResponse) MarshalJSON() ([]byte, error) {
  971. type NoMethod QueryGrantableRolesResponse
  972. raw := NoMethod(*s)
  973. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  974. }
  975. // QueryTestablePermissionsRequest: A request to get permissions which
  976. // can be tested on a resource.
  977. type QueryTestablePermissionsRequest struct {
  978. // FullResourceName: Required. The full resource name to query from the
  979. // list of testable
  980. // permissions.
  981. //
  982. // The name follows the Google Cloud Platform resource format.
  983. // For example, a Cloud Platform project with id `my-project` will be
  984. // named
  985. // `//cloudresourcemanager.googleapis.com/projects/my-project`.
  986. FullResourceName string `json:"fullResourceName,omitempty"`
  987. // PageSize: Optional limit on the number of permissions to include in
  988. // the response.
  989. PageSize int64 `json:"pageSize,omitempty"`
  990. // PageToken: Optional pagination token returned in an
  991. // earlier
  992. // QueryTestablePermissionsRequest.
  993. PageToken string `json:"pageToken,omitempty"`
  994. // ForceSendFields is a list of field names (e.g. "FullResourceName") to
  995. // unconditionally include in API requests. By default, fields with
  996. // empty values are omitted from API requests. However, any non-pointer,
  997. // non-interface field appearing in ForceSendFields will be sent to the
  998. // server regardless of whether the field is empty or not. This may be
  999. // used to include empty fields in Patch requests.
  1000. ForceSendFields []string `json:"-"`
  1001. // NullFields is a list of field names (e.g. "FullResourceName") to
  1002. // include in API requests with the JSON null value. By default, fields
  1003. // with empty values are omitted from API requests. However, any field
  1004. // with an empty value appearing in NullFields will be sent to the
  1005. // server as null. It is an error if a field in this list has a
  1006. // non-empty value. This may be used to include null fields in Patch
  1007. // requests.
  1008. NullFields []string `json:"-"`
  1009. }
  1010. func (s *QueryTestablePermissionsRequest) MarshalJSON() ([]byte, error) {
  1011. type NoMethod QueryTestablePermissionsRequest
  1012. raw := NoMethod(*s)
  1013. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1014. }
  1015. // QueryTestablePermissionsResponse: The response containing permissions
  1016. // which can be tested on a resource.
  1017. type QueryTestablePermissionsResponse struct {
  1018. // NextPageToken: To retrieve the next page of results,
  1019. // set
  1020. // `QueryTestableRolesRequest.page_token` to this value.
  1021. NextPageToken string `json:"nextPageToken,omitempty"`
  1022. // Permissions: The Permissions testable on the requested resource.
  1023. Permissions []*Permission `json:"permissions,omitempty"`
  1024. // ServerResponse contains the HTTP response code and headers from the
  1025. // server.
  1026. googleapi.ServerResponse `json:"-"`
  1027. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1028. // unconditionally include in API requests. By default, fields with
  1029. // empty values are omitted from API requests. However, any non-pointer,
  1030. // non-interface field appearing in ForceSendFields will be sent to the
  1031. // server regardless of whether the field is empty or not. This may be
  1032. // used to include empty fields in Patch requests.
  1033. ForceSendFields []string `json:"-"`
  1034. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1035. // in API requests with the JSON null value. By default, fields with
  1036. // empty values are omitted from API requests. However, any field with
  1037. // an empty value appearing in NullFields will be sent to the server as
  1038. // null. It is an error if a field in this list has a non-empty value.
  1039. // This may be used to include null fields in Patch requests.
  1040. NullFields []string `json:"-"`
  1041. }
  1042. func (s *QueryTestablePermissionsResponse) MarshalJSON() ([]byte, error) {
  1043. type NoMethod QueryTestablePermissionsResponse
  1044. raw := NoMethod(*s)
  1045. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1046. }
  1047. // Role: A role in the Identity and Access Management API.
  1048. type Role struct {
  1049. // Deleted: The current deleted state of the role. This field is read
  1050. // only.
  1051. // It will be ignored in calls to CreateRole and UpdateRole.
  1052. Deleted bool `json:"deleted,omitempty"`
  1053. // Description: Optional. A human-readable description for the role.
  1054. Description string `json:"description,omitempty"`
  1055. // Etag: Used to perform a consistent read-modify-write.
  1056. Etag string `json:"etag,omitempty"`
  1057. // IncludedPermissions: The names of the permissions this role grants
  1058. // when bound in an IAM policy.
  1059. IncludedPermissions []string `json:"includedPermissions,omitempty"`
  1060. // Name: The name of the role.
  1061. //
  1062. // When Role is used in CreateRole, the role name must not be set.
  1063. //
  1064. // When Role is used in output and other input such as UpdateRole, the
  1065. // role
  1066. // name is the complete path, e.g., roles/logging.viewer for curated
  1067. // roles
  1068. // and organizations/{ORGANIZATION_ID}/roles/logging.viewer for custom
  1069. // roles.
  1070. Name string `json:"name,omitempty"`
  1071. // Stage: The current launch stage of the role.
  1072. //
  1073. // Possible values:
  1074. // "ALPHA" - The user has indicated this role is currently in an alpha
  1075. // phase.
  1076. // "BETA" - The user has indicated this role is currently in a beta
  1077. // phase.
  1078. // "GA" - The user has indicated this role is generally available.
  1079. // "DEPRECATED" - The user has indicated this role is being
  1080. // deprecated.
  1081. // "DISABLED" - This role is disabled and will not contribute
  1082. // permissions to any members
  1083. // it is granted to in policies.
  1084. // "EAP" - The user has indicated this role is currently in an eap
  1085. // phase.
  1086. Stage string `json:"stage,omitempty"`
  1087. // Title: Optional. A human-readable title for the role. Typically
  1088. // this
  1089. // is limited to 100 UTF-8 bytes.
  1090. Title string `json:"title,omitempty"`
  1091. // ServerResponse contains the HTTP response code and headers from the
  1092. // server.
  1093. googleapi.ServerResponse `json:"-"`
  1094. // ForceSendFields is a list of field names (e.g. "Deleted") to
  1095. // unconditionally include in API requests. By default, fields with
  1096. // empty values are omitted from API requests. However, any non-pointer,
  1097. // non-interface field appearing in ForceSendFields will be sent to the
  1098. // server regardless of whether the field is empty or not. This may be
  1099. // used to include empty fields in Patch requests.
  1100. ForceSendFields []string `json:"-"`
  1101. // NullFields is a list of field names (e.g. "Deleted") to include in
  1102. // API requests with the JSON null value. By default, fields with empty
  1103. // values are omitted from API requests. However, any field with an
  1104. // empty value appearing in NullFields will be sent to the server as
  1105. // null. It is an error if a field in this list has a non-empty value.
  1106. // This may be used to include null fields in Patch requests.
  1107. NullFields []string `json:"-"`
  1108. }
  1109. func (s *Role) MarshalJSON() ([]byte, error) {
  1110. type NoMethod Role
  1111. raw := NoMethod(*s)
  1112. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1113. }
  1114. // ServiceAccount: A service account in the Identity and Access
  1115. // Management API.
  1116. //
  1117. // To create a service account, specify the `project_id` and the
  1118. // `account_id`
  1119. // for the account. The `account_id` is unique within the project, and
  1120. // is used
  1121. // to generate the service account email address and a
  1122. // stable
  1123. // `unique_id`.
  1124. //
  1125. // If the account already exists, the account's resource name is
  1126. // returned
  1127. // in the format of projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}. The
  1128. // caller
  1129. // can use the name in other methods to access the account.
  1130. //
  1131. // All other methods can identify the service account using the
  1132. // format
  1133. // `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
  1134. // Using `-` as a wildcard for the `PROJECT_ID` will infer the project
  1135. // from
  1136. // the account. The `ACCOUNT` value can be the `email` address or
  1137. // the
  1138. // `unique_id` of the service account.
  1139. type ServiceAccount struct {
  1140. // DisplayName: Optional. A user-specified description of the service
  1141. // account. Must be
  1142. // fewer than 100 UTF-8 bytes.
  1143. DisplayName string `json:"displayName,omitempty"`
  1144. // Email: @OutputOnly The email address of the service account.
  1145. Email string `json:"email,omitempty"`
  1146. // Etag: Used to perform a consistent read-modify-write.
  1147. Etag string `json:"etag,omitempty"`
  1148. // Name: The resource name of the service account in the following
  1149. // format:
  1150. // `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
  1151. //
  1152. // Requests using `-` as a wildcard for the `PROJECT_ID` will infer
  1153. // the
  1154. // project from the `account` and the `ACCOUNT` value can be the
  1155. // `email`
  1156. // address or the `unique_id` of the service account.
  1157. //
  1158. // In responses the resource name will always be in the
  1159. // format
  1160. // `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
  1161. Name string `json:"name,omitempty"`
  1162. // Oauth2ClientId: @OutputOnly The OAuth2 client id for the service
  1163. // account.
  1164. // This is used in conjunction with the OAuth2 clientconfig API to
  1165. // make
  1166. // three legged OAuth2 (3LO) flows to access the data of Google users.
  1167. Oauth2ClientId string `json:"oauth2ClientId,omitempty"`
  1168. // ProjectId: @OutputOnly The id of the project that owns the service
  1169. // account.
  1170. ProjectId string `json:"projectId,omitempty"`
  1171. // UniqueId: @OutputOnly The unique and stable id of the service
  1172. // account.
  1173. UniqueId string `json:"uniqueId,omitempty"`
  1174. // ServerResponse contains the HTTP response code and headers from the
  1175. // server.
  1176. googleapi.ServerResponse `json:"-"`
  1177. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1178. // unconditionally include in API requests. By default, fields with
  1179. // empty values are omitted from API requests. However, any non-pointer,
  1180. // non-interface field appearing in ForceSendFields will be sent to the
  1181. // server regardless of whether the field is empty or not. This may be
  1182. // used to include empty fields in Patch requests.
  1183. ForceSendFields []string `json:"-"`
  1184. // NullFields is a list of field names (e.g. "DisplayName") to include
  1185. // in API requests with the JSON null value. By default, fields with
  1186. // empty values are omitted from API requests. However, any field with
  1187. // an empty value appearing in NullFields will be sent to the server as
  1188. // null. It is an error if a field in this list has a non-empty value.
  1189. // This may be used to include null fields in Patch requests.
  1190. NullFields []string `json:"-"`
  1191. }
  1192. func (s *ServiceAccount) MarshalJSON() ([]byte, error) {
  1193. type NoMethod ServiceAccount
  1194. raw := NoMethod(*s)
  1195. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1196. }
  1197. // ServiceAccountKey: Represents a service account key.
  1198. //
  1199. // A service account has two sets of key-pairs: user-managed,
  1200. // and
  1201. // system-managed.
  1202. //
  1203. // User-managed key-pairs can be created and deleted by users. Users
  1204. // are
  1205. // responsible for rotating these keys periodically to ensure security
  1206. // of
  1207. // their service accounts. Users retain the private key of these
  1208. // key-pairs,
  1209. // and Google retains ONLY the public key.
  1210. //
  1211. // System-managed key-pairs are managed automatically by Google, and
  1212. // rotated
  1213. // daily without user intervention. The private key never leaves
  1214. // Google's
  1215. // servers to maximize security.
  1216. //
  1217. // Public keys for all service accounts are also published at the
  1218. // OAuth2
  1219. // Service Account API.
  1220. type ServiceAccountKey struct {
  1221. // KeyAlgorithm: Specifies the algorithm (and possibly key size) for the
  1222. // key.
  1223. //
  1224. // Possible values:
  1225. // "KEY_ALG_UNSPECIFIED" - An unspecified key algorithm.
  1226. // "KEY_ALG_RSA_1024" - 1k RSA Key.
  1227. // "KEY_ALG_RSA_2048" - 2k RSA Key.
  1228. KeyAlgorithm string `json:"keyAlgorithm,omitempty"`
  1229. // Name: The resource name of the service account key in the following
  1230. // format
  1231. // `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
  1232. Name string `json:"name,omitempty"`
  1233. // PrivateKeyData: The private key data. Only provided in
  1234. // `CreateServiceAccountKey`
  1235. // responses. Make sure to keep the private key data secure because
  1236. // it
  1237. // allows for the assertion of the service account identity.
  1238. // When base64 decoded, the private key data can be used to authenticate
  1239. // with
  1240. // Google API client libraries and with
  1241. // <a
  1242. // href="/sdk/gcloud/reference/auth/activate-service-account">gcloud
  1243. // auth
  1244. // activate-service-account</a>.
  1245. PrivateKeyData string `json:"privateKeyData,omitempty"`
  1246. // PrivateKeyType: The output format for the private key.
  1247. // Only provided in `CreateServiceAccountKey` responses, not
  1248. // in `GetServiceAccountKey` or `ListServiceAccountKey`
  1249. // responses.
  1250. //
  1251. // Google never exposes system-managed private keys, and never
  1252. // retains
  1253. // user-managed private keys.
  1254. //
  1255. // Possible values:
  1256. // "TYPE_UNSPECIFIED" - Unspecified. Equivalent to
  1257. // `TYPE_GOOGLE_CREDENTIALS_FILE`.
  1258. // "TYPE_PKCS12_FILE" - PKCS12 format.
  1259. // The password for the PKCS12 file is `notasecret`.
  1260. // For more information, see https://tools.ietf.org/html/rfc7292.
  1261. // "TYPE_GOOGLE_CREDENTIALS_FILE" - Google Credentials File format.
  1262. PrivateKeyType string `json:"privateKeyType,omitempty"`
  1263. // PublicKeyData: The public key data. Only provided in
  1264. // `GetServiceAccountKey` responses.
  1265. PublicKeyData string `json:"publicKeyData,omitempty"`
  1266. // ValidAfterTime: The key can be used after this timestamp.
  1267. ValidAfterTime string `json:"validAfterTime,omitempty"`
  1268. // ValidBeforeTime: The key can be used before this timestamp.
  1269. ValidBeforeTime string `json:"validBeforeTime,omitempty"`
  1270. // ServerResponse contains the HTTP response code and headers from the
  1271. // server.
  1272. googleapi.ServerResponse `json:"-"`
  1273. // ForceSendFields is a list of field names (e.g. "KeyAlgorithm") to
  1274. // unconditionally include in API requests. By default, fields with
  1275. // empty values are omitted from API requests. However, any non-pointer,
  1276. // non-interface field appearing in ForceSendFields will be sent to the
  1277. // server regardless of whether the field is empty or not. This may be
  1278. // used to include empty fields in Patch requests.
  1279. ForceSendFields []string `json:"-"`
  1280. // NullFields is a list of field names (e.g. "KeyAlgorithm") to include
  1281. // in API requests with the JSON null value. By default, fields with
  1282. // empty values are omitted from API requests. However, any field with
  1283. // an empty value appearing in NullFields will be sent to the server as
  1284. // null. It is an error if a field in this list has a non-empty value.
  1285. // This may be used to include null fields in Patch requests.
  1286. NullFields []string `json:"-"`
  1287. }
  1288. func (s *ServiceAccountKey) MarshalJSON() ([]byte, error) {
  1289. type NoMethod ServiceAccountKey
  1290. raw := NoMethod(*s)
  1291. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1292. }
  1293. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1294. type SetIamPolicyRequest struct {
  1295. // Policy: REQUIRED: The complete policy to be applied to the
  1296. // `resource`. The size of
  1297. // the policy is limited to a few 10s of KB. An empty policy is a
  1298. // valid policy but certain Cloud Platform services (such as
  1299. // Projects)
  1300. // might reject them.
  1301. Policy *Policy `json:"policy,omitempty"`
  1302. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  1303. // policy to modify. Only
  1304. // the fields in the mask will be modified. If no mask is provided,
  1305. // the
  1306. // following default mask is used:
  1307. // paths: "bindings, etag"
  1308. // This field is only used by Cloud IAM.
  1309. UpdateMask string `json:"updateMask,omitempty"`
  1310. // ForceSendFields is a list of field names (e.g. "Policy") to
  1311. // unconditionally include in API requests. By default, fields with
  1312. // empty values are omitted from API requests. However, any non-pointer,
  1313. // non-interface field appearing in ForceSendFields will be sent to the
  1314. // server regardless of whether the field is empty or not. This may be
  1315. // used to include empty fields in Patch requests.
  1316. ForceSendFields []string `json:"-"`
  1317. // NullFields is a list of field names (e.g. "Policy") to include in API
  1318. // requests with the JSON null value. By default, fields with empty
  1319. // values are omitted from API requests. However, any field with an
  1320. // empty value appearing in NullFields will be sent to the server as
  1321. // null. It is an error if a field in this list has a non-empty value.
  1322. // This may be used to include null fields in Patch requests.
  1323. NullFields []string `json:"-"`
  1324. }
  1325. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1326. type NoMethod SetIamPolicyRequest
  1327. raw := NoMethod(*s)
  1328. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1329. }
  1330. // SignBlobRequest: The service account sign blob request.
  1331. type SignBlobRequest struct {
  1332. // BytesToSign: The bytes to sign.
  1333. BytesToSign string `json:"bytesToSign,omitempty"`
  1334. // ForceSendFields is a list of field names (e.g. "BytesToSign") to
  1335. // unconditionally include in API requests. By default, fields with
  1336. // empty values are omitted from API requests. However, any non-pointer,
  1337. // non-interface field appearing in ForceSendFields will be sent to the
  1338. // server regardless of whether the field is empty or not. This may be
  1339. // used to include empty fields in Patch requests.
  1340. ForceSendFields []string `json:"-"`
  1341. // NullFields is a list of field names (e.g. "BytesToSign") to include
  1342. // in API requests with the JSON null value. By default, fields with
  1343. // empty values are omitted from API requests. However, any field with
  1344. // an empty value appearing in NullFields will be sent to the server as
  1345. // null. It is an error if a field in this list has a non-empty value.
  1346. // This may be used to include null fields in Patch requests.
  1347. NullFields []string `json:"-"`
  1348. }
  1349. func (s *SignBlobRequest) MarshalJSON() ([]byte, error) {
  1350. type NoMethod SignBlobRequest
  1351. raw := NoMethod(*s)
  1352. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1353. }
  1354. // SignBlobResponse: The service account sign blob response.
  1355. type SignBlobResponse struct {
  1356. // KeyId: The id of the key used to sign the blob.
  1357. KeyId string `json:"keyId,omitempty"`
  1358. // Signature: The signed blob.
  1359. Signature string `json:"signature,omitempty"`
  1360. // ServerResponse contains the HTTP response code and headers from the
  1361. // server.
  1362. googleapi.ServerResponse `json:"-"`
  1363. // ForceSendFields is a list of field names (e.g. "KeyId") to
  1364. // unconditionally include in API requests. By default, fields with
  1365. // empty values are omitted from API requests. However, any non-pointer,
  1366. // non-interface field appearing in ForceSendFields will be sent to the
  1367. // server regardless of whether the field is empty or not. This may be
  1368. // used to include empty fields in Patch requests.
  1369. ForceSendFields []string `json:"-"`
  1370. // NullFields is a list of field names (e.g. "KeyId") to include in API
  1371. // requests with the JSON null value. By default, fields with empty
  1372. // values are omitted from API requests. However, any field with an
  1373. // empty value appearing in NullFields will be sent to the server as
  1374. // null. It is an error if a field in this list has a non-empty value.
  1375. // This may be used to include null fields in Patch requests.
  1376. NullFields []string `json:"-"`
  1377. }
  1378. func (s *SignBlobResponse) MarshalJSON() ([]byte, error) {
  1379. type NoMethod SignBlobResponse
  1380. raw := NoMethod(*s)
  1381. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1382. }
  1383. // SignJwtRequest: The service account sign JWT request.
  1384. type SignJwtRequest struct {
  1385. // Payload: The JWT payload to sign, a JSON JWT Claim set.
  1386. Payload string `json:"payload,omitempty"`
  1387. // ForceSendFields is a list of field names (e.g. "Payload") to
  1388. // unconditionally include in API requests. By default, fields with
  1389. // empty values are omitted from API requests. However, any non-pointer,
  1390. // non-interface field appearing in ForceSendFields will be sent to the
  1391. // server regardless of whether the field is empty or not. This may be
  1392. // used to include empty fields in Patch requests.
  1393. ForceSendFields []string `json:"-"`
  1394. // NullFields is a list of field names (e.g. "Payload") to include in
  1395. // API requests with the JSON null value. By default, fields with empty
  1396. // values are omitted from API requests. However, any field with an
  1397. // empty value appearing in NullFields will be sent to the server as
  1398. // null. It is an error if a field in this list has a non-empty value.
  1399. // This may be used to include null fields in Patch requests.
  1400. NullFields []string `json:"-"`
  1401. }
  1402. func (s *SignJwtRequest) MarshalJSON() ([]byte, error) {
  1403. type NoMethod SignJwtRequest
  1404. raw := NoMethod(*s)
  1405. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1406. }
  1407. // SignJwtResponse: The service account sign JWT response.
  1408. type SignJwtResponse struct {
  1409. // KeyId: The id of the key used to sign the JWT.
  1410. KeyId string `json:"keyId,omitempty"`
  1411. // SignedJwt: The signed JWT.
  1412. SignedJwt string `json:"signedJwt,omitempty"`
  1413. // ServerResponse contains the HTTP response code and headers from the
  1414. // server.
  1415. googleapi.ServerResponse `json:"-"`
  1416. // ForceSendFields is a list of field names (e.g. "KeyId") to
  1417. // unconditionally include in API requests. By default, fields with
  1418. // empty values are omitted from API requests. However, any non-pointer,
  1419. // non-interface field appearing in ForceSendFields will be sent to the
  1420. // server regardless of whether the field is empty or not. This may be
  1421. // used to include empty fields in Patch requests.
  1422. ForceSendFields []string `json:"-"`
  1423. // NullFields is a list of field names (e.g. "KeyId") to include in API
  1424. // requests with the JSON null value. By default, fields with empty
  1425. // values are omitted from API requests. However, any field with an
  1426. // empty value appearing in NullFields will be sent to the server as
  1427. // null. It is an error if a field in this list has a non-empty value.
  1428. // This may be used to include null fields in Patch requests.
  1429. NullFields []string `json:"-"`
  1430. }
  1431. func (s *SignJwtResponse) MarshalJSON() ([]byte, error) {
  1432. type NoMethod SignJwtResponse
  1433. raw := NoMethod(*s)
  1434. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1435. }
  1436. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  1437. // method.
  1438. type TestIamPermissionsRequest struct {
  1439. // Permissions: The set of permissions to check for the `resource`.
  1440. // Permissions with
  1441. // wildcards (such as '*' or 'storage.*') are not allowed. For
  1442. // more
  1443. // information see
  1444. // [IAM
  1445. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  1446. Permissions []string `json:"permissions,omitempty"`
  1447. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1448. // unconditionally include in API requests. By default, fields with
  1449. // empty values are omitted from API requests. However, any non-pointer,
  1450. // non-interface field appearing in ForceSendFields will be sent to the
  1451. // server regardless of whether the field is empty or not. This may be
  1452. // used to include empty fields in Patch requests.
  1453. ForceSendFields []string `json:"-"`
  1454. // NullFields is a list of field names (e.g. "Permissions") to include
  1455. // in API requests with the JSON null value. By default, fields with
  1456. // empty values are omitted from API requests. However, any field with
  1457. // an empty value appearing in NullFields will be sent to the server as
  1458. // null. It is an error if a field in this list has a non-empty value.
  1459. // This may be used to include null fields in Patch requests.
  1460. NullFields []string `json:"-"`
  1461. }
  1462. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  1463. type NoMethod TestIamPermissionsRequest
  1464. raw := NoMethod(*s)
  1465. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1466. }
  1467. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1468. // method.
  1469. type TestIamPermissionsResponse struct {
  1470. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1471. // the caller is
  1472. // allowed.
  1473. Permissions []string `json:"permissions,omitempty"`
  1474. // ServerResponse contains the HTTP response code and headers from the
  1475. // server.
  1476. googleapi.ServerResponse `json:"-"`
  1477. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1478. // unconditionally include in API requests. By default, fields with
  1479. // empty values are omitted from API requests. However, any non-pointer,
  1480. // non-interface field appearing in ForceSendFields will be sent to the
  1481. // server regardless of whether the field is empty or not. This may be
  1482. // used to include empty fields in Patch requests.
  1483. ForceSendFields []string `json:"-"`
  1484. // NullFields is a list of field names (e.g. "Permissions") to include
  1485. // in API requests with the JSON null value. By default, fields with
  1486. // empty values are omitted from API requests. However, any field with
  1487. // an empty value appearing in NullFields will be sent to the server as
  1488. // null. It is an error if a field in this list has a non-empty value.
  1489. // This may be used to include null fields in Patch requests.
  1490. NullFields []string `json:"-"`
  1491. }
  1492. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1493. type NoMethod TestIamPermissionsResponse
  1494. raw := NoMethod(*s)
  1495. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1496. }
  1497. // UndeleteRoleRequest: The request to undelete an existing role.
  1498. type UndeleteRoleRequest struct {
  1499. // Etag: Used to perform a consistent read-modify-write.
  1500. Etag string `json:"etag,omitempty"`
  1501. // ForceSendFields is a list of field names (e.g. "Etag") to
  1502. // unconditionally include in API requests. By default, fields with
  1503. // empty values are omitted from API requests. However, any non-pointer,
  1504. // non-interface field appearing in ForceSendFields will be sent to the
  1505. // server regardless of whether the field is empty or not. This may be
  1506. // used to include empty fields in Patch requests.
  1507. ForceSendFields []string `json:"-"`
  1508. // NullFields is a list of field names (e.g. "Etag") to include in API
  1509. // requests with the JSON null value. By default, fields with empty
  1510. // values are omitted from API requests. However, any field with an
  1511. // empty value appearing in NullFields will be sent to the server as
  1512. // null. It is an error if a field in this list has a non-empty value.
  1513. // This may be used to include null fields in Patch requests.
  1514. NullFields []string `json:"-"`
  1515. }
  1516. func (s *UndeleteRoleRequest) MarshalJSON() ([]byte, error) {
  1517. type NoMethod UndeleteRoleRequest
  1518. raw := NoMethod(*s)
  1519. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1520. }
  1521. // method id "iam.iamPolicies.queryAuditableServices":
  1522. type IamPoliciesQueryAuditableServicesCall struct {
  1523. s *Service
  1524. queryauditableservicesrequest *QueryAuditableServicesRequest
  1525. urlParams_ gensupport.URLParams
  1526. ctx_ context.Context
  1527. header_ http.Header
  1528. }
  1529. // QueryAuditableServices: Returns a list of services that support
  1530. // service level audit logging
  1531. // configuration for the given resource.
  1532. func (r *IamPoliciesService) QueryAuditableServices(queryauditableservicesrequest *QueryAuditableServicesRequest) *IamPoliciesQueryAuditableServicesCall {
  1533. c := &IamPoliciesQueryAuditableServicesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1534. c.queryauditableservicesrequest = queryauditableservicesrequest
  1535. return c
  1536. }
  1537. // Fields allows partial responses to be retrieved. See
  1538. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1539. // for more information.
  1540. func (c *IamPoliciesQueryAuditableServicesCall) Fields(s ...googleapi.Field) *IamPoliciesQueryAuditableServicesCall {
  1541. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1542. return c
  1543. }
  1544. // Context sets the context to be used in this call's Do method. Any
  1545. // pending HTTP request will be aborted if the provided context is
  1546. // canceled.
  1547. func (c *IamPoliciesQueryAuditableServicesCall) Context(ctx context.Context) *IamPoliciesQueryAuditableServicesCall {
  1548. c.ctx_ = ctx
  1549. return c
  1550. }
  1551. // Header returns an http.Header that can be modified by the caller to
  1552. // add HTTP headers to the request.
  1553. func (c *IamPoliciesQueryAuditableServicesCall) Header() http.Header {
  1554. if c.header_ == nil {
  1555. c.header_ = make(http.Header)
  1556. }
  1557. return c.header_
  1558. }
  1559. func (c *IamPoliciesQueryAuditableServicesCall) doRequest(alt string) (*http.Response, error) {
  1560. reqHeaders := make(http.Header)
  1561. for k, v := range c.header_ {
  1562. reqHeaders[k] = v
  1563. }
  1564. reqHeaders.Set("User-Agent", c.s.userAgent())
  1565. var body io.Reader = nil
  1566. body, err := googleapi.WithoutDataWrapper.JSONReader(c.queryauditableservicesrequest)
  1567. if err != nil {
  1568. return nil, err
  1569. }
  1570. reqHeaders.Set("Content-Type", "application/json")
  1571. c.urlParams_.Set("alt", alt)
  1572. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/iamPolicies:queryAuditableServices")
  1573. urls += "?" + c.urlParams_.Encode()
  1574. req, _ := http.NewRequest("POST", urls, body)
  1575. req.Header = reqHeaders
  1576. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1577. }
  1578. // Do executes the "iam.iamPolicies.queryAuditableServices" call.
  1579. // Exactly one of *QueryAuditableServicesResponse or error will be
  1580. // non-nil. Any non-2xx status code is an error. Response headers are in
  1581. // either *QueryAuditableServicesResponse.ServerResponse.Header or (if a
  1582. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1583. // googleapi.IsNotModified to check whether the returned error was
  1584. // because http.StatusNotModified was returned.
  1585. func (c *IamPoliciesQueryAuditableServicesCall) Do(opts ...googleapi.CallOption) (*QueryAuditableServicesResponse, error) {
  1586. gensupport.SetOptions(c.urlParams_, opts...)
  1587. res, err := c.doRequest("json")
  1588. if res != nil && res.StatusCode == http.StatusNotModified {
  1589. if res.Body != nil {
  1590. res.Body.Close()
  1591. }
  1592. return nil, &googleapi.Error{
  1593. Code: res.StatusCode,
  1594. Header: res.Header,
  1595. }
  1596. }
  1597. if err != nil {
  1598. return nil, err
  1599. }
  1600. defer googleapi.CloseBody(res)
  1601. if err := googleapi.CheckResponse(res); err != nil {
  1602. return nil, err
  1603. }
  1604. ret := &QueryAuditableServicesResponse{
  1605. ServerResponse: googleapi.ServerResponse{
  1606. Header: res.Header,
  1607. HTTPStatusCode: res.StatusCode,
  1608. },
  1609. }
  1610. target := &ret
  1611. if err := gensupport.DecodeResponse(target, res); err != nil {
  1612. return nil, err
  1613. }
  1614. return ret, nil
  1615. // {
  1616. // "description": "Returns a list of services that support service level audit logging\nconfiguration for the given resource.",
  1617. // "flatPath": "v1/iamPolicies:queryAuditableServices",
  1618. // "httpMethod": "POST",
  1619. // "id": "iam.iamPolicies.queryAuditableServices",
  1620. // "parameterOrder": [],
  1621. // "parameters": {},
  1622. // "path": "v1/iamPolicies:queryAuditableServices",
  1623. // "request": {
  1624. // "$ref": "QueryAuditableServicesRequest"
  1625. // },
  1626. // "response": {
  1627. // "$ref": "QueryAuditableServicesResponse"
  1628. // },
  1629. // "scopes": [
  1630. // "https://www.googleapis.com/auth/cloud-platform"
  1631. // ]
  1632. // }
  1633. }
  1634. // method id "iam.organizations.roles.create":
  1635. type OrganizationsRolesCreateCall struct {
  1636. s *Service
  1637. parent string
  1638. createrolerequest *CreateRoleRequest
  1639. urlParams_ gensupport.URLParams
  1640. ctx_ context.Context
  1641. header_ http.Header
  1642. }
  1643. // Create: Creates a new Role.
  1644. func (r *OrganizationsRolesService) Create(parent string, createrolerequest *CreateRoleRequest) *OrganizationsRolesCreateCall {
  1645. c := &OrganizationsRolesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1646. c.parent = parent
  1647. c.createrolerequest = createrolerequest
  1648. return c
  1649. }
  1650. // Fields allows partial responses to be retrieved. See
  1651. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1652. // for more information.
  1653. func (c *OrganizationsRolesCreateCall) Fields(s ...googleapi.Field) *OrganizationsRolesCreateCall {
  1654. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1655. return c
  1656. }
  1657. // Context sets the context to be used in this call's Do method. Any
  1658. // pending HTTP request will be aborted if the provided context is
  1659. // canceled.
  1660. func (c *OrganizationsRolesCreateCall) Context(ctx context.Context) *OrganizationsRolesCreateCall {
  1661. c.ctx_ = ctx
  1662. return c
  1663. }
  1664. // Header returns an http.Header that can be modified by the caller to
  1665. // add HTTP headers to the request.
  1666. func (c *OrganizationsRolesCreateCall) Header() http.Header {
  1667. if c.header_ == nil {
  1668. c.header_ = make(http.Header)
  1669. }
  1670. return c.header_
  1671. }
  1672. func (c *OrganizationsRolesCreateCall) doRequest(alt string) (*http.Response, error) {
  1673. reqHeaders := make(http.Header)
  1674. for k, v := range c.header_ {
  1675. reqHeaders[k] = v
  1676. }
  1677. reqHeaders.Set("User-Agent", c.s.userAgent())
  1678. var body io.Reader = nil
  1679. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createrolerequest)
  1680. if err != nil {
  1681. return nil, err
  1682. }
  1683. reqHeaders.Set("Content-Type", "application/json")
  1684. c.urlParams_.Set("alt", alt)
  1685. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/roles")
  1686. urls += "?" + c.urlParams_.Encode()
  1687. req, _ := http.NewRequest("POST", urls, body)
  1688. req.Header = reqHeaders
  1689. googleapi.Expand(req.URL, map[string]string{
  1690. "parent": c.parent,
  1691. })
  1692. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1693. }
  1694. // Do executes the "iam.organizations.roles.create" call.
  1695. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  1696. // code is an error. Response headers are in either
  1697. // *Role.ServerResponse.Header or (if a response was returned at all) in
  1698. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1699. // whether the returned error was because http.StatusNotModified was
  1700. // returned.
  1701. func (c *OrganizationsRolesCreateCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  1702. gensupport.SetOptions(c.urlParams_, opts...)
  1703. res, err := c.doRequest("json")
  1704. if res != nil && res.StatusCode == http.StatusNotModified {
  1705. if res.Body != nil {
  1706. res.Body.Close()
  1707. }
  1708. return nil, &googleapi.Error{
  1709. Code: res.StatusCode,
  1710. Header: res.Header,
  1711. }
  1712. }
  1713. if err != nil {
  1714. return nil, err
  1715. }
  1716. defer googleapi.CloseBody(res)
  1717. if err := googleapi.CheckResponse(res); err != nil {
  1718. return nil, err
  1719. }
  1720. ret := &Role{
  1721. ServerResponse: googleapi.ServerResponse{
  1722. Header: res.Header,
  1723. HTTPStatusCode: res.StatusCode,
  1724. },
  1725. }
  1726. target := &ret
  1727. if err := gensupport.DecodeResponse(target, res); err != nil {
  1728. return nil, err
  1729. }
  1730. return ret, nil
  1731. // {
  1732. // "description": "Creates a new Role.",
  1733. // "flatPath": "v1/organizations/{organizationsId}/roles",
  1734. // "httpMethod": "POST",
  1735. // "id": "iam.organizations.roles.create",
  1736. // "parameterOrder": [
  1737. // "parent"
  1738. // ],
  1739. // "parameters": {
  1740. // "parent": {
  1741. // "description": "The resource name of the parent resource in one of the following formats:\n`organizations/{ORGANIZATION_ID}`\n`projects/{PROJECT_ID}`",
  1742. // "location": "path",
  1743. // "pattern": "^organizations/[^/]+$",
  1744. // "required": true,
  1745. // "type": "string"
  1746. // }
  1747. // },
  1748. // "path": "v1/{+parent}/roles",
  1749. // "request": {
  1750. // "$ref": "CreateRoleRequest"
  1751. // },
  1752. // "response": {
  1753. // "$ref": "Role"
  1754. // },
  1755. // "scopes": [
  1756. // "https://www.googleapis.com/auth/cloud-platform"
  1757. // ]
  1758. // }
  1759. }
  1760. // method id "iam.organizations.roles.delete":
  1761. type OrganizationsRolesDeleteCall struct {
  1762. s *Service
  1763. name string
  1764. urlParams_ gensupport.URLParams
  1765. ctx_ context.Context
  1766. header_ http.Header
  1767. }
  1768. // Delete: Soft deletes a role. The role is suspended and cannot be used
  1769. // to create new
  1770. // IAM Policy Bindings.
  1771. // The Role will not be included in `ListRoles()` unless `show_deleted`
  1772. // is set
  1773. // in the `ListRolesRequest`. The Role contains the deleted boolean
  1774. // set.
  1775. // Existing Bindings remains, but are inactive. The Role can be
  1776. // undeleted
  1777. // within 7 days. After 7 days the Role is deleted and all Bindings
  1778. // associated
  1779. // with the role are removed.
  1780. func (r *OrganizationsRolesService) Delete(name string) *OrganizationsRolesDeleteCall {
  1781. c := &OrganizationsRolesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1782. c.name = name
  1783. return c
  1784. }
  1785. // Etag sets the optional parameter "etag": Used to perform a consistent
  1786. // read-modify-write.
  1787. func (c *OrganizationsRolesDeleteCall) Etag(etag string) *OrganizationsRolesDeleteCall {
  1788. c.urlParams_.Set("etag", etag)
  1789. return c
  1790. }
  1791. // Fields allows partial responses to be retrieved. See
  1792. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1793. // for more information.
  1794. func (c *OrganizationsRolesDeleteCall) Fields(s ...googleapi.Field) *OrganizationsRolesDeleteCall {
  1795. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1796. return c
  1797. }
  1798. // Context sets the context to be used in this call's Do method. Any
  1799. // pending HTTP request will be aborted if the provided context is
  1800. // canceled.
  1801. func (c *OrganizationsRolesDeleteCall) Context(ctx context.Context) *OrganizationsRolesDeleteCall {
  1802. c.ctx_ = ctx
  1803. return c
  1804. }
  1805. // Header returns an http.Header that can be modified by the caller to
  1806. // add HTTP headers to the request.
  1807. func (c *OrganizationsRolesDeleteCall) Header() http.Header {
  1808. if c.header_ == nil {
  1809. c.header_ = make(http.Header)
  1810. }
  1811. return c.header_
  1812. }
  1813. func (c *OrganizationsRolesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1814. reqHeaders := make(http.Header)
  1815. for k, v := range c.header_ {
  1816. reqHeaders[k] = v
  1817. }
  1818. reqHeaders.Set("User-Agent", c.s.userAgent())
  1819. var body io.Reader = nil
  1820. c.urlParams_.Set("alt", alt)
  1821. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1822. urls += "?" + c.urlParams_.Encode()
  1823. req, _ := http.NewRequest("DELETE", urls, body)
  1824. req.Header = reqHeaders
  1825. googleapi.Expand(req.URL, map[string]string{
  1826. "name": c.name,
  1827. })
  1828. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1829. }
  1830. // Do executes the "iam.organizations.roles.delete" call.
  1831. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  1832. // code is an error. Response headers are in either
  1833. // *Role.ServerResponse.Header or (if a response was returned at all) in
  1834. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1835. // whether the returned error was because http.StatusNotModified was
  1836. // returned.
  1837. func (c *OrganizationsRolesDeleteCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  1838. gensupport.SetOptions(c.urlParams_, opts...)
  1839. res, err := c.doRequest("json")
  1840. if res != nil && res.StatusCode == http.StatusNotModified {
  1841. if res.Body != nil {
  1842. res.Body.Close()
  1843. }
  1844. return nil, &googleapi.Error{
  1845. Code: res.StatusCode,
  1846. Header: res.Header,
  1847. }
  1848. }
  1849. if err != nil {
  1850. return nil, err
  1851. }
  1852. defer googleapi.CloseBody(res)
  1853. if err := googleapi.CheckResponse(res); err != nil {
  1854. return nil, err
  1855. }
  1856. ret := &Role{
  1857. ServerResponse: googleapi.ServerResponse{
  1858. Header: res.Header,
  1859. HTTPStatusCode: res.StatusCode,
  1860. },
  1861. }
  1862. target := &ret
  1863. if err := gensupport.DecodeResponse(target, res); err != nil {
  1864. return nil, err
  1865. }
  1866. return ret, nil
  1867. // {
  1868. // "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.",
  1869. // "flatPath": "v1/organizations/{organizationsId}/roles/{rolesId}",
  1870. // "httpMethod": "DELETE",
  1871. // "id": "iam.organizations.roles.delete",
  1872. // "parameterOrder": [
  1873. // "name"
  1874. // ],
  1875. // "parameters": {
  1876. // "etag": {
  1877. // "description": "Used to perform a consistent read-modify-write.",
  1878. // "format": "byte",
  1879. // "location": "query",
  1880. // "type": "string"
  1881. // },
  1882. // "name": {
  1883. // "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}`",
  1884. // "location": "path",
  1885. // "pattern": "^organizations/[^/]+/roles/[^/]+$",
  1886. // "required": true,
  1887. // "type": "string"
  1888. // }
  1889. // },
  1890. // "path": "v1/{+name}",
  1891. // "response": {
  1892. // "$ref": "Role"
  1893. // },
  1894. // "scopes": [
  1895. // "https://www.googleapis.com/auth/cloud-platform"
  1896. // ]
  1897. // }
  1898. }
  1899. // method id "iam.organizations.roles.get":
  1900. type OrganizationsRolesGetCall struct {
  1901. s *Service
  1902. name string
  1903. urlParams_ gensupport.URLParams
  1904. ifNoneMatch_ string
  1905. ctx_ context.Context
  1906. header_ http.Header
  1907. }
  1908. // Get: Gets a Role definition.
  1909. func (r *OrganizationsRolesService) Get(name string) *OrganizationsRolesGetCall {
  1910. c := &OrganizationsRolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1911. c.name = name
  1912. return c
  1913. }
  1914. // Fields allows partial responses to be retrieved. See
  1915. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1916. // for more information.
  1917. func (c *OrganizationsRolesGetCall) Fields(s ...googleapi.Field) *OrganizationsRolesGetCall {
  1918. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1919. return c
  1920. }
  1921. // IfNoneMatch sets the optional parameter which makes the operation
  1922. // fail if the object's ETag matches the given value. This is useful for
  1923. // getting updates only after the object has changed since the last
  1924. // request. Use googleapi.IsNotModified to check whether the response
  1925. // error from Do is the result of In-None-Match.
  1926. func (c *OrganizationsRolesGetCall) IfNoneMatch(entityTag string) *OrganizationsRolesGetCall {
  1927. c.ifNoneMatch_ = entityTag
  1928. return c
  1929. }
  1930. // Context sets the context to be used in this call's Do method. Any
  1931. // pending HTTP request will be aborted if the provided context is
  1932. // canceled.
  1933. func (c *OrganizationsRolesGetCall) Context(ctx context.Context) *OrganizationsRolesGetCall {
  1934. c.ctx_ = ctx
  1935. return c
  1936. }
  1937. // Header returns an http.Header that can be modified by the caller to
  1938. // add HTTP headers to the request.
  1939. func (c *OrganizationsRolesGetCall) Header() http.Header {
  1940. if c.header_ == nil {
  1941. c.header_ = make(http.Header)
  1942. }
  1943. return c.header_
  1944. }
  1945. func (c *OrganizationsRolesGetCall) doRequest(alt string) (*http.Response, error) {
  1946. reqHeaders := make(http.Header)
  1947. for k, v := range c.header_ {
  1948. reqHeaders[k] = v
  1949. }
  1950. reqHeaders.Set("User-Agent", c.s.userAgent())
  1951. if c.ifNoneMatch_ != "" {
  1952. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1953. }
  1954. var body io.Reader = nil
  1955. c.urlParams_.Set("alt", alt)
  1956. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1957. urls += "?" + c.urlParams_.Encode()
  1958. req, _ := http.NewRequest("GET", urls, body)
  1959. req.Header = reqHeaders
  1960. googleapi.Expand(req.URL, map[string]string{
  1961. "name": c.name,
  1962. })
  1963. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1964. }
  1965. // Do executes the "iam.organizations.roles.get" call.
  1966. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  1967. // code is an error. Response headers are in either
  1968. // *Role.ServerResponse.Header or (if a response was returned at all) in
  1969. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1970. // whether the returned error was because http.StatusNotModified was
  1971. // returned.
  1972. func (c *OrganizationsRolesGetCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  1973. gensupport.SetOptions(c.urlParams_, opts...)
  1974. res, err := c.doRequest("json")
  1975. if res != nil && res.StatusCode == http.StatusNotModified {
  1976. if res.Body != nil {
  1977. res.Body.Close()
  1978. }
  1979. return nil, &googleapi.Error{
  1980. Code: res.StatusCode,
  1981. Header: res.Header,
  1982. }
  1983. }
  1984. if err != nil {
  1985. return nil, err
  1986. }
  1987. defer googleapi.CloseBody(res)
  1988. if err := googleapi.CheckResponse(res); err != nil {
  1989. return nil, err
  1990. }
  1991. ret := &Role{
  1992. ServerResponse: googleapi.ServerResponse{
  1993. Header: res.Header,
  1994. HTTPStatusCode: res.StatusCode,
  1995. },
  1996. }
  1997. target := &ret
  1998. if err := gensupport.DecodeResponse(target, res); err != nil {
  1999. return nil, err
  2000. }
  2001. return ret, nil
  2002. // {
  2003. // "description": "Gets a Role definition.",
  2004. // "flatPath": "v1/organizations/{organizationsId}/roles/{rolesId}",
  2005. // "httpMethod": "GET",
  2006. // "id": "iam.organizations.roles.get",
  2007. // "parameterOrder": [
  2008. // "name"
  2009. // ],
  2010. // "parameters": {
  2011. // "name": {
  2012. // "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}`",
  2013. // "location": "path",
  2014. // "pattern": "^organizations/[^/]+/roles/[^/]+$",
  2015. // "required": true,
  2016. // "type": "string"
  2017. // }
  2018. // },
  2019. // "path": "v1/{+name}",
  2020. // "response": {
  2021. // "$ref": "Role"
  2022. // },
  2023. // "scopes": [
  2024. // "https://www.googleapis.com/auth/cloud-platform"
  2025. // ]
  2026. // }
  2027. }
  2028. // method id "iam.organizations.roles.list":
  2029. type OrganizationsRolesListCall struct {
  2030. s *Service
  2031. parent string
  2032. urlParams_ gensupport.URLParams
  2033. ifNoneMatch_ string
  2034. ctx_ context.Context
  2035. header_ http.Header
  2036. }
  2037. // List: Lists the Roles defined on a resource.
  2038. func (r *OrganizationsRolesService) List(parent string) *OrganizationsRolesListCall {
  2039. c := &OrganizationsRolesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2040. c.parent = parent
  2041. return c
  2042. }
  2043. // PageSize sets the optional parameter "pageSize": Optional limit on
  2044. // the number of roles to include in the response.
  2045. func (c *OrganizationsRolesListCall) PageSize(pageSize int64) *OrganizationsRolesListCall {
  2046. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2047. return c
  2048. }
  2049. // PageToken sets the optional parameter "pageToken": Optional
  2050. // pagination token returned in an earlier ListRolesResponse.
  2051. func (c *OrganizationsRolesListCall) PageToken(pageToken string) *OrganizationsRolesListCall {
  2052. c.urlParams_.Set("pageToken", pageToken)
  2053. return c
  2054. }
  2055. // ShowDeleted sets the optional parameter "showDeleted": Include Roles
  2056. // that have been deleted.
  2057. func (c *OrganizationsRolesListCall) ShowDeleted(showDeleted bool) *OrganizationsRolesListCall {
  2058. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  2059. return c
  2060. }
  2061. // View sets the optional parameter "view": Optional view for the
  2062. // returned Role objects.
  2063. //
  2064. // Possible values:
  2065. // "BASIC"
  2066. // "FULL"
  2067. func (c *OrganizationsRolesListCall) View(view string) *OrganizationsRolesListCall {
  2068. c.urlParams_.Set("view", view)
  2069. return c
  2070. }
  2071. // Fields allows partial responses to be retrieved. See
  2072. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2073. // for more information.
  2074. func (c *OrganizationsRolesListCall) Fields(s ...googleapi.Field) *OrganizationsRolesListCall {
  2075. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2076. return c
  2077. }
  2078. // IfNoneMatch sets the optional parameter which makes the operation
  2079. // fail if the object's ETag matches the given value. This is useful for
  2080. // getting updates only after the object has changed since the last
  2081. // request. Use googleapi.IsNotModified to check whether the response
  2082. // error from Do is the result of In-None-Match.
  2083. func (c *OrganizationsRolesListCall) IfNoneMatch(entityTag string) *OrganizationsRolesListCall {
  2084. c.ifNoneMatch_ = entityTag
  2085. return c
  2086. }
  2087. // Context sets the context to be used in this call's Do method. Any
  2088. // pending HTTP request will be aborted if the provided context is
  2089. // canceled.
  2090. func (c *OrganizationsRolesListCall) Context(ctx context.Context) *OrganizationsRolesListCall {
  2091. c.ctx_ = ctx
  2092. return c
  2093. }
  2094. // Header returns an http.Header that can be modified by the caller to
  2095. // add HTTP headers to the request.
  2096. func (c *OrganizationsRolesListCall) Header() http.Header {
  2097. if c.header_ == nil {
  2098. c.header_ = make(http.Header)
  2099. }
  2100. return c.header_
  2101. }
  2102. func (c *OrganizationsRolesListCall) doRequest(alt string) (*http.Response, error) {
  2103. reqHeaders := make(http.Header)
  2104. for k, v := range c.header_ {
  2105. reqHeaders[k] = v
  2106. }
  2107. reqHeaders.Set("User-Agent", c.s.userAgent())
  2108. if c.ifNoneMatch_ != "" {
  2109. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2110. }
  2111. var body io.Reader = nil
  2112. c.urlParams_.Set("alt", alt)
  2113. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/roles")
  2114. urls += "?" + c.urlParams_.Encode()
  2115. req, _ := http.NewRequest("GET", urls, body)
  2116. req.Header = reqHeaders
  2117. googleapi.Expand(req.URL, map[string]string{
  2118. "parent": c.parent,
  2119. })
  2120. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2121. }
  2122. // Do executes the "iam.organizations.roles.list" call.
  2123. // Exactly one of *ListRolesResponse or error will be non-nil. Any
  2124. // non-2xx status code is an error. Response headers are in either
  2125. // *ListRolesResponse.ServerResponse.Header or (if a response was
  2126. // returned at all) in error.(*googleapi.Error).Header. Use
  2127. // googleapi.IsNotModified to check whether the returned error was
  2128. // because http.StatusNotModified was returned.
  2129. func (c *OrganizationsRolesListCall) Do(opts ...googleapi.CallOption) (*ListRolesResponse, error) {
  2130. gensupport.SetOptions(c.urlParams_, opts...)
  2131. res, err := c.doRequest("json")
  2132. if res != nil && res.StatusCode == http.StatusNotModified {
  2133. if res.Body != nil {
  2134. res.Body.Close()
  2135. }
  2136. return nil, &googleapi.Error{
  2137. Code: res.StatusCode,
  2138. Header: res.Header,
  2139. }
  2140. }
  2141. if err != nil {
  2142. return nil, err
  2143. }
  2144. defer googleapi.CloseBody(res)
  2145. if err := googleapi.CheckResponse(res); err != nil {
  2146. return nil, err
  2147. }
  2148. ret := &ListRolesResponse{
  2149. ServerResponse: googleapi.ServerResponse{
  2150. Header: res.Header,
  2151. HTTPStatusCode: res.StatusCode,
  2152. },
  2153. }
  2154. target := &ret
  2155. if err := gensupport.DecodeResponse(target, res); err != nil {
  2156. return nil, err
  2157. }
  2158. return ret, nil
  2159. // {
  2160. // "description": "Lists the Roles defined on a resource.",
  2161. // "flatPath": "v1/organizations/{organizationsId}/roles",
  2162. // "httpMethod": "GET",
  2163. // "id": "iam.organizations.roles.list",
  2164. // "parameterOrder": [
  2165. // "parent"
  2166. // ],
  2167. // "parameters": {
  2168. // "pageSize": {
  2169. // "description": "Optional limit on the number of roles to include in the response.",
  2170. // "format": "int32",
  2171. // "location": "query",
  2172. // "type": "integer"
  2173. // },
  2174. // "pageToken": {
  2175. // "description": "Optional pagination token returned in an earlier ListRolesResponse.",
  2176. // "location": "query",
  2177. // "type": "string"
  2178. // },
  2179. // "parent": {
  2180. // "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}`",
  2181. // "location": "path",
  2182. // "pattern": "^organizations/[^/]+$",
  2183. // "required": true,
  2184. // "type": "string"
  2185. // },
  2186. // "showDeleted": {
  2187. // "description": "Include Roles that have been deleted.",
  2188. // "location": "query",
  2189. // "type": "boolean"
  2190. // },
  2191. // "view": {
  2192. // "description": "Optional view for the returned Role objects.",
  2193. // "enum": [
  2194. // "BASIC",
  2195. // "FULL"
  2196. // ],
  2197. // "location": "query",
  2198. // "type": "string"
  2199. // }
  2200. // },
  2201. // "path": "v1/{+parent}/roles",
  2202. // "response": {
  2203. // "$ref": "ListRolesResponse"
  2204. // },
  2205. // "scopes": [
  2206. // "https://www.googleapis.com/auth/cloud-platform"
  2207. // ]
  2208. // }
  2209. }
  2210. // Pages invokes f for each page of results.
  2211. // A non-nil error returned from f will halt the iteration.
  2212. // The provided context supersedes any context provided to the Context method.
  2213. func (c *OrganizationsRolesListCall) Pages(ctx context.Context, f func(*ListRolesResponse) error) error {
  2214. c.ctx_ = ctx
  2215. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2216. for {
  2217. x, err := c.Do()
  2218. if err != nil {
  2219. return err
  2220. }
  2221. if err := f(x); err != nil {
  2222. return err
  2223. }
  2224. if x.NextPageToken == "" {
  2225. return nil
  2226. }
  2227. c.PageToken(x.NextPageToken)
  2228. }
  2229. }
  2230. // method id "iam.organizations.roles.patch":
  2231. type OrganizationsRolesPatchCall struct {
  2232. s *Service
  2233. name string
  2234. role *Role
  2235. urlParams_ gensupport.URLParams
  2236. ctx_ context.Context
  2237. header_ http.Header
  2238. }
  2239. // Patch: Updates a Role definition.
  2240. func (r *OrganizationsRolesService) Patch(name string, role *Role) *OrganizationsRolesPatchCall {
  2241. c := &OrganizationsRolesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2242. c.name = name
  2243. c.role = role
  2244. return c
  2245. }
  2246. // UpdateMask sets the optional parameter "updateMask": A mask
  2247. // describing which fields in the Role have changed.
  2248. func (c *OrganizationsRolesPatchCall) UpdateMask(updateMask string) *OrganizationsRolesPatchCall {
  2249. c.urlParams_.Set("updateMask", updateMask)
  2250. return c
  2251. }
  2252. // Fields allows partial responses to be retrieved. See
  2253. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2254. // for more information.
  2255. func (c *OrganizationsRolesPatchCall) Fields(s ...googleapi.Field) *OrganizationsRolesPatchCall {
  2256. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2257. return c
  2258. }
  2259. // Context sets the context to be used in this call's Do method. Any
  2260. // pending HTTP request will be aborted if the provided context is
  2261. // canceled.
  2262. func (c *OrganizationsRolesPatchCall) Context(ctx context.Context) *OrganizationsRolesPatchCall {
  2263. c.ctx_ = ctx
  2264. return c
  2265. }
  2266. // Header returns an http.Header that can be modified by the caller to
  2267. // add HTTP headers to the request.
  2268. func (c *OrganizationsRolesPatchCall) Header() http.Header {
  2269. if c.header_ == nil {
  2270. c.header_ = make(http.Header)
  2271. }
  2272. return c.header_
  2273. }
  2274. func (c *OrganizationsRolesPatchCall) doRequest(alt string) (*http.Response, error) {
  2275. reqHeaders := make(http.Header)
  2276. for k, v := range c.header_ {
  2277. reqHeaders[k] = v
  2278. }
  2279. reqHeaders.Set("User-Agent", c.s.userAgent())
  2280. var body io.Reader = nil
  2281. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  2282. if err != nil {
  2283. return nil, err
  2284. }
  2285. reqHeaders.Set("Content-Type", "application/json")
  2286. c.urlParams_.Set("alt", alt)
  2287. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2288. urls += "?" + c.urlParams_.Encode()
  2289. req, _ := http.NewRequest("PATCH", urls, body)
  2290. req.Header = reqHeaders
  2291. googleapi.Expand(req.URL, map[string]string{
  2292. "name": c.name,
  2293. })
  2294. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2295. }
  2296. // Do executes the "iam.organizations.roles.patch" call.
  2297. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  2298. // code is an error. Response headers are in either
  2299. // *Role.ServerResponse.Header or (if a response was returned at all) in
  2300. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2301. // whether the returned error was because http.StatusNotModified was
  2302. // returned.
  2303. func (c *OrganizationsRolesPatchCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  2304. gensupport.SetOptions(c.urlParams_, opts...)
  2305. res, err := c.doRequest("json")
  2306. if res != nil && res.StatusCode == http.StatusNotModified {
  2307. if res.Body != nil {
  2308. res.Body.Close()
  2309. }
  2310. return nil, &googleapi.Error{
  2311. Code: res.StatusCode,
  2312. Header: res.Header,
  2313. }
  2314. }
  2315. if err != nil {
  2316. return nil, err
  2317. }
  2318. defer googleapi.CloseBody(res)
  2319. if err := googleapi.CheckResponse(res); err != nil {
  2320. return nil, err
  2321. }
  2322. ret := &Role{
  2323. ServerResponse: googleapi.ServerResponse{
  2324. Header: res.Header,
  2325. HTTPStatusCode: res.StatusCode,
  2326. },
  2327. }
  2328. target := &ret
  2329. if err := gensupport.DecodeResponse(target, res); err != nil {
  2330. return nil, err
  2331. }
  2332. return ret, nil
  2333. // {
  2334. // "description": "Updates a Role definition.",
  2335. // "flatPath": "v1/organizations/{organizationsId}/roles/{rolesId}",
  2336. // "httpMethod": "PATCH",
  2337. // "id": "iam.organizations.roles.patch",
  2338. // "parameterOrder": [
  2339. // "name"
  2340. // ],
  2341. // "parameters": {
  2342. // "name": {
  2343. // "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}`",
  2344. // "location": "path",
  2345. // "pattern": "^organizations/[^/]+/roles/[^/]+$",
  2346. // "required": true,
  2347. // "type": "string"
  2348. // },
  2349. // "updateMask": {
  2350. // "description": "A mask describing which fields in the Role have changed.",
  2351. // "format": "google-fieldmask",
  2352. // "location": "query",
  2353. // "type": "string"
  2354. // }
  2355. // },
  2356. // "path": "v1/{+name}",
  2357. // "request": {
  2358. // "$ref": "Role"
  2359. // },
  2360. // "response": {
  2361. // "$ref": "Role"
  2362. // },
  2363. // "scopes": [
  2364. // "https://www.googleapis.com/auth/cloud-platform"
  2365. // ]
  2366. // }
  2367. }
  2368. // method id "iam.organizations.roles.undelete":
  2369. type OrganizationsRolesUndeleteCall struct {
  2370. s *Service
  2371. name string
  2372. undeleterolerequest *UndeleteRoleRequest
  2373. urlParams_ gensupport.URLParams
  2374. ctx_ context.Context
  2375. header_ http.Header
  2376. }
  2377. // Undelete: Undelete a Role, bringing it back in its previous state.
  2378. func (r *OrganizationsRolesService) Undelete(name string, undeleterolerequest *UndeleteRoleRequest) *OrganizationsRolesUndeleteCall {
  2379. c := &OrganizationsRolesUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2380. c.name = name
  2381. c.undeleterolerequest = undeleterolerequest
  2382. return c
  2383. }
  2384. // Fields allows partial responses to be retrieved. See
  2385. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2386. // for more information.
  2387. func (c *OrganizationsRolesUndeleteCall) Fields(s ...googleapi.Field) *OrganizationsRolesUndeleteCall {
  2388. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2389. return c
  2390. }
  2391. // Context sets the context to be used in this call's Do method. Any
  2392. // pending HTTP request will be aborted if the provided context is
  2393. // canceled.
  2394. func (c *OrganizationsRolesUndeleteCall) Context(ctx context.Context) *OrganizationsRolesUndeleteCall {
  2395. c.ctx_ = ctx
  2396. return c
  2397. }
  2398. // Header returns an http.Header that can be modified by the caller to
  2399. // add HTTP headers to the request.
  2400. func (c *OrganizationsRolesUndeleteCall) Header() http.Header {
  2401. if c.header_ == nil {
  2402. c.header_ = make(http.Header)
  2403. }
  2404. return c.header_
  2405. }
  2406. func (c *OrganizationsRolesUndeleteCall) doRequest(alt string) (*http.Response, error) {
  2407. reqHeaders := make(http.Header)
  2408. for k, v := range c.header_ {
  2409. reqHeaders[k] = v
  2410. }
  2411. reqHeaders.Set("User-Agent", c.s.userAgent())
  2412. var body io.Reader = nil
  2413. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeleterolerequest)
  2414. if err != nil {
  2415. return nil, err
  2416. }
  2417. reqHeaders.Set("Content-Type", "application/json")
  2418. c.urlParams_.Set("alt", alt)
  2419. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:undelete")
  2420. urls += "?" + c.urlParams_.Encode()
  2421. req, _ := http.NewRequest("POST", urls, body)
  2422. req.Header = reqHeaders
  2423. googleapi.Expand(req.URL, map[string]string{
  2424. "name": c.name,
  2425. })
  2426. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2427. }
  2428. // Do executes the "iam.organizations.roles.undelete" call.
  2429. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  2430. // code is an error. Response headers are in either
  2431. // *Role.ServerResponse.Header or (if a response was returned at all) in
  2432. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2433. // whether the returned error was because http.StatusNotModified was
  2434. // returned.
  2435. func (c *OrganizationsRolesUndeleteCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  2436. gensupport.SetOptions(c.urlParams_, opts...)
  2437. res, err := c.doRequest("json")
  2438. if res != nil && res.StatusCode == http.StatusNotModified {
  2439. if res.Body != nil {
  2440. res.Body.Close()
  2441. }
  2442. return nil, &googleapi.Error{
  2443. Code: res.StatusCode,
  2444. Header: res.Header,
  2445. }
  2446. }
  2447. if err != nil {
  2448. return nil, err
  2449. }
  2450. defer googleapi.CloseBody(res)
  2451. if err := googleapi.CheckResponse(res); err != nil {
  2452. return nil, err
  2453. }
  2454. ret := &Role{
  2455. ServerResponse: googleapi.ServerResponse{
  2456. Header: res.Header,
  2457. HTTPStatusCode: res.StatusCode,
  2458. },
  2459. }
  2460. target := &ret
  2461. if err := gensupport.DecodeResponse(target, res); err != nil {
  2462. return nil, err
  2463. }
  2464. return ret, nil
  2465. // {
  2466. // "description": "Undelete a Role, bringing it back in its previous state.",
  2467. // "flatPath": "v1/organizations/{organizationsId}/roles/{rolesId}:undelete",
  2468. // "httpMethod": "POST",
  2469. // "id": "iam.organizations.roles.undelete",
  2470. // "parameterOrder": [
  2471. // "name"
  2472. // ],
  2473. // "parameters": {
  2474. // "name": {
  2475. // "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}`",
  2476. // "location": "path",
  2477. // "pattern": "^organizations/[^/]+/roles/[^/]+$",
  2478. // "required": true,
  2479. // "type": "string"
  2480. // }
  2481. // },
  2482. // "path": "v1/{+name}:undelete",
  2483. // "request": {
  2484. // "$ref": "UndeleteRoleRequest"
  2485. // },
  2486. // "response": {
  2487. // "$ref": "Role"
  2488. // },
  2489. // "scopes": [
  2490. // "https://www.googleapis.com/auth/cloud-platform"
  2491. // ]
  2492. // }
  2493. }
  2494. // method id "iam.permissions.queryTestablePermissions":
  2495. type PermissionsQueryTestablePermissionsCall struct {
  2496. s *Service
  2497. querytestablepermissionsrequest *QueryTestablePermissionsRequest
  2498. urlParams_ gensupport.URLParams
  2499. ctx_ context.Context
  2500. header_ http.Header
  2501. }
  2502. // QueryTestablePermissions: Lists the permissions testable on a
  2503. // resource.
  2504. // A permission is testable if it can be tested for an identity on a
  2505. // resource.
  2506. func (r *PermissionsService) QueryTestablePermissions(querytestablepermissionsrequest *QueryTestablePermissionsRequest) *PermissionsQueryTestablePermissionsCall {
  2507. c := &PermissionsQueryTestablePermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2508. c.querytestablepermissionsrequest = querytestablepermissionsrequest
  2509. return c
  2510. }
  2511. // Fields allows partial responses to be retrieved. See
  2512. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2513. // for more information.
  2514. func (c *PermissionsQueryTestablePermissionsCall) Fields(s ...googleapi.Field) *PermissionsQueryTestablePermissionsCall {
  2515. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2516. return c
  2517. }
  2518. // Context sets the context to be used in this call's Do method. Any
  2519. // pending HTTP request will be aborted if the provided context is
  2520. // canceled.
  2521. func (c *PermissionsQueryTestablePermissionsCall) Context(ctx context.Context) *PermissionsQueryTestablePermissionsCall {
  2522. c.ctx_ = ctx
  2523. return c
  2524. }
  2525. // Header returns an http.Header that can be modified by the caller to
  2526. // add HTTP headers to the request.
  2527. func (c *PermissionsQueryTestablePermissionsCall) Header() http.Header {
  2528. if c.header_ == nil {
  2529. c.header_ = make(http.Header)
  2530. }
  2531. return c.header_
  2532. }
  2533. func (c *PermissionsQueryTestablePermissionsCall) doRequest(alt string) (*http.Response, error) {
  2534. reqHeaders := make(http.Header)
  2535. for k, v := range c.header_ {
  2536. reqHeaders[k] = v
  2537. }
  2538. reqHeaders.Set("User-Agent", c.s.userAgent())
  2539. var body io.Reader = nil
  2540. body, err := googleapi.WithoutDataWrapper.JSONReader(c.querytestablepermissionsrequest)
  2541. if err != nil {
  2542. return nil, err
  2543. }
  2544. reqHeaders.Set("Content-Type", "application/json")
  2545. c.urlParams_.Set("alt", alt)
  2546. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/permissions:queryTestablePermissions")
  2547. urls += "?" + c.urlParams_.Encode()
  2548. req, _ := http.NewRequest("POST", urls, body)
  2549. req.Header = reqHeaders
  2550. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2551. }
  2552. // Do executes the "iam.permissions.queryTestablePermissions" call.
  2553. // Exactly one of *QueryTestablePermissionsResponse or error will be
  2554. // non-nil. Any non-2xx status code is an error. Response headers are in
  2555. // either *QueryTestablePermissionsResponse.ServerResponse.Header or (if
  2556. // a response was returned at all) in error.(*googleapi.Error).Header.
  2557. // Use googleapi.IsNotModified to check whether the returned error was
  2558. // because http.StatusNotModified was returned.
  2559. func (c *PermissionsQueryTestablePermissionsCall) Do(opts ...googleapi.CallOption) (*QueryTestablePermissionsResponse, error) {
  2560. gensupport.SetOptions(c.urlParams_, opts...)
  2561. res, err := c.doRequest("json")
  2562. if res != nil && res.StatusCode == http.StatusNotModified {
  2563. if res.Body != nil {
  2564. res.Body.Close()
  2565. }
  2566. return nil, &googleapi.Error{
  2567. Code: res.StatusCode,
  2568. Header: res.Header,
  2569. }
  2570. }
  2571. if err != nil {
  2572. return nil, err
  2573. }
  2574. defer googleapi.CloseBody(res)
  2575. if err := googleapi.CheckResponse(res); err != nil {
  2576. return nil, err
  2577. }
  2578. ret := &QueryTestablePermissionsResponse{
  2579. ServerResponse: googleapi.ServerResponse{
  2580. Header: res.Header,
  2581. HTTPStatusCode: res.StatusCode,
  2582. },
  2583. }
  2584. target := &ret
  2585. if err := gensupport.DecodeResponse(target, res); err != nil {
  2586. return nil, err
  2587. }
  2588. return ret, nil
  2589. // {
  2590. // "description": "Lists the permissions testable on a resource.\nA permission is testable if it can be tested for an identity on a resource.",
  2591. // "flatPath": "v1/permissions:queryTestablePermissions",
  2592. // "httpMethod": "POST",
  2593. // "id": "iam.permissions.queryTestablePermissions",
  2594. // "parameterOrder": [],
  2595. // "parameters": {},
  2596. // "path": "v1/permissions:queryTestablePermissions",
  2597. // "request": {
  2598. // "$ref": "QueryTestablePermissionsRequest"
  2599. // },
  2600. // "response": {
  2601. // "$ref": "QueryTestablePermissionsResponse"
  2602. // },
  2603. // "scopes": [
  2604. // "https://www.googleapis.com/auth/cloud-platform"
  2605. // ]
  2606. // }
  2607. }
  2608. // Pages invokes f for each page of results.
  2609. // A non-nil error returned from f will halt the iteration.
  2610. // The provided context supersedes any context provided to the Context method.
  2611. func (c *PermissionsQueryTestablePermissionsCall) Pages(ctx context.Context, f func(*QueryTestablePermissionsResponse) error) error {
  2612. c.ctx_ = ctx
  2613. defer func(pt string) { c.querytestablepermissionsrequest.PageToken = pt }(c.querytestablepermissionsrequest.PageToken) // reset paging to original point
  2614. for {
  2615. x, err := c.Do()
  2616. if err != nil {
  2617. return err
  2618. }
  2619. if err := f(x); err != nil {
  2620. return err
  2621. }
  2622. if x.NextPageToken == "" {
  2623. return nil
  2624. }
  2625. c.querytestablepermissionsrequest.PageToken = x.NextPageToken
  2626. }
  2627. }
  2628. // method id "iam.projects.roles.create":
  2629. type ProjectsRolesCreateCall struct {
  2630. s *Service
  2631. parent string
  2632. createrolerequest *CreateRoleRequest
  2633. urlParams_ gensupport.URLParams
  2634. ctx_ context.Context
  2635. header_ http.Header
  2636. }
  2637. // Create: Creates a new Role.
  2638. func (r *ProjectsRolesService) Create(parent string, createrolerequest *CreateRoleRequest) *ProjectsRolesCreateCall {
  2639. c := &ProjectsRolesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2640. c.parent = parent
  2641. c.createrolerequest = createrolerequest
  2642. return c
  2643. }
  2644. // Fields allows partial responses to be retrieved. See
  2645. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2646. // for more information.
  2647. func (c *ProjectsRolesCreateCall) Fields(s ...googleapi.Field) *ProjectsRolesCreateCall {
  2648. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2649. return c
  2650. }
  2651. // Context sets the context to be used in this call's Do method. Any
  2652. // pending HTTP request will be aborted if the provided context is
  2653. // canceled.
  2654. func (c *ProjectsRolesCreateCall) Context(ctx context.Context) *ProjectsRolesCreateCall {
  2655. c.ctx_ = ctx
  2656. return c
  2657. }
  2658. // Header returns an http.Header that can be modified by the caller to
  2659. // add HTTP headers to the request.
  2660. func (c *ProjectsRolesCreateCall) Header() http.Header {
  2661. if c.header_ == nil {
  2662. c.header_ = make(http.Header)
  2663. }
  2664. return c.header_
  2665. }
  2666. func (c *ProjectsRolesCreateCall) doRequest(alt string) (*http.Response, error) {
  2667. reqHeaders := make(http.Header)
  2668. for k, v := range c.header_ {
  2669. reqHeaders[k] = v
  2670. }
  2671. reqHeaders.Set("User-Agent", c.s.userAgent())
  2672. var body io.Reader = nil
  2673. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createrolerequest)
  2674. if err != nil {
  2675. return nil, err
  2676. }
  2677. reqHeaders.Set("Content-Type", "application/json")
  2678. c.urlParams_.Set("alt", alt)
  2679. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/roles")
  2680. urls += "?" + c.urlParams_.Encode()
  2681. req, _ := http.NewRequest("POST", urls, body)
  2682. req.Header = reqHeaders
  2683. googleapi.Expand(req.URL, map[string]string{
  2684. "parent": c.parent,
  2685. })
  2686. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2687. }
  2688. // Do executes the "iam.projects.roles.create" call.
  2689. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  2690. // code is an error. Response headers are in either
  2691. // *Role.ServerResponse.Header or (if a response was returned at all) in
  2692. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2693. // whether the returned error was because http.StatusNotModified was
  2694. // returned.
  2695. func (c *ProjectsRolesCreateCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  2696. gensupport.SetOptions(c.urlParams_, opts...)
  2697. res, err := c.doRequest("json")
  2698. if res != nil && res.StatusCode == http.StatusNotModified {
  2699. if res.Body != nil {
  2700. res.Body.Close()
  2701. }
  2702. return nil, &googleapi.Error{
  2703. Code: res.StatusCode,
  2704. Header: res.Header,
  2705. }
  2706. }
  2707. if err != nil {
  2708. return nil, err
  2709. }
  2710. defer googleapi.CloseBody(res)
  2711. if err := googleapi.CheckResponse(res); err != nil {
  2712. return nil, err
  2713. }
  2714. ret := &Role{
  2715. ServerResponse: googleapi.ServerResponse{
  2716. Header: res.Header,
  2717. HTTPStatusCode: res.StatusCode,
  2718. },
  2719. }
  2720. target := &ret
  2721. if err := gensupport.DecodeResponse(target, res); err != nil {
  2722. return nil, err
  2723. }
  2724. return ret, nil
  2725. // {
  2726. // "description": "Creates a new Role.",
  2727. // "flatPath": "v1/projects/{projectsId}/roles",
  2728. // "httpMethod": "POST",
  2729. // "id": "iam.projects.roles.create",
  2730. // "parameterOrder": [
  2731. // "parent"
  2732. // ],
  2733. // "parameters": {
  2734. // "parent": {
  2735. // "description": "The resource name of the parent resource in one of the following formats:\n`organizations/{ORGANIZATION_ID}`\n`projects/{PROJECT_ID}`",
  2736. // "location": "path",
  2737. // "pattern": "^projects/[^/]+$",
  2738. // "required": true,
  2739. // "type": "string"
  2740. // }
  2741. // },
  2742. // "path": "v1/{+parent}/roles",
  2743. // "request": {
  2744. // "$ref": "CreateRoleRequest"
  2745. // },
  2746. // "response": {
  2747. // "$ref": "Role"
  2748. // },
  2749. // "scopes": [
  2750. // "https://www.googleapis.com/auth/cloud-platform"
  2751. // ]
  2752. // }
  2753. }
  2754. // method id "iam.projects.roles.delete":
  2755. type ProjectsRolesDeleteCall struct {
  2756. s *Service
  2757. name string
  2758. urlParams_ gensupport.URLParams
  2759. ctx_ context.Context
  2760. header_ http.Header
  2761. }
  2762. // Delete: Soft deletes a role. The role is suspended and cannot be used
  2763. // to create new
  2764. // IAM Policy Bindings.
  2765. // The Role will not be included in `ListRoles()` unless `show_deleted`
  2766. // is set
  2767. // in the `ListRolesRequest`. The Role contains the deleted boolean
  2768. // set.
  2769. // Existing Bindings remains, but are inactive. The Role can be
  2770. // undeleted
  2771. // within 7 days. After 7 days the Role is deleted and all Bindings
  2772. // associated
  2773. // with the role are removed.
  2774. func (r *ProjectsRolesService) Delete(name string) *ProjectsRolesDeleteCall {
  2775. c := &ProjectsRolesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2776. c.name = name
  2777. return c
  2778. }
  2779. // Etag sets the optional parameter "etag": Used to perform a consistent
  2780. // read-modify-write.
  2781. func (c *ProjectsRolesDeleteCall) Etag(etag string) *ProjectsRolesDeleteCall {
  2782. c.urlParams_.Set("etag", etag)
  2783. return c
  2784. }
  2785. // Fields allows partial responses to be retrieved. See
  2786. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2787. // for more information.
  2788. func (c *ProjectsRolesDeleteCall) Fields(s ...googleapi.Field) *ProjectsRolesDeleteCall {
  2789. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2790. return c
  2791. }
  2792. // Context sets the context to be used in this call's Do method. Any
  2793. // pending HTTP request will be aborted if the provided context is
  2794. // canceled.
  2795. func (c *ProjectsRolesDeleteCall) Context(ctx context.Context) *ProjectsRolesDeleteCall {
  2796. c.ctx_ = ctx
  2797. return c
  2798. }
  2799. // Header returns an http.Header that can be modified by the caller to
  2800. // add HTTP headers to the request.
  2801. func (c *ProjectsRolesDeleteCall) Header() http.Header {
  2802. if c.header_ == nil {
  2803. c.header_ = make(http.Header)
  2804. }
  2805. return c.header_
  2806. }
  2807. func (c *ProjectsRolesDeleteCall) doRequest(alt string) (*http.Response, error) {
  2808. reqHeaders := make(http.Header)
  2809. for k, v := range c.header_ {
  2810. reqHeaders[k] = v
  2811. }
  2812. reqHeaders.Set("User-Agent", c.s.userAgent())
  2813. var body io.Reader = nil
  2814. c.urlParams_.Set("alt", alt)
  2815. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2816. urls += "?" + c.urlParams_.Encode()
  2817. req, _ := http.NewRequest("DELETE", urls, body)
  2818. req.Header = reqHeaders
  2819. googleapi.Expand(req.URL, map[string]string{
  2820. "name": c.name,
  2821. })
  2822. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2823. }
  2824. // Do executes the "iam.projects.roles.delete" call.
  2825. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  2826. // code is an error. Response headers are in either
  2827. // *Role.ServerResponse.Header or (if a response was returned at all) in
  2828. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2829. // whether the returned error was because http.StatusNotModified was
  2830. // returned.
  2831. func (c *ProjectsRolesDeleteCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  2832. gensupport.SetOptions(c.urlParams_, opts...)
  2833. res, err := c.doRequest("json")
  2834. if res != nil && res.StatusCode == http.StatusNotModified {
  2835. if res.Body != nil {
  2836. res.Body.Close()
  2837. }
  2838. return nil, &googleapi.Error{
  2839. Code: res.StatusCode,
  2840. Header: res.Header,
  2841. }
  2842. }
  2843. if err != nil {
  2844. return nil, err
  2845. }
  2846. defer googleapi.CloseBody(res)
  2847. if err := googleapi.CheckResponse(res); err != nil {
  2848. return nil, err
  2849. }
  2850. ret := &Role{
  2851. ServerResponse: googleapi.ServerResponse{
  2852. Header: res.Header,
  2853. HTTPStatusCode: res.StatusCode,
  2854. },
  2855. }
  2856. target := &ret
  2857. if err := gensupport.DecodeResponse(target, res); err != nil {
  2858. return nil, err
  2859. }
  2860. return ret, nil
  2861. // {
  2862. // "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.",
  2863. // "flatPath": "v1/projects/{projectsId}/roles/{rolesId}",
  2864. // "httpMethod": "DELETE",
  2865. // "id": "iam.projects.roles.delete",
  2866. // "parameterOrder": [
  2867. // "name"
  2868. // ],
  2869. // "parameters": {
  2870. // "etag": {
  2871. // "description": "Used to perform a consistent read-modify-write.",
  2872. // "format": "byte",
  2873. // "location": "query",
  2874. // "type": "string"
  2875. // },
  2876. // "name": {
  2877. // "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}`",
  2878. // "location": "path",
  2879. // "pattern": "^projects/[^/]+/roles/[^/]+$",
  2880. // "required": true,
  2881. // "type": "string"
  2882. // }
  2883. // },
  2884. // "path": "v1/{+name}",
  2885. // "response": {
  2886. // "$ref": "Role"
  2887. // },
  2888. // "scopes": [
  2889. // "https://www.googleapis.com/auth/cloud-platform"
  2890. // ]
  2891. // }
  2892. }
  2893. // method id "iam.projects.roles.get":
  2894. type ProjectsRolesGetCall struct {
  2895. s *Service
  2896. name string
  2897. urlParams_ gensupport.URLParams
  2898. ifNoneMatch_ string
  2899. ctx_ context.Context
  2900. header_ http.Header
  2901. }
  2902. // Get: Gets a Role definition.
  2903. func (r *ProjectsRolesService) Get(name string) *ProjectsRolesGetCall {
  2904. c := &ProjectsRolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2905. c.name = name
  2906. return c
  2907. }
  2908. // Fields allows partial responses to be retrieved. See
  2909. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2910. // for more information.
  2911. func (c *ProjectsRolesGetCall) Fields(s ...googleapi.Field) *ProjectsRolesGetCall {
  2912. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2913. return c
  2914. }
  2915. // IfNoneMatch sets the optional parameter which makes the operation
  2916. // fail if the object's ETag matches the given value. This is useful for
  2917. // getting updates only after the object has changed since the last
  2918. // request. Use googleapi.IsNotModified to check whether the response
  2919. // error from Do is the result of In-None-Match.
  2920. func (c *ProjectsRolesGetCall) IfNoneMatch(entityTag string) *ProjectsRolesGetCall {
  2921. c.ifNoneMatch_ = entityTag
  2922. return c
  2923. }
  2924. // Context sets the context to be used in this call's Do method. Any
  2925. // pending HTTP request will be aborted if the provided context is
  2926. // canceled.
  2927. func (c *ProjectsRolesGetCall) Context(ctx context.Context) *ProjectsRolesGetCall {
  2928. c.ctx_ = ctx
  2929. return c
  2930. }
  2931. // Header returns an http.Header that can be modified by the caller to
  2932. // add HTTP headers to the request.
  2933. func (c *ProjectsRolesGetCall) Header() http.Header {
  2934. if c.header_ == nil {
  2935. c.header_ = make(http.Header)
  2936. }
  2937. return c.header_
  2938. }
  2939. func (c *ProjectsRolesGetCall) doRequest(alt string) (*http.Response, error) {
  2940. reqHeaders := make(http.Header)
  2941. for k, v := range c.header_ {
  2942. reqHeaders[k] = v
  2943. }
  2944. reqHeaders.Set("User-Agent", c.s.userAgent())
  2945. if c.ifNoneMatch_ != "" {
  2946. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2947. }
  2948. var body io.Reader = nil
  2949. c.urlParams_.Set("alt", alt)
  2950. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2951. urls += "?" + c.urlParams_.Encode()
  2952. req, _ := http.NewRequest("GET", urls, body)
  2953. req.Header = reqHeaders
  2954. googleapi.Expand(req.URL, map[string]string{
  2955. "name": c.name,
  2956. })
  2957. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2958. }
  2959. // Do executes the "iam.projects.roles.get" call.
  2960. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  2961. // code is an error. Response headers are in either
  2962. // *Role.ServerResponse.Header or (if a response was returned at all) in
  2963. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2964. // whether the returned error was because http.StatusNotModified was
  2965. // returned.
  2966. func (c *ProjectsRolesGetCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  2967. gensupport.SetOptions(c.urlParams_, opts...)
  2968. res, err := c.doRequest("json")
  2969. if res != nil && res.StatusCode == http.StatusNotModified {
  2970. if res.Body != nil {
  2971. res.Body.Close()
  2972. }
  2973. return nil, &googleapi.Error{
  2974. Code: res.StatusCode,
  2975. Header: res.Header,
  2976. }
  2977. }
  2978. if err != nil {
  2979. return nil, err
  2980. }
  2981. defer googleapi.CloseBody(res)
  2982. if err := googleapi.CheckResponse(res); err != nil {
  2983. return nil, err
  2984. }
  2985. ret := &Role{
  2986. ServerResponse: googleapi.ServerResponse{
  2987. Header: res.Header,
  2988. HTTPStatusCode: res.StatusCode,
  2989. },
  2990. }
  2991. target := &ret
  2992. if err := gensupport.DecodeResponse(target, res); err != nil {
  2993. return nil, err
  2994. }
  2995. return ret, nil
  2996. // {
  2997. // "description": "Gets a Role definition.",
  2998. // "flatPath": "v1/projects/{projectsId}/roles/{rolesId}",
  2999. // "httpMethod": "GET",
  3000. // "id": "iam.projects.roles.get",
  3001. // "parameterOrder": [
  3002. // "name"
  3003. // ],
  3004. // "parameters": {
  3005. // "name": {
  3006. // "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}`",
  3007. // "location": "path",
  3008. // "pattern": "^projects/[^/]+/roles/[^/]+$",
  3009. // "required": true,
  3010. // "type": "string"
  3011. // }
  3012. // },
  3013. // "path": "v1/{+name}",
  3014. // "response": {
  3015. // "$ref": "Role"
  3016. // },
  3017. // "scopes": [
  3018. // "https://www.googleapis.com/auth/cloud-platform"
  3019. // ]
  3020. // }
  3021. }
  3022. // method id "iam.projects.roles.list":
  3023. type ProjectsRolesListCall struct {
  3024. s *Service
  3025. parent string
  3026. urlParams_ gensupport.URLParams
  3027. ifNoneMatch_ string
  3028. ctx_ context.Context
  3029. header_ http.Header
  3030. }
  3031. // List: Lists the Roles defined on a resource.
  3032. func (r *ProjectsRolesService) List(parent string) *ProjectsRolesListCall {
  3033. c := &ProjectsRolesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3034. c.parent = parent
  3035. return c
  3036. }
  3037. // PageSize sets the optional parameter "pageSize": Optional limit on
  3038. // the number of roles to include in the response.
  3039. func (c *ProjectsRolesListCall) PageSize(pageSize int64) *ProjectsRolesListCall {
  3040. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3041. return c
  3042. }
  3043. // PageToken sets the optional parameter "pageToken": Optional
  3044. // pagination token returned in an earlier ListRolesResponse.
  3045. func (c *ProjectsRolesListCall) PageToken(pageToken string) *ProjectsRolesListCall {
  3046. c.urlParams_.Set("pageToken", pageToken)
  3047. return c
  3048. }
  3049. // ShowDeleted sets the optional parameter "showDeleted": Include Roles
  3050. // that have been deleted.
  3051. func (c *ProjectsRolesListCall) ShowDeleted(showDeleted bool) *ProjectsRolesListCall {
  3052. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  3053. return c
  3054. }
  3055. // View sets the optional parameter "view": Optional view for the
  3056. // returned Role objects.
  3057. //
  3058. // Possible values:
  3059. // "BASIC"
  3060. // "FULL"
  3061. func (c *ProjectsRolesListCall) View(view string) *ProjectsRolesListCall {
  3062. c.urlParams_.Set("view", view)
  3063. return c
  3064. }
  3065. // Fields allows partial responses to be retrieved. See
  3066. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3067. // for more information.
  3068. func (c *ProjectsRolesListCall) Fields(s ...googleapi.Field) *ProjectsRolesListCall {
  3069. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3070. return c
  3071. }
  3072. // IfNoneMatch sets the optional parameter which makes the operation
  3073. // fail if the object's ETag matches the given value. This is useful for
  3074. // getting updates only after the object has changed since the last
  3075. // request. Use googleapi.IsNotModified to check whether the response
  3076. // error from Do is the result of In-None-Match.
  3077. func (c *ProjectsRolesListCall) IfNoneMatch(entityTag string) *ProjectsRolesListCall {
  3078. c.ifNoneMatch_ = entityTag
  3079. return c
  3080. }
  3081. // Context sets the context to be used in this call's Do method. Any
  3082. // pending HTTP request will be aborted if the provided context is
  3083. // canceled.
  3084. func (c *ProjectsRolesListCall) Context(ctx context.Context) *ProjectsRolesListCall {
  3085. c.ctx_ = ctx
  3086. return c
  3087. }
  3088. // Header returns an http.Header that can be modified by the caller to
  3089. // add HTTP headers to the request.
  3090. func (c *ProjectsRolesListCall) Header() http.Header {
  3091. if c.header_ == nil {
  3092. c.header_ = make(http.Header)
  3093. }
  3094. return c.header_
  3095. }
  3096. func (c *ProjectsRolesListCall) doRequest(alt string) (*http.Response, error) {
  3097. reqHeaders := make(http.Header)
  3098. for k, v := range c.header_ {
  3099. reqHeaders[k] = v
  3100. }
  3101. reqHeaders.Set("User-Agent", c.s.userAgent())
  3102. if c.ifNoneMatch_ != "" {
  3103. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3104. }
  3105. var body io.Reader = nil
  3106. c.urlParams_.Set("alt", alt)
  3107. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/roles")
  3108. urls += "?" + c.urlParams_.Encode()
  3109. req, _ := http.NewRequest("GET", urls, body)
  3110. req.Header = reqHeaders
  3111. googleapi.Expand(req.URL, map[string]string{
  3112. "parent": c.parent,
  3113. })
  3114. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3115. }
  3116. // Do executes the "iam.projects.roles.list" call.
  3117. // Exactly one of *ListRolesResponse or error will be non-nil. Any
  3118. // non-2xx status code is an error. Response headers are in either
  3119. // *ListRolesResponse.ServerResponse.Header or (if a response was
  3120. // returned at all) in error.(*googleapi.Error).Header. Use
  3121. // googleapi.IsNotModified to check whether the returned error was
  3122. // because http.StatusNotModified was returned.
  3123. func (c *ProjectsRolesListCall) Do(opts ...googleapi.CallOption) (*ListRolesResponse, error) {
  3124. gensupport.SetOptions(c.urlParams_, opts...)
  3125. res, err := c.doRequest("json")
  3126. if res != nil && res.StatusCode == http.StatusNotModified {
  3127. if res.Body != nil {
  3128. res.Body.Close()
  3129. }
  3130. return nil, &googleapi.Error{
  3131. Code: res.StatusCode,
  3132. Header: res.Header,
  3133. }
  3134. }
  3135. if err != nil {
  3136. return nil, err
  3137. }
  3138. defer googleapi.CloseBody(res)
  3139. if err := googleapi.CheckResponse(res); err != nil {
  3140. return nil, err
  3141. }
  3142. ret := &ListRolesResponse{
  3143. ServerResponse: googleapi.ServerResponse{
  3144. Header: res.Header,
  3145. HTTPStatusCode: res.StatusCode,
  3146. },
  3147. }
  3148. target := &ret
  3149. if err := gensupport.DecodeResponse(target, res); err != nil {
  3150. return nil, err
  3151. }
  3152. return ret, nil
  3153. // {
  3154. // "description": "Lists the Roles defined on a resource.",
  3155. // "flatPath": "v1/projects/{projectsId}/roles",
  3156. // "httpMethod": "GET",
  3157. // "id": "iam.projects.roles.list",
  3158. // "parameterOrder": [
  3159. // "parent"
  3160. // ],
  3161. // "parameters": {
  3162. // "pageSize": {
  3163. // "description": "Optional limit on the number of roles to include in the response.",
  3164. // "format": "int32",
  3165. // "location": "query",
  3166. // "type": "integer"
  3167. // },
  3168. // "pageToken": {
  3169. // "description": "Optional pagination token returned in an earlier ListRolesResponse.",
  3170. // "location": "query",
  3171. // "type": "string"
  3172. // },
  3173. // "parent": {
  3174. // "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}`",
  3175. // "location": "path",
  3176. // "pattern": "^projects/[^/]+$",
  3177. // "required": true,
  3178. // "type": "string"
  3179. // },
  3180. // "showDeleted": {
  3181. // "description": "Include Roles that have been deleted.",
  3182. // "location": "query",
  3183. // "type": "boolean"
  3184. // },
  3185. // "view": {
  3186. // "description": "Optional view for the returned Role objects.",
  3187. // "enum": [
  3188. // "BASIC",
  3189. // "FULL"
  3190. // ],
  3191. // "location": "query",
  3192. // "type": "string"
  3193. // }
  3194. // },
  3195. // "path": "v1/{+parent}/roles",
  3196. // "response": {
  3197. // "$ref": "ListRolesResponse"
  3198. // },
  3199. // "scopes": [
  3200. // "https://www.googleapis.com/auth/cloud-platform"
  3201. // ]
  3202. // }
  3203. }
  3204. // Pages invokes f for each page of results.
  3205. // A non-nil error returned from f will halt the iteration.
  3206. // The provided context supersedes any context provided to the Context method.
  3207. func (c *ProjectsRolesListCall) Pages(ctx context.Context, f func(*ListRolesResponse) error) error {
  3208. c.ctx_ = ctx
  3209. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3210. for {
  3211. x, err := c.Do()
  3212. if err != nil {
  3213. return err
  3214. }
  3215. if err := f(x); err != nil {
  3216. return err
  3217. }
  3218. if x.NextPageToken == "" {
  3219. return nil
  3220. }
  3221. c.PageToken(x.NextPageToken)
  3222. }
  3223. }
  3224. // method id "iam.projects.roles.patch":
  3225. type ProjectsRolesPatchCall struct {
  3226. s *Service
  3227. name string
  3228. role *Role
  3229. urlParams_ gensupport.URLParams
  3230. ctx_ context.Context
  3231. header_ http.Header
  3232. }
  3233. // Patch: Updates a Role definition.
  3234. func (r *ProjectsRolesService) Patch(name string, role *Role) *ProjectsRolesPatchCall {
  3235. c := &ProjectsRolesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3236. c.name = name
  3237. c.role = role
  3238. return c
  3239. }
  3240. // UpdateMask sets the optional parameter "updateMask": A mask
  3241. // describing which fields in the Role have changed.
  3242. func (c *ProjectsRolesPatchCall) UpdateMask(updateMask string) *ProjectsRolesPatchCall {
  3243. c.urlParams_.Set("updateMask", updateMask)
  3244. return c
  3245. }
  3246. // Fields allows partial responses to be retrieved. See
  3247. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3248. // for more information.
  3249. func (c *ProjectsRolesPatchCall) Fields(s ...googleapi.Field) *ProjectsRolesPatchCall {
  3250. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3251. return c
  3252. }
  3253. // Context sets the context to be used in this call's Do method. Any
  3254. // pending HTTP request will be aborted if the provided context is
  3255. // canceled.
  3256. func (c *ProjectsRolesPatchCall) Context(ctx context.Context) *ProjectsRolesPatchCall {
  3257. c.ctx_ = ctx
  3258. return c
  3259. }
  3260. // Header returns an http.Header that can be modified by the caller to
  3261. // add HTTP headers to the request.
  3262. func (c *ProjectsRolesPatchCall) Header() http.Header {
  3263. if c.header_ == nil {
  3264. c.header_ = make(http.Header)
  3265. }
  3266. return c.header_
  3267. }
  3268. func (c *ProjectsRolesPatchCall) doRequest(alt string) (*http.Response, error) {
  3269. reqHeaders := make(http.Header)
  3270. for k, v := range c.header_ {
  3271. reqHeaders[k] = v
  3272. }
  3273. reqHeaders.Set("User-Agent", c.s.userAgent())
  3274. var body io.Reader = nil
  3275. body, err := googleapi.WithoutDataWrapper.JSONReader(c.role)
  3276. if err != nil {
  3277. return nil, err
  3278. }
  3279. reqHeaders.Set("Content-Type", "application/json")
  3280. c.urlParams_.Set("alt", alt)
  3281. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3282. urls += "?" + c.urlParams_.Encode()
  3283. req, _ := http.NewRequest("PATCH", urls, body)
  3284. req.Header = reqHeaders
  3285. googleapi.Expand(req.URL, map[string]string{
  3286. "name": c.name,
  3287. })
  3288. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3289. }
  3290. // Do executes the "iam.projects.roles.patch" 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 *ProjectsRolesPatchCall) 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": "Updates a Role definition.",
  3329. // "flatPath": "v1/projects/{projectsId}/roles/{rolesId}",
  3330. // "httpMethod": "PATCH",
  3331. // "id": "iam.projects.roles.patch",
  3332. // "parameterOrder": [
  3333. // "name"
  3334. // ],
  3335. // "parameters": {
  3336. // "name": {
  3337. // "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}`",
  3338. // "location": "path",
  3339. // "pattern": "^projects/[^/]+/roles/[^/]+$",
  3340. // "required": true,
  3341. // "type": "string"
  3342. // },
  3343. // "updateMask": {
  3344. // "description": "A mask describing which fields in the Role have changed.",
  3345. // "format": "google-fieldmask",
  3346. // "location": "query",
  3347. // "type": "string"
  3348. // }
  3349. // },
  3350. // "path": "v1/{+name}",
  3351. // "request": {
  3352. // "$ref": "Role"
  3353. // },
  3354. // "response": {
  3355. // "$ref": "Role"
  3356. // },
  3357. // "scopes": [
  3358. // "https://www.googleapis.com/auth/cloud-platform"
  3359. // ]
  3360. // }
  3361. }
  3362. // method id "iam.projects.roles.undelete":
  3363. type ProjectsRolesUndeleteCall struct {
  3364. s *Service
  3365. name string
  3366. undeleterolerequest *UndeleteRoleRequest
  3367. urlParams_ gensupport.URLParams
  3368. ctx_ context.Context
  3369. header_ http.Header
  3370. }
  3371. // Undelete: Undelete a Role, bringing it back in its previous state.
  3372. func (r *ProjectsRolesService) Undelete(name string, undeleterolerequest *UndeleteRoleRequest) *ProjectsRolesUndeleteCall {
  3373. c := &ProjectsRolesUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3374. c.name = name
  3375. c.undeleterolerequest = undeleterolerequest
  3376. return c
  3377. }
  3378. // Fields allows partial responses to be retrieved. See
  3379. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3380. // for more information.
  3381. func (c *ProjectsRolesUndeleteCall) Fields(s ...googleapi.Field) *ProjectsRolesUndeleteCall {
  3382. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3383. return c
  3384. }
  3385. // Context sets the context to be used in this call's Do method. Any
  3386. // pending HTTP request will be aborted if the provided context is
  3387. // canceled.
  3388. func (c *ProjectsRolesUndeleteCall) Context(ctx context.Context) *ProjectsRolesUndeleteCall {
  3389. c.ctx_ = ctx
  3390. return c
  3391. }
  3392. // Header returns an http.Header that can be modified by the caller to
  3393. // add HTTP headers to the request.
  3394. func (c *ProjectsRolesUndeleteCall) Header() http.Header {
  3395. if c.header_ == nil {
  3396. c.header_ = make(http.Header)
  3397. }
  3398. return c.header_
  3399. }
  3400. func (c *ProjectsRolesUndeleteCall) doRequest(alt string) (*http.Response, error) {
  3401. reqHeaders := make(http.Header)
  3402. for k, v := range c.header_ {
  3403. reqHeaders[k] = v
  3404. }
  3405. reqHeaders.Set("User-Agent", c.s.userAgent())
  3406. var body io.Reader = nil
  3407. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeleterolerequest)
  3408. if err != nil {
  3409. return nil, err
  3410. }
  3411. reqHeaders.Set("Content-Type", "application/json")
  3412. c.urlParams_.Set("alt", alt)
  3413. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:undelete")
  3414. urls += "?" + c.urlParams_.Encode()
  3415. req, _ := http.NewRequest("POST", urls, body)
  3416. req.Header = reqHeaders
  3417. googleapi.Expand(req.URL, map[string]string{
  3418. "name": c.name,
  3419. })
  3420. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3421. }
  3422. // Do executes the "iam.projects.roles.undelete" call.
  3423. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  3424. // code is an error. Response headers are in either
  3425. // *Role.ServerResponse.Header or (if a response was returned at all) in
  3426. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3427. // whether the returned error was because http.StatusNotModified was
  3428. // returned.
  3429. func (c *ProjectsRolesUndeleteCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  3430. gensupport.SetOptions(c.urlParams_, opts...)
  3431. res, err := c.doRequest("json")
  3432. if res != nil && res.StatusCode == http.StatusNotModified {
  3433. if res.Body != nil {
  3434. res.Body.Close()
  3435. }
  3436. return nil, &googleapi.Error{
  3437. Code: res.StatusCode,
  3438. Header: res.Header,
  3439. }
  3440. }
  3441. if err != nil {
  3442. return nil, err
  3443. }
  3444. defer googleapi.CloseBody(res)
  3445. if err := googleapi.CheckResponse(res); err != nil {
  3446. return nil, err
  3447. }
  3448. ret := &Role{
  3449. ServerResponse: googleapi.ServerResponse{
  3450. Header: res.Header,
  3451. HTTPStatusCode: res.StatusCode,
  3452. },
  3453. }
  3454. target := &ret
  3455. if err := gensupport.DecodeResponse(target, res); err != nil {
  3456. return nil, err
  3457. }
  3458. return ret, nil
  3459. // {
  3460. // "description": "Undelete a Role, bringing it back in its previous state.",
  3461. // "flatPath": "v1/projects/{projectsId}/roles/{rolesId}:undelete",
  3462. // "httpMethod": "POST",
  3463. // "id": "iam.projects.roles.undelete",
  3464. // "parameterOrder": [
  3465. // "name"
  3466. // ],
  3467. // "parameters": {
  3468. // "name": {
  3469. // "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}`",
  3470. // "location": "path",
  3471. // "pattern": "^projects/[^/]+/roles/[^/]+$",
  3472. // "required": true,
  3473. // "type": "string"
  3474. // }
  3475. // },
  3476. // "path": "v1/{+name}:undelete",
  3477. // "request": {
  3478. // "$ref": "UndeleteRoleRequest"
  3479. // },
  3480. // "response": {
  3481. // "$ref": "Role"
  3482. // },
  3483. // "scopes": [
  3484. // "https://www.googleapis.com/auth/cloud-platform"
  3485. // ]
  3486. // }
  3487. }
  3488. // method id "iam.projects.serviceAccounts.create":
  3489. type ProjectsServiceAccountsCreateCall struct {
  3490. s *Service
  3491. name string
  3492. createserviceaccountrequest *CreateServiceAccountRequest
  3493. urlParams_ gensupport.URLParams
  3494. ctx_ context.Context
  3495. header_ http.Header
  3496. }
  3497. // Create: Creates a ServiceAccount
  3498. // and returns it.
  3499. func (r *ProjectsServiceAccountsService) Create(name string, createserviceaccountrequest *CreateServiceAccountRequest) *ProjectsServiceAccountsCreateCall {
  3500. c := &ProjectsServiceAccountsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3501. c.name = name
  3502. c.createserviceaccountrequest = createserviceaccountrequest
  3503. return c
  3504. }
  3505. // Fields allows partial responses to be retrieved. See
  3506. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3507. // for more information.
  3508. func (c *ProjectsServiceAccountsCreateCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsCreateCall {
  3509. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3510. return c
  3511. }
  3512. // Context sets the context to be used in this call's Do method. Any
  3513. // pending HTTP request will be aborted if the provided context is
  3514. // canceled.
  3515. func (c *ProjectsServiceAccountsCreateCall) Context(ctx context.Context) *ProjectsServiceAccountsCreateCall {
  3516. c.ctx_ = ctx
  3517. return c
  3518. }
  3519. // Header returns an http.Header that can be modified by the caller to
  3520. // add HTTP headers to the request.
  3521. func (c *ProjectsServiceAccountsCreateCall) Header() http.Header {
  3522. if c.header_ == nil {
  3523. c.header_ = make(http.Header)
  3524. }
  3525. return c.header_
  3526. }
  3527. func (c *ProjectsServiceAccountsCreateCall) doRequest(alt string) (*http.Response, error) {
  3528. reqHeaders := make(http.Header)
  3529. for k, v := range c.header_ {
  3530. reqHeaders[k] = v
  3531. }
  3532. reqHeaders.Set("User-Agent", c.s.userAgent())
  3533. var body io.Reader = nil
  3534. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createserviceaccountrequest)
  3535. if err != nil {
  3536. return nil, err
  3537. }
  3538. reqHeaders.Set("Content-Type", "application/json")
  3539. c.urlParams_.Set("alt", alt)
  3540. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/serviceAccounts")
  3541. urls += "?" + c.urlParams_.Encode()
  3542. req, _ := http.NewRequest("POST", urls, body)
  3543. req.Header = reqHeaders
  3544. googleapi.Expand(req.URL, map[string]string{
  3545. "name": c.name,
  3546. })
  3547. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3548. }
  3549. // Do executes the "iam.projects.serviceAccounts.create" call.
  3550. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  3551. // status code is an error. Response headers are in either
  3552. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  3553. // at all) in error.(*googleapi.Error).Header. Use
  3554. // googleapi.IsNotModified to check whether the returned error was
  3555. // because http.StatusNotModified was returned.
  3556. func (c *ProjectsServiceAccountsCreateCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  3557. gensupport.SetOptions(c.urlParams_, opts...)
  3558. res, err := c.doRequest("json")
  3559. if res != nil && res.StatusCode == http.StatusNotModified {
  3560. if res.Body != nil {
  3561. res.Body.Close()
  3562. }
  3563. return nil, &googleapi.Error{
  3564. Code: res.StatusCode,
  3565. Header: res.Header,
  3566. }
  3567. }
  3568. if err != nil {
  3569. return nil, err
  3570. }
  3571. defer googleapi.CloseBody(res)
  3572. if err := googleapi.CheckResponse(res); err != nil {
  3573. return nil, err
  3574. }
  3575. ret := &ServiceAccount{
  3576. ServerResponse: googleapi.ServerResponse{
  3577. Header: res.Header,
  3578. HTTPStatusCode: res.StatusCode,
  3579. },
  3580. }
  3581. target := &ret
  3582. if err := gensupport.DecodeResponse(target, res); err != nil {
  3583. return nil, err
  3584. }
  3585. return ret, nil
  3586. // {
  3587. // "description": "Creates a ServiceAccount\nand returns it.",
  3588. // "flatPath": "v1/projects/{projectsId}/serviceAccounts",
  3589. // "httpMethod": "POST",
  3590. // "id": "iam.projects.serviceAccounts.create",
  3591. // "parameterOrder": [
  3592. // "name"
  3593. // ],
  3594. // "parameters": {
  3595. // "name": {
  3596. // "description": "Required. The resource name of the project associated with the service\naccounts, such as `projects/my-project-123`.",
  3597. // "location": "path",
  3598. // "pattern": "^projects/[^/]+$",
  3599. // "required": true,
  3600. // "type": "string"
  3601. // }
  3602. // },
  3603. // "path": "v1/{+name}/serviceAccounts",
  3604. // "request": {
  3605. // "$ref": "CreateServiceAccountRequest"
  3606. // },
  3607. // "response": {
  3608. // "$ref": "ServiceAccount"
  3609. // },
  3610. // "scopes": [
  3611. // "https://www.googleapis.com/auth/cloud-platform"
  3612. // ]
  3613. // }
  3614. }
  3615. // method id "iam.projects.serviceAccounts.delete":
  3616. type ProjectsServiceAccountsDeleteCall struct {
  3617. s *Service
  3618. name string
  3619. urlParams_ gensupport.URLParams
  3620. ctx_ context.Context
  3621. header_ http.Header
  3622. }
  3623. // Delete: Deletes a ServiceAccount.
  3624. func (r *ProjectsServiceAccountsService) Delete(name string) *ProjectsServiceAccountsDeleteCall {
  3625. c := &ProjectsServiceAccountsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3626. c.name = name
  3627. return c
  3628. }
  3629. // Fields allows partial responses to be retrieved. See
  3630. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3631. // for more information.
  3632. func (c *ProjectsServiceAccountsDeleteCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsDeleteCall {
  3633. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3634. return c
  3635. }
  3636. // Context sets the context to be used in this call's Do method. Any
  3637. // pending HTTP request will be aborted if the provided context is
  3638. // canceled.
  3639. func (c *ProjectsServiceAccountsDeleteCall) Context(ctx context.Context) *ProjectsServiceAccountsDeleteCall {
  3640. c.ctx_ = ctx
  3641. return c
  3642. }
  3643. // Header returns an http.Header that can be modified by the caller to
  3644. // add HTTP headers to the request.
  3645. func (c *ProjectsServiceAccountsDeleteCall) Header() http.Header {
  3646. if c.header_ == nil {
  3647. c.header_ = make(http.Header)
  3648. }
  3649. return c.header_
  3650. }
  3651. func (c *ProjectsServiceAccountsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3652. reqHeaders := make(http.Header)
  3653. for k, v := range c.header_ {
  3654. reqHeaders[k] = v
  3655. }
  3656. reqHeaders.Set("User-Agent", c.s.userAgent())
  3657. var body io.Reader = nil
  3658. c.urlParams_.Set("alt", alt)
  3659. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3660. urls += "?" + c.urlParams_.Encode()
  3661. req, _ := http.NewRequest("DELETE", urls, body)
  3662. req.Header = reqHeaders
  3663. googleapi.Expand(req.URL, map[string]string{
  3664. "name": c.name,
  3665. })
  3666. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3667. }
  3668. // Do executes the "iam.projects.serviceAccounts.delete" call.
  3669. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3670. // code is an error. Response headers are in either
  3671. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3672. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3673. // check whether the returned error was because http.StatusNotModified
  3674. // was returned.
  3675. func (c *ProjectsServiceAccountsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3676. gensupport.SetOptions(c.urlParams_, opts...)
  3677. res, err := c.doRequest("json")
  3678. if res != nil && res.StatusCode == http.StatusNotModified {
  3679. if res.Body != nil {
  3680. res.Body.Close()
  3681. }
  3682. return nil, &googleapi.Error{
  3683. Code: res.StatusCode,
  3684. Header: res.Header,
  3685. }
  3686. }
  3687. if err != nil {
  3688. return nil, err
  3689. }
  3690. defer googleapi.CloseBody(res)
  3691. if err := googleapi.CheckResponse(res); err != nil {
  3692. return nil, err
  3693. }
  3694. ret := &Empty{
  3695. ServerResponse: googleapi.ServerResponse{
  3696. Header: res.Header,
  3697. HTTPStatusCode: res.StatusCode,
  3698. },
  3699. }
  3700. target := &ret
  3701. if err := gensupport.DecodeResponse(target, res); err != nil {
  3702. return nil, err
  3703. }
  3704. return ret, nil
  3705. // {
  3706. // "description": "Deletes a ServiceAccount.",
  3707. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}",
  3708. // "httpMethod": "DELETE",
  3709. // "id": "iam.projects.serviceAccounts.delete",
  3710. // "parameterOrder": [
  3711. // "name"
  3712. // ],
  3713. // "parameters": {
  3714. // "name": {
  3715. // "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.",
  3716. // "location": "path",
  3717. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  3718. // "required": true,
  3719. // "type": "string"
  3720. // }
  3721. // },
  3722. // "path": "v1/{+name}",
  3723. // "response": {
  3724. // "$ref": "Empty"
  3725. // },
  3726. // "scopes": [
  3727. // "https://www.googleapis.com/auth/cloud-platform"
  3728. // ]
  3729. // }
  3730. }
  3731. // method id "iam.projects.serviceAccounts.get":
  3732. type ProjectsServiceAccountsGetCall struct {
  3733. s *Service
  3734. name string
  3735. urlParams_ gensupport.URLParams
  3736. ifNoneMatch_ string
  3737. ctx_ context.Context
  3738. header_ http.Header
  3739. }
  3740. // Get: Gets a ServiceAccount.
  3741. func (r *ProjectsServiceAccountsService) Get(name string) *ProjectsServiceAccountsGetCall {
  3742. c := &ProjectsServiceAccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3743. c.name = name
  3744. return c
  3745. }
  3746. // Fields allows partial responses to be retrieved. See
  3747. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3748. // for more information.
  3749. func (c *ProjectsServiceAccountsGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsGetCall {
  3750. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3751. return c
  3752. }
  3753. // IfNoneMatch sets the optional parameter which makes the operation
  3754. // fail if the object's ETag matches the given value. This is useful for
  3755. // getting updates only after the object has changed since the last
  3756. // request. Use googleapi.IsNotModified to check whether the response
  3757. // error from Do is the result of In-None-Match.
  3758. func (c *ProjectsServiceAccountsGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsGetCall {
  3759. c.ifNoneMatch_ = entityTag
  3760. return c
  3761. }
  3762. // Context sets the context to be used in this call's Do method. Any
  3763. // pending HTTP request will be aborted if the provided context is
  3764. // canceled.
  3765. func (c *ProjectsServiceAccountsGetCall) Context(ctx context.Context) *ProjectsServiceAccountsGetCall {
  3766. c.ctx_ = ctx
  3767. return c
  3768. }
  3769. // Header returns an http.Header that can be modified by the caller to
  3770. // add HTTP headers to the request.
  3771. func (c *ProjectsServiceAccountsGetCall) Header() http.Header {
  3772. if c.header_ == nil {
  3773. c.header_ = make(http.Header)
  3774. }
  3775. return c.header_
  3776. }
  3777. func (c *ProjectsServiceAccountsGetCall) doRequest(alt string) (*http.Response, error) {
  3778. reqHeaders := make(http.Header)
  3779. for k, v := range c.header_ {
  3780. reqHeaders[k] = v
  3781. }
  3782. reqHeaders.Set("User-Agent", c.s.userAgent())
  3783. if c.ifNoneMatch_ != "" {
  3784. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3785. }
  3786. var body io.Reader = nil
  3787. c.urlParams_.Set("alt", alt)
  3788. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3789. urls += "?" + c.urlParams_.Encode()
  3790. req, _ := http.NewRequest("GET", urls, body)
  3791. req.Header = reqHeaders
  3792. googleapi.Expand(req.URL, map[string]string{
  3793. "name": c.name,
  3794. })
  3795. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3796. }
  3797. // Do executes the "iam.projects.serviceAccounts.get" call.
  3798. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  3799. // status code is an error. Response headers are in either
  3800. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  3801. // at all) in error.(*googleapi.Error).Header. Use
  3802. // googleapi.IsNotModified to check whether the returned error was
  3803. // because http.StatusNotModified was returned.
  3804. func (c *ProjectsServiceAccountsGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  3805. gensupport.SetOptions(c.urlParams_, opts...)
  3806. res, err := c.doRequest("json")
  3807. if res != nil && res.StatusCode == http.StatusNotModified {
  3808. if res.Body != nil {
  3809. res.Body.Close()
  3810. }
  3811. return nil, &googleapi.Error{
  3812. Code: res.StatusCode,
  3813. Header: res.Header,
  3814. }
  3815. }
  3816. if err != nil {
  3817. return nil, err
  3818. }
  3819. defer googleapi.CloseBody(res)
  3820. if err := googleapi.CheckResponse(res); err != nil {
  3821. return nil, err
  3822. }
  3823. ret := &ServiceAccount{
  3824. ServerResponse: googleapi.ServerResponse{
  3825. Header: res.Header,
  3826. HTTPStatusCode: res.StatusCode,
  3827. },
  3828. }
  3829. target := &ret
  3830. if err := gensupport.DecodeResponse(target, res); err != nil {
  3831. return nil, err
  3832. }
  3833. return ret, nil
  3834. // {
  3835. // "description": "Gets a ServiceAccount.",
  3836. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}",
  3837. // "httpMethod": "GET",
  3838. // "id": "iam.projects.serviceAccounts.get",
  3839. // "parameterOrder": [
  3840. // "name"
  3841. // ],
  3842. // "parameters": {
  3843. // "name": {
  3844. // "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.",
  3845. // "location": "path",
  3846. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  3847. // "required": true,
  3848. // "type": "string"
  3849. // }
  3850. // },
  3851. // "path": "v1/{+name}",
  3852. // "response": {
  3853. // "$ref": "ServiceAccount"
  3854. // },
  3855. // "scopes": [
  3856. // "https://www.googleapis.com/auth/cloud-platform"
  3857. // ]
  3858. // }
  3859. }
  3860. // method id "iam.projects.serviceAccounts.getIamPolicy":
  3861. type ProjectsServiceAccountsGetIamPolicyCall struct {
  3862. s *Service
  3863. resource string
  3864. urlParams_ gensupport.URLParams
  3865. ctx_ context.Context
  3866. header_ http.Header
  3867. }
  3868. // GetIamPolicy: Returns the IAM access control policy for
  3869. // a
  3870. // ServiceAccount.
  3871. func (r *ProjectsServiceAccountsService) GetIamPolicy(resource string) *ProjectsServiceAccountsGetIamPolicyCall {
  3872. c := &ProjectsServiceAccountsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3873. c.resource = resource
  3874. return c
  3875. }
  3876. // Fields allows partial responses to be retrieved. See
  3877. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3878. // for more information.
  3879. func (c *ProjectsServiceAccountsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsGetIamPolicyCall {
  3880. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3881. return c
  3882. }
  3883. // Context sets the context to be used in this call's Do method. Any
  3884. // pending HTTP request will be aborted if the provided context is
  3885. // canceled.
  3886. func (c *ProjectsServiceAccountsGetIamPolicyCall) Context(ctx context.Context) *ProjectsServiceAccountsGetIamPolicyCall {
  3887. c.ctx_ = ctx
  3888. return c
  3889. }
  3890. // Header returns an http.Header that can be modified by the caller to
  3891. // add HTTP headers to the request.
  3892. func (c *ProjectsServiceAccountsGetIamPolicyCall) Header() http.Header {
  3893. if c.header_ == nil {
  3894. c.header_ = make(http.Header)
  3895. }
  3896. return c.header_
  3897. }
  3898. func (c *ProjectsServiceAccountsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3899. reqHeaders := make(http.Header)
  3900. for k, v := range c.header_ {
  3901. reqHeaders[k] = v
  3902. }
  3903. reqHeaders.Set("User-Agent", c.s.userAgent())
  3904. var body io.Reader = nil
  3905. c.urlParams_.Set("alt", alt)
  3906. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  3907. urls += "?" + c.urlParams_.Encode()
  3908. req, _ := http.NewRequest("POST", urls, body)
  3909. req.Header = reqHeaders
  3910. googleapi.Expand(req.URL, map[string]string{
  3911. "resource": c.resource,
  3912. })
  3913. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3914. }
  3915. // Do executes the "iam.projects.serviceAccounts.getIamPolicy" call.
  3916. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3917. // code is an error. Response headers are in either
  3918. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3919. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3920. // check whether the returned error was because http.StatusNotModified
  3921. // was returned.
  3922. func (c *ProjectsServiceAccountsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3923. gensupport.SetOptions(c.urlParams_, opts...)
  3924. res, err := c.doRequest("json")
  3925. if res != nil && res.StatusCode == http.StatusNotModified {
  3926. if res.Body != nil {
  3927. res.Body.Close()
  3928. }
  3929. return nil, &googleapi.Error{
  3930. Code: res.StatusCode,
  3931. Header: res.Header,
  3932. }
  3933. }
  3934. if err != nil {
  3935. return nil, err
  3936. }
  3937. defer googleapi.CloseBody(res)
  3938. if err := googleapi.CheckResponse(res); err != nil {
  3939. return nil, err
  3940. }
  3941. ret := &Policy{
  3942. ServerResponse: googleapi.ServerResponse{
  3943. Header: res.Header,
  3944. HTTPStatusCode: res.StatusCode,
  3945. },
  3946. }
  3947. target := &ret
  3948. if err := gensupport.DecodeResponse(target, res); err != nil {
  3949. return nil, err
  3950. }
  3951. return ret, nil
  3952. // {
  3953. // "description": "Returns the IAM access control policy for a\nServiceAccount.",
  3954. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:getIamPolicy",
  3955. // "httpMethod": "POST",
  3956. // "id": "iam.projects.serviceAccounts.getIamPolicy",
  3957. // "parameterOrder": [
  3958. // "resource"
  3959. // ],
  3960. // "parameters": {
  3961. // "resource": {
  3962. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  3963. // "location": "path",
  3964. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  3965. // "required": true,
  3966. // "type": "string"
  3967. // }
  3968. // },
  3969. // "path": "v1/{+resource}:getIamPolicy",
  3970. // "response": {
  3971. // "$ref": "Policy"
  3972. // },
  3973. // "scopes": [
  3974. // "https://www.googleapis.com/auth/cloud-platform"
  3975. // ]
  3976. // }
  3977. }
  3978. // method id "iam.projects.serviceAccounts.list":
  3979. type ProjectsServiceAccountsListCall struct {
  3980. s *Service
  3981. name string
  3982. urlParams_ gensupport.URLParams
  3983. ifNoneMatch_ string
  3984. ctx_ context.Context
  3985. header_ http.Header
  3986. }
  3987. // List: Lists ServiceAccounts for a project.
  3988. func (r *ProjectsServiceAccountsService) List(name string) *ProjectsServiceAccountsListCall {
  3989. c := &ProjectsServiceAccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3990. c.name = name
  3991. return c
  3992. }
  3993. // PageSize sets the optional parameter "pageSize": Optional limit on
  3994. // the number of service accounts to include in the
  3995. // response. Further accounts can subsequently be obtained by including
  3996. // the
  3997. // ListServiceAccountsResponse.next_page_token
  3998. // in a subsequent request.
  3999. func (c *ProjectsServiceAccountsListCall) PageSize(pageSize int64) *ProjectsServiceAccountsListCall {
  4000. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4001. return c
  4002. }
  4003. // PageToken sets the optional parameter "pageToken": Optional
  4004. // pagination token returned in an
  4005. // earlier
  4006. // ListServiceAccountsResponse.next_page_token.
  4007. func (c *ProjectsServiceAccountsListCall) PageToken(pageToken string) *ProjectsServiceAccountsListCall {
  4008. c.urlParams_.Set("pageToken", pageToken)
  4009. return c
  4010. }
  4011. // Fields allows partial responses to be retrieved. See
  4012. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4013. // for more information.
  4014. func (c *ProjectsServiceAccountsListCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsListCall {
  4015. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4016. return c
  4017. }
  4018. // IfNoneMatch sets the optional parameter which makes the operation
  4019. // fail if the object's ETag matches the given value. This is useful for
  4020. // getting updates only after the object has changed since the last
  4021. // request. Use googleapi.IsNotModified to check whether the response
  4022. // error from Do is the result of In-None-Match.
  4023. func (c *ProjectsServiceAccountsListCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsListCall {
  4024. c.ifNoneMatch_ = entityTag
  4025. return c
  4026. }
  4027. // Context sets the context to be used in this call's Do method. Any
  4028. // pending HTTP request will be aborted if the provided context is
  4029. // canceled.
  4030. func (c *ProjectsServiceAccountsListCall) Context(ctx context.Context) *ProjectsServiceAccountsListCall {
  4031. c.ctx_ = ctx
  4032. return c
  4033. }
  4034. // Header returns an http.Header that can be modified by the caller to
  4035. // add HTTP headers to the request.
  4036. func (c *ProjectsServiceAccountsListCall) Header() http.Header {
  4037. if c.header_ == nil {
  4038. c.header_ = make(http.Header)
  4039. }
  4040. return c.header_
  4041. }
  4042. func (c *ProjectsServiceAccountsListCall) doRequest(alt string) (*http.Response, error) {
  4043. reqHeaders := make(http.Header)
  4044. for k, v := range c.header_ {
  4045. reqHeaders[k] = v
  4046. }
  4047. reqHeaders.Set("User-Agent", c.s.userAgent())
  4048. if c.ifNoneMatch_ != "" {
  4049. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4050. }
  4051. var body io.Reader = nil
  4052. c.urlParams_.Set("alt", alt)
  4053. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/serviceAccounts")
  4054. urls += "?" + c.urlParams_.Encode()
  4055. req, _ := http.NewRequest("GET", urls, body)
  4056. req.Header = reqHeaders
  4057. googleapi.Expand(req.URL, map[string]string{
  4058. "name": c.name,
  4059. })
  4060. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4061. }
  4062. // Do executes the "iam.projects.serviceAccounts.list" call.
  4063. // Exactly one of *ListServiceAccountsResponse or error will be non-nil.
  4064. // Any non-2xx status code is an error. Response headers are in either
  4065. // *ListServiceAccountsResponse.ServerResponse.Header or (if a response
  4066. // was returned at all) in error.(*googleapi.Error).Header. Use
  4067. // googleapi.IsNotModified to check whether the returned error was
  4068. // because http.StatusNotModified was returned.
  4069. func (c *ProjectsServiceAccountsListCall) Do(opts ...googleapi.CallOption) (*ListServiceAccountsResponse, error) {
  4070. gensupport.SetOptions(c.urlParams_, opts...)
  4071. res, err := c.doRequest("json")
  4072. if res != nil && res.StatusCode == http.StatusNotModified {
  4073. if res.Body != nil {
  4074. res.Body.Close()
  4075. }
  4076. return nil, &googleapi.Error{
  4077. Code: res.StatusCode,
  4078. Header: res.Header,
  4079. }
  4080. }
  4081. if err != nil {
  4082. return nil, err
  4083. }
  4084. defer googleapi.CloseBody(res)
  4085. if err := googleapi.CheckResponse(res); err != nil {
  4086. return nil, err
  4087. }
  4088. ret := &ListServiceAccountsResponse{
  4089. ServerResponse: googleapi.ServerResponse{
  4090. Header: res.Header,
  4091. HTTPStatusCode: res.StatusCode,
  4092. },
  4093. }
  4094. target := &ret
  4095. if err := gensupport.DecodeResponse(target, res); err != nil {
  4096. return nil, err
  4097. }
  4098. return ret, nil
  4099. // {
  4100. // "description": "Lists ServiceAccounts for a project.",
  4101. // "flatPath": "v1/projects/{projectsId}/serviceAccounts",
  4102. // "httpMethod": "GET",
  4103. // "id": "iam.projects.serviceAccounts.list",
  4104. // "parameterOrder": [
  4105. // "name"
  4106. // ],
  4107. // "parameters": {
  4108. // "name": {
  4109. // "description": "Required. The resource name of the project associated with the service\naccounts, such as `projects/my-project-123`.",
  4110. // "location": "path",
  4111. // "pattern": "^projects/[^/]+$",
  4112. // "required": true,
  4113. // "type": "string"
  4114. // },
  4115. // "pageSize": {
  4116. // "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.",
  4117. // "format": "int32",
  4118. // "location": "query",
  4119. // "type": "integer"
  4120. // },
  4121. // "pageToken": {
  4122. // "description": "Optional pagination token returned in an earlier\nListServiceAccountsResponse.next_page_token.",
  4123. // "location": "query",
  4124. // "type": "string"
  4125. // }
  4126. // },
  4127. // "path": "v1/{+name}/serviceAccounts",
  4128. // "response": {
  4129. // "$ref": "ListServiceAccountsResponse"
  4130. // },
  4131. // "scopes": [
  4132. // "https://www.googleapis.com/auth/cloud-platform"
  4133. // ]
  4134. // }
  4135. }
  4136. // Pages invokes f for each page of results.
  4137. // A non-nil error returned from f will halt the iteration.
  4138. // The provided context supersedes any context provided to the Context method.
  4139. func (c *ProjectsServiceAccountsListCall) Pages(ctx context.Context, f func(*ListServiceAccountsResponse) error) error {
  4140. c.ctx_ = ctx
  4141. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4142. for {
  4143. x, err := c.Do()
  4144. if err != nil {
  4145. return err
  4146. }
  4147. if err := f(x); err != nil {
  4148. return err
  4149. }
  4150. if x.NextPageToken == "" {
  4151. return nil
  4152. }
  4153. c.PageToken(x.NextPageToken)
  4154. }
  4155. }
  4156. // method id "iam.projects.serviceAccounts.setIamPolicy":
  4157. type ProjectsServiceAccountsSetIamPolicyCall struct {
  4158. s *Service
  4159. resource string
  4160. setiampolicyrequest *SetIamPolicyRequest
  4161. urlParams_ gensupport.URLParams
  4162. ctx_ context.Context
  4163. header_ http.Header
  4164. }
  4165. // SetIamPolicy: Sets the IAM access control policy for
  4166. // a
  4167. // ServiceAccount.
  4168. func (r *ProjectsServiceAccountsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsServiceAccountsSetIamPolicyCall {
  4169. c := &ProjectsServiceAccountsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4170. c.resource = resource
  4171. c.setiampolicyrequest = setiampolicyrequest
  4172. return c
  4173. }
  4174. // Fields allows partial responses to be retrieved. See
  4175. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4176. // for more information.
  4177. func (c *ProjectsServiceAccountsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSetIamPolicyCall {
  4178. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4179. return c
  4180. }
  4181. // Context sets the context to be used in this call's Do method. Any
  4182. // pending HTTP request will be aborted if the provided context is
  4183. // canceled.
  4184. func (c *ProjectsServiceAccountsSetIamPolicyCall) Context(ctx context.Context) *ProjectsServiceAccountsSetIamPolicyCall {
  4185. c.ctx_ = ctx
  4186. return c
  4187. }
  4188. // Header returns an http.Header that can be modified by the caller to
  4189. // add HTTP headers to the request.
  4190. func (c *ProjectsServiceAccountsSetIamPolicyCall) Header() http.Header {
  4191. if c.header_ == nil {
  4192. c.header_ = make(http.Header)
  4193. }
  4194. return c.header_
  4195. }
  4196. func (c *ProjectsServiceAccountsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4197. reqHeaders := make(http.Header)
  4198. for k, v := range c.header_ {
  4199. reqHeaders[k] = v
  4200. }
  4201. reqHeaders.Set("User-Agent", c.s.userAgent())
  4202. var body io.Reader = nil
  4203. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  4204. if err != nil {
  4205. return nil, err
  4206. }
  4207. reqHeaders.Set("Content-Type", "application/json")
  4208. c.urlParams_.Set("alt", alt)
  4209. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  4210. urls += "?" + c.urlParams_.Encode()
  4211. req, _ := http.NewRequest("POST", urls, body)
  4212. req.Header = reqHeaders
  4213. googleapi.Expand(req.URL, map[string]string{
  4214. "resource": c.resource,
  4215. })
  4216. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4217. }
  4218. // Do executes the "iam.projects.serviceAccounts.setIamPolicy" call.
  4219. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4220. // code is an error. Response headers are in either
  4221. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4222. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4223. // check whether the returned error was because http.StatusNotModified
  4224. // was returned.
  4225. func (c *ProjectsServiceAccountsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4226. gensupport.SetOptions(c.urlParams_, opts...)
  4227. res, err := c.doRequest("json")
  4228. if res != nil && res.StatusCode == http.StatusNotModified {
  4229. if res.Body != nil {
  4230. res.Body.Close()
  4231. }
  4232. return nil, &googleapi.Error{
  4233. Code: res.StatusCode,
  4234. Header: res.Header,
  4235. }
  4236. }
  4237. if err != nil {
  4238. return nil, err
  4239. }
  4240. defer googleapi.CloseBody(res)
  4241. if err := googleapi.CheckResponse(res); err != nil {
  4242. return nil, err
  4243. }
  4244. ret := &Policy{
  4245. ServerResponse: googleapi.ServerResponse{
  4246. Header: res.Header,
  4247. HTTPStatusCode: res.StatusCode,
  4248. },
  4249. }
  4250. target := &ret
  4251. if err := gensupport.DecodeResponse(target, res); err != nil {
  4252. return nil, err
  4253. }
  4254. return ret, nil
  4255. // {
  4256. // "description": "Sets the IAM access control policy for a\nServiceAccount.",
  4257. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:setIamPolicy",
  4258. // "httpMethod": "POST",
  4259. // "id": "iam.projects.serviceAccounts.setIamPolicy",
  4260. // "parameterOrder": [
  4261. // "resource"
  4262. // ],
  4263. // "parameters": {
  4264. // "resource": {
  4265. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  4266. // "location": "path",
  4267. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4268. // "required": true,
  4269. // "type": "string"
  4270. // }
  4271. // },
  4272. // "path": "v1/{+resource}:setIamPolicy",
  4273. // "request": {
  4274. // "$ref": "SetIamPolicyRequest"
  4275. // },
  4276. // "response": {
  4277. // "$ref": "Policy"
  4278. // },
  4279. // "scopes": [
  4280. // "https://www.googleapis.com/auth/cloud-platform"
  4281. // ]
  4282. // }
  4283. }
  4284. // method id "iam.projects.serviceAccounts.signBlob":
  4285. type ProjectsServiceAccountsSignBlobCall struct {
  4286. s *Service
  4287. name string
  4288. signblobrequest *SignBlobRequest
  4289. urlParams_ gensupport.URLParams
  4290. ctx_ context.Context
  4291. header_ http.Header
  4292. }
  4293. // SignBlob: Signs a blob using a service account's system-managed
  4294. // private key.
  4295. func (r *ProjectsServiceAccountsService) SignBlob(name string, signblobrequest *SignBlobRequest) *ProjectsServiceAccountsSignBlobCall {
  4296. c := &ProjectsServiceAccountsSignBlobCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4297. c.name = name
  4298. c.signblobrequest = signblobrequest
  4299. return c
  4300. }
  4301. // Fields allows partial responses to be retrieved. See
  4302. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4303. // for more information.
  4304. func (c *ProjectsServiceAccountsSignBlobCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSignBlobCall {
  4305. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4306. return c
  4307. }
  4308. // Context sets the context to be used in this call's Do method. Any
  4309. // pending HTTP request will be aborted if the provided context is
  4310. // canceled.
  4311. func (c *ProjectsServiceAccountsSignBlobCall) Context(ctx context.Context) *ProjectsServiceAccountsSignBlobCall {
  4312. c.ctx_ = ctx
  4313. return c
  4314. }
  4315. // Header returns an http.Header that can be modified by the caller to
  4316. // add HTTP headers to the request.
  4317. func (c *ProjectsServiceAccountsSignBlobCall) Header() http.Header {
  4318. if c.header_ == nil {
  4319. c.header_ = make(http.Header)
  4320. }
  4321. return c.header_
  4322. }
  4323. func (c *ProjectsServiceAccountsSignBlobCall) doRequest(alt string) (*http.Response, error) {
  4324. reqHeaders := make(http.Header)
  4325. for k, v := range c.header_ {
  4326. reqHeaders[k] = v
  4327. }
  4328. reqHeaders.Set("User-Agent", c.s.userAgent())
  4329. var body io.Reader = nil
  4330. body, err := googleapi.WithoutDataWrapper.JSONReader(c.signblobrequest)
  4331. if err != nil {
  4332. return nil, err
  4333. }
  4334. reqHeaders.Set("Content-Type", "application/json")
  4335. c.urlParams_.Set("alt", alt)
  4336. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:signBlob")
  4337. urls += "?" + c.urlParams_.Encode()
  4338. req, _ := http.NewRequest("POST", urls, body)
  4339. req.Header = reqHeaders
  4340. googleapi.Expand(req.URL, map[string]string{
  4341. "name": c.name,
  4342. })
  4343. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4344. }
  4345. // Do executes the "iam.projects.serviceAccounts.signBlob" call.
  4346. // Exactly one of *SignBlobResponse or error will be non-nil. Any
  4347. // non-2xx status code is an error. Response headers are in either
  4348. // *SignBlobResponse.ServerResponse.Header or (if a response was
  4349. // returned at all) in error.(*googleapi.Error).Header. Use
  4350. // googleapi.IsNotModified to check whether the returned error was
  4351. // because http.StatusNotModified was returned.
  4352. func (c *ProjectsServiceAccountsSignBlobCall) Do(opts ...googleapi.CallOption) (*SignBlobResponse, error) {
  4353. gensupport.SetOptions(c.urlParams_, opts...)
  4354. res, err := c.doRequest("json")
  4355. if res != nil && res.StatusCode == http.StatusNotModified {
  4356. if res.Body != nil {
  4357. res.Body.Close()
  4358. }
  4359. return nil, &googleapi.Error{
  4360. Code: res.StatusCode,
  4361. Header: res.Header,
  4362. }
  4363. }
  4364. if err != nil {
  4365. return nil, err
  4366. }
  4367. defer googleapi.CloseBody(res)
  4368. if err := googleapi.CheckResponse(res); err != nil {
  4369. return nil, err
  4370. }
  4371. ret := &SignBlobResponse{
  4372. ServerResponse: googleapi.ServerResponse{
  4373. Header: res.Header,
  4374. HTTPStatusCode: res.StatusCode,
  4375. },
  4376. }
  4377. target := &ret
  4378. if err := gensupport.DecodeResponse(target, res); err != nil {
  4379. return nil, err
  4380. }
  4381. return ret, nil
  4382. // {
  4383. // "description": "Signs a blob using a service account's system-managed private key.",
  4384. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signBlob",
  4385. // "httpMethod": "POST",
  4386. // "id": "iam.projects.serviceAccounts.signBlob",
  4387. // "parameterOrder": [
  4388. // "name"
  4389. // ],
  4390. // "parameters": {
  4391. // "name": {
  4392. // "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.",
  4393. // "location": "path",
  4394. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4395. // "required": true,
  4396. // "type": "string"
  4397. // }
  4398. // },
  4399. // "path": "v1/{+name}:signBlob",
  4400. // "request": {
  4401. // "$ref": "SignBlobRequest"
  4402. // },
  4403. // "response": {
  4404. // "$ref": "SignBlobResponse"
  4405. // },
  4406. // "scopes": [
  4407. // "https://www.googleapis.com/auth/cloud-platform"
  4408. // ]
  4409. // }
  4410. }
  4411. // method id "iam.projects.serviceAccounts.signJwt":
  4412. type ProjectsServiceAccountsSignJwtCall struct {
  4413. s *Service
  4414. name string
  4415. signjwtrequest *SignJwtRequest
  4416. urlParams_ gensupport.URLParams
  4417. ctx_ context.Context
  4418. header_ http.Header
  4419. }
  4420. // SignJwt: Signs a JWT using a service account's system-managed private
  4421. // key.
  4422. //
  4423. // If no expiry time (`exp`) is provided in the `SignJwtRequest`, IAM
  4424. // sets an
  4425. // an expiry time of one hour by default. If you request an expiry time
  4426. // of
  4427. // more than one hour, the request will fail.
  4428. func (r *ProjectsServiceAccountsService) SignJwt(name string, signjwtrequest *SignJwtRequest) *ProjectsServiceAccountsSignJwtCall {
  4429. c := &ProjectsServiceAccountsSignJwtCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4430. c.name = name
  4431. c.signjwtrequest = signjwtrequest
  4432. return c
  4433. }
  4434. // Fields allows partial responses to be retrieved. See
  4435. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4436. // for more information.
  4437. func (c *ProjectsServiceAccountsSignJwtCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsSignJwtCall {
  4438. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4439. return c
  4440. }
  4441. // Context sets the context to be used in this call's Do method. Any
  4442. // pending HTTP request will be aborted if the provided context is
  4443. // canceled.
  4444. func (c *ProjectsServiceAccountsSignJwtCall) Context(ctx context.Context) *ProjectsServiceAccountsSignJwtCall {
  4445. c.ctx_ = ctx
  4446. return c
  4447. }
  4448. // Header returns an http.Header that can be modified by the caller to
  4449. // add HTTP headers to the request.
  4450. func (c *ProjectsServiceAccountsSignJwtCall) Header() http.Header {
  4451. if c.header_ == nil {
  4452. c.header_ = make(http.Header)
  4453. }
  4454. return c.header_
  4455. }
  4456. func (c *ProjectsServiceAccountsSignJwtCall) doRequest(alt string) (*http.Response, error) {
  4457. reqHeaders := make(http.Header)
  4458. for k, v := range c.header_ {
  4459. reqHeaders[k] = v
  4460. }
  4461. reqHeaders.Set("User-Agent", c.s.userAgent())
  4462. var body io.Reader = nil
  4463. body, err := googleapi.WithoutDataWrapper.JSONReader(c.signjwtrequest)
  4464. if err != nil {
  4465. return nil, err
  4466. }
  4467. reqHeaders.Set("Content-Type", "application/json")
  4468. c.urlParams_.Set("alt", alt)
  4469. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:signJwt")
  4470. urls += "?" + c.urlParams_.Encode()
  4471. req, _ := http.NewRequest("POST", urls, body)
  4472. req.Header = reqHeaders
  4473. googleapi.Expand(req.URL, map[string]string{
  4474. "name": c.name,
  4475. })
  4476. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4477. }
  4478. // Do executes the "iam.projects.serviceAccounts.signJwt" call.
  4479. // Exactly one of *SignJwtResponse or error will be non-nil. Any non-2xx
  4480. // status code is an error. Response headers are in either
  4481. // *SignJwtResponse.ServerResponse.Header or (if a response was returned
  4482. // at all) in error.(*googleapi.Error).Header. Use
  4483. // googleapi.IsNotModified to check whether the returned error was
  4484. // because http.StatusNotModified was returned.
  4485. func (c *ProjectsServiceAccountsSignJwtCall) Do(opts ...googleapi.CallOption) (*SignJwtResponse, error) {
  4486. gensupport.SetOptions(c.urlParams_, opts...)
  4487. res, err := c.doRequest("json")
  4488. if res != nil && res.StatusCode == http.StatusNotModified {
  4489. if res.Body != nil {
  4490. res.Body.Close()
  4491. }
  4492. return nil, &googleapi.Error{
  4493. Code: res.StatusCode,
  4494. Header: res.Header,
  4495. }
  4496. }
  4497. if err != nil {
  4498. return nil, err
  4499. }
  4500. defer googleapi.CloseBody(res)
  4501. if err := googleapi.CheckResponse(res); err != nil {
  4502. return nil, err
  4503. }
  4504. ret := &SignJwtResponse{
  4505. ServerResponse: googleapi.ServerResponse{
  4506. Header: res.Header,
  4507. HTTPStatusCode: res.StatusCode,
  4508. },
  4509. }
  4510. target := &ret
  4511. if err := gensupport.DecodeResponse(target, res); err != nil {
  4512. return nil, err
  4513. }
  4514. return ret, nil
  4515. // {
  4516. // "description": "Signs 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.",
  4517. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:signJwt",
  4518. // "httpMethod": "POST",
  4519. // "id": "iam.projects.serviceAccounts.signJwt",
  4520. // "parameterOrder": [
  4521. // "name"
  4522. // ],
  4523. // "parameters": {
  4524. // "name": {
  4525. // "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.",
  4526. // "location": "path",
  4527. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4528. // "required": true,
  4529. // "type": "string"
  4530. // }
  4531. // },
  4532. // "path": "v1/{+name}:signJwt",
  4533. // "request": {
  4534. // "$ref": "SignJwtRequest"
  4535. // },
  4536. // "response": {
  4537. // "$ref": "SignJwtResponse"
  4538. // },
  4539. // "scopes": [
  4540. // "https://www.googleapis.com/auth/cloud-platform"
  4541. // ]
  4542. // }
  4543. }
  4544. // method id "iam.projects.serviceAccounts.testIamPermissions":
  4545. type ProjectsServiceAccountsTestIamPermissionsCall struct {
  4546. s *Service
  4547. resource string
  4548. testiampermissionsrequest *TestIamPermissionsRequest
  4549. urlParams_ gensupport.URLParams
  4550. ctx_ context.Context
  4551. header_ http.Header
  4552. }
  4553. // TestIamPermissions: Tests the specified permissions against the IAM
  4554. // access control policy
  4555. // for a ServiceAccount.
  4556. func (r *ProjectsServiceAccountsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsServiceAccountsTestIamPermissionsCall {
  4557. c := &ProjectsServiceAccountsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4558. c.resource = resource
  4559. c.testiampermissionsrequest = testiampermissionsrequest
  4560. return c
  4561. }
  4562. // Fields allows partial responses to be retrieved. See
  4563. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4564. // for more information.
  4565. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsTestIamPermissionsCall {
  4566. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4567. return c
  4568. }
  4569. // Context sets the context to be used in this call's Do method. Any
  4570. // pending HTTP request will be aborted if the provided context is
  4571. // canceled.
  4572. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsServiceAccountsTestIamPermissionsCall {
  4573. c.ctx_ = ctx
  4574. return c
  4575. }
  4576. // Header returns an http.Header that can be modified by the caller to
  4577. // add HTTP headers to the request.
  4578. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Header() http.Header {
  4579. if c.header_ == nil {
  4580. c.header_ = make(http.Header)
  4581. }
  4582. return c.header_
  4583. }
  4584. func (c *ProjectsServiceAccountsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  4585. reqHeaders := make(http.Header)
  4586. for k, v := range c.header_ {
  4587. reqHeaders[k] = v
  4588. }
  4589. reqHeaders.Set("User-Agent", c.s.userAgent())
  4590. var body io.Reader = nil
  4591. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  4592. if err != nil {
  4593. return nil, err
  4594. }
  4595. reqHeaders.Set("Content-Type", "application/json")
  4596. c.urlParams_.Set("alt", alt)
  4597. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  4598. urls += "?" + c.urlParams_.Encode()
  4599. req, _ := http.NewRequest("POST", urls, body)
  4600. req.Header = reqHeaders
  4601. googleapi.Expand(req.URL, map[string]string{
  4602. "resource": c.resource,
  4603. })
  4604. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4605. }
  4606. // Do executes the "iam.projects.serviceAccounts.testIamPermissions" call.
  4607. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  4608. // Any non-2xx status code is an error. Response headers are in either
  4609. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  4610. // was returned at all) in error.(*googleapi.Error).Header. Use
  4611. // googleapi.IsNotModified to check whether the returned error was
  4612. // because http.StatusNotModified was returned.
  4613. func (c *ProjectsServiceAccountsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  4614. gensupport.SetOptions(c.urlParams_, opts...)
  4615. res, err := c.doRequest("json")
  4616. if res != nil && res.StatusCode == http.StatusNotModified {
  4617. if res.Body != nil {
  4618. res.Body.Close()
  4619. }
  4620. return nil, &googleapi.Error{
  4621. Code: res.StatusCode,
  4622. Header: res.Header,
  4623. }
  4624. }
  4625. if err != nil {
  4626. return nil, err
  4627. }
  4628. defer googleapi.CloseBody(res)
  4629. if err := googleapi.CheckResponse(res); err != nil {
  4630. return nil, err
  4631. }
  4632. ret := &TestIamPermissionsResponse{
  4633. ServerResponse: googleapi.ServerResponse{
  4634. Header: res.Header,
  4635. HTTPStatusCode: res.StatusCode,
  4636. },
  4637. }
  4638. target := &ret
  4639. if err := gensupport.DecodeResponse(target, res); err != nil {
  4640. return nil, err
  4641. }
  4642. return ret, nil
  4643. // {
  4644. // "description": "Tests the specified permissions against the IAM access control policy\nfor a ServiceAccount.",
  4645. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}:testIamPermissions",
  4646. // "httpMethod": "POST",
  4647. // "id": "iam.projects.serviceAccounts.testIamPermissions",
  4648. // "parameterOrder": [
  4649. // "resource"
  4650. // ],
  4651. // "parameters": {
  4652. // "resource": {
  4653. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  4654. // "location": "path",
  4655. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4656. // "required": true,
  4657. // "type": "string"
  4658. // }
  4659. // },
  4660. // "path": "v1/{+resource}:testIamPermissions",
  4661. // "request": {
  4662. // "$ref": "TestIamPermissionsRequest"
  4663. // },
  4664. // "response": {
  4665. // "$ref": "TestIamPermissionsResponse"
  4666. // },
  4667. // "scopes": [
  4668. // "https://www.googleapis.com/auth/cloud-platform"
  4669. // ]
  4670. // }
  4671. }
  4672. // method id "iam.projects.serviceAccounts.update":
  4673. type ProjectsServiceAccountsUpdateCall struct {
  4674. s *Service
  4675. name string
  4676. serviceaccount *ServiceAccount
  4677. urlParams_ gensupport.URLParams
  4678. ctx_ context.Context
  4679. header_ http.Header
  4680. }
  4681. // Update: Updates a ServiceAccount.
  4682. //
  4683. // Currently, only the following fields are updatable:
  4684. // `display_name` .
  4685. // The `etag` is mandatory.
  4686. func (r *ProjectsServiceAccountsService) Update(name string, serviceaccount *ServiceAccount) *ProjectsServiceAccountsUpdateCall {
  4687. c := &ProjectsServiceAccountsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4688. c.name = name
  4689. c.serviceaccount = serviceaccount
  4690. return c
  4691. }
  4692. // Fields allows partial responses to be retrieved. See
  4693. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4694. // for more information.
  4695. func (c *ProjectsServiceAccountsUpdateCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsUpdateCall {
  4696. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4697. return c
  4698. }
  4699. // Context sets the context to be used in this call's Do method. Any
  4700. // pending HTTP request will be aborted if the provided context is
  4701. // canceled.
  4702. func (c *ProjectsServiceAccountsUpdateCall) Context(ctx context.Context) *ProjectsServiceAccountsUpdateCall {
  4703. c.ctx_ = ctx
  4704. return c
  4705. }
  4706. // Header returns an http.Header that can be modified by the caller to
  4707. // add HTTP headers to the request.
  4708. func (c *ProjectsServiceAccountsUpdateCall) Header() http.Header {
  4709. if c.header_ == nil {
  4710. c.header_ = make(http.Header)
  4711. }
  4712. return c.header_
  4713. }
  4714. func (c *ProjectsServiceAccountsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4715. reqHeaders := make(http.Header)
  4716. for k, v := range c.header_ {
  4717. reqHeaders[k] = v
  4718. }
  4719. reqHeaders.Set("User-Agent", c.s.userAgent())
  4720. var body io.Reader = nil
  4721. body, err := googleapi.WithoutDataWrapper.JSONReader(c.serviceaccount)
  4722. if err != nil {
  4723. return nil, err
  4724. }
  4725. reqHeaders.Set("Content-Type", "application/json")
  4726. c.urlParams_.Set("alt", alt)
  4727. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4728. urls += "?" + c.urlParams_.Encode()
  4729. req, _ := http.NewRequest("PUT", urls, body)
  4730. req.Header = reqHeaders
  4731. googleapi.Expand(req.URL, map[string]string{
  4732. "name": c.name,
  4733. })
  4734. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4735. }
  4736. // Do executes the "iam.projects.serviceAccounts.update" call.
  4737. // Exactly one of *ServiceAccount or error will be non-nil. Any non-2xx
  4738. // status code is an error. Response headers are in either
  4739. // *ServiceAccount.ServerResponse.Header or (if a response was returned
  4740. // at all) in error.(*googleapi.Error).Header. Use
  4741. // googleapi.IsNotModified to check whether the returned error was
  4742. // because http.StatusNotModified was returned.
  4743. func (c *ProjectsServiceAccountsUpdateCall) Do(opts ...googleapi.CallOption) (*ServiceAccount, error) {
  4744. gensupport.SetOptions(c.urlParams_, opts...)
  4745. res, err := c.doRequest("json")
  4746. if res != nil && res.StatusCode == http.StatusNotModified {
  4747. if res.Body != nil {
  4748. res.Body.Close()
  4749. }
  4750. return nil, &googleapi.Error{
  4751. Code: res.StatusCode,
  4752. Header: res.Header,
  4753. }
  4754. }
  4755. if err != nil {
  4756. return nil, err
  4757. }
  4758. defer googleapi.CloseBody(res)
  4759. if err := googleapi.CheckResponse(res); err != nil {
  4760. return nil, err
  4761. }
  4762. ret := &ServiceAccount{
  4763. ServerResponse: googleapi.ServerResponse{
  4764. Header: res.Header,
  4765. HTTPStatusCode: res.StatusCode,
  4766. },
  4767. }
  4768. target := &ret
  4769. if err := gensupport.DecodeResponse(target, res); err != nil {
  4770. return nil, err
  4771. }
  4772. return ret, nil
  4773. // {
  4774. // "description": "Updates a ServiceAccount.\n\nCurrently, only the following fields are updatable:\n`display_name` .\nThe `etag` is mandatory.",
  4775. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}",
  4776. // "httpMethod": "PUT",
  4777. // "id": "iam.projects.serviceAccounts.update",
  4778. // "parameterOrder": [
  4779. // "name"
  4780. // ],
  4781. // "parameters": {
  4782. // "name": {
  4783. // "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}`.",
  4784. // "location": "path",
  4785. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4786. // "required": true,
  4787. // "type": "string"
  4788. // }
  4789. // },
  4790. // "path": "v1/{+name}",
  4791. // "request": {
  4792. // "$ref": "ServiceAccount"
  4793. // },
  4794. // "response": {
  4795. // "$ref": "ServiceAccount"
  4796. // },
  4797. // "scopes": [
  4798. // "https://www.googleapis.com/auth/cloud-platform"
  4799. // ]
  4800. // }
  4801. }
  4802. // method id "iam.projects.serviceAccounts.keys.create":
  4803. type ProjectsServiceAccountsKeysCreateCall struct {
  4804. s *Service
  4805. name string
  4806. createserviceaccountkeyrequest *CreateServiceAccountKeyRequest
  4807. urlParams_ gensupport.URLParams
  4808. ctx_ context.Context
  4809. header_ http.Header
  4810. }
  4811. // Create: Creates a ServiceAccountKey
  4812. // and returns it.
  4813. func (r *ProjectsServiceAccountsKeysService) Create(name string, createserviceaccountkeyrequest *CreateServiceAccountKeyRequest) *ProjectsServiceAccountsKeysCreateCall {
  4814. c := &ProjectsServiceAccountsKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4815. c.name = name
  4816. c.createserviceaccountkeyrequest = createserviceaccountkeyrequest
  4817. return c
  4818. }
  4819. // Fields allows partial responses to be retrieved. See
  4820. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4821. // for more information.
  4822. func (c *ProjectsServiceAccountsKeysCreateCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysCreateCall {
  4823. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4824. return c
  4825. }
  4826. // Context sets the context to be used in this call's Do method. Any
  4827. // pending HTTP request will be aborted if the provided context is
  4828. // canceled.
  4829. func (c *ProjectsServiceAccountsKeysCreateCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysCreateCall {
  4830. c.ctx_ = ctx
  4831. return c
  4832. }
  4833. // Header returns an http.Header that can be modified by the caller to
  4834. // add HTTP headers to the request.
  4835. func (c *ProjectsServiceAccountsKeysCreateCall) Header() http.Header {
  4836. if c.header_ == nil {
  4837. c.header_ = make(http.Header)
  4838. }
  4839. return c.header_
  4840. }
  4841. func (c *ProjectsServiceAccountsKeysCreateCall) doRequest(alt string) (*http.Response, error) {
  4842. reqHeaders := make(http.Header)
  4843. for k, v := range c.header_ {
  4844. reqHeaders[k] = v
  4845. }
  4846. reqHeaders.Set("User-Agent", c.s.userAgent())
  4847. var body io.Reader = nil
  4848. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createserviceaccountkeyrequest)
  4849. if err != nil {
  4850. return nil, err
  4851. }
  4852. reqHeaders.Set("Content-Type", "application/json")
  4853. c.urlParams_.Set("alt", alt)
  4854. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/keys")
  4855. urls += "?" + c.urlParams_.Encode()
  4856. req, _ := http.NewRequest("POST", urls, body)
  4857. req.Header = reqHeaders
  4858. googleapi.Expand(req.URL, map[string]string{
  4859. "name": c.name,
  4860. })
  4861. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4862. }
  4863. // Do executes the "iam.projects.serviceAccounts.keys.create" call.
  4864. // Exactly one of *ServiceAccountKey or error will be non-nil. Any
  4865. // non-2xx status code is an error. Response headers are in either
  4866. // *ServiceAccountKey.ServerResponse.Header or (if a response was
  4867. // returned at all) in error.(*googleapi.Error).Header. Use
  4868. // googleapi.IsNotModified to check whether the returned error was
  4869. // because http.StatusNotModified was returned.
  4870. func (c *ProjectsServiceAccountsKeysCreateCall) Do(opts ...googleapi.CallOption) (*ServiceAccountKey, error) {
  4871. gensupport.SetOptions(c.urlParams_, opts...)
  4872. res, err := c.doRequest("json")
  4873. if res != nil && res.StatusCode == http.StatusNotModified {
  4874. if res.Body != nil {
  4875. res.Body.Close()
  4876. }
  4877. return nil, &googleapi.Error{
  4878. Code: res.StatusCode,
  4879. Header: res.Header,
  4880. }
  4881. }
  4882. if err != nil {
  4883. return nil, err
  4884. }
  4885. defer googleapi.CloseBody(res)
  4886. if err := googleapi.CheckResponse(res); err != nil {
  4887. return nil, err
  4888. }
  4889. ret := &ServiceAccountKey{
  4890. ServerResponse: googleapi.ServerResponse{
  4891. Header: res.Header,
  4892. HTTPStatusCode: res.StatusCode,
  4893. },
  4894. }
  4895. target := &ret
  4896. if err := gensupport.DecodeResponse(target, res); err != nil {
  4897. return nil, err
  4898. }
  4899. return ret, nil
  4900. // {
  4901. // "description": "Creates a ServiceAccountKey\nand returns it.",
  4902. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys",
  4903. // "httpMethod": "POST",
  4904. // "id": "iam.projects.serviceAccounts.keys.create",
  4905. // "parameterOrder": [
  4906. // "name"
  4907. // ],
  4908. // "parameters": {
  4909. // "name": {
  4910. // "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.",
  4911. // "location": "path",
  4912. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  4913. // "required": true,
  4914. // "type": "string"
  4915. // }
  4916. // },
  4917. // "path": "v1/{+name}/keys",
  4918. // "request": {
  4919. // "$ref": "CreateServiceAccountKeyRequest"
  4920. // },
  4921. // "response": {
  4922. // "$ref": "ServiceAccountKey"
  4923. // },
  4924. // "scopes": [
  4925. // "https://www.googleapis.com/auth/cloud-platform"
  4926. // ]
  4927. // }
  4928. }
  4929. // method id "iam.projects.serviceAccounts.keys.delete":
  4930. type ProjectsServiceAccountsKeysDeleteCall struct {
  4931. s *Service
  4932. name string
  4933. urlParams_ gensupport.URLParams
  4934. ctx_ context.Context
  4935. header_ http.Header
  4936. }
  4937. // Delete: Deletes a ServiceAccountKey.
  4938. func (r *ProjectsServiceAccountsKeysService) Delete(name string) *ProjectsServiceAccountsKeysDeleteCall {
  4939. c := &ProjectsServiceAccountsKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4940. c.name = name
  4941. return c
  4942. }
  4943. // Fields allows partial responses to be retrieved. See
  4944. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4945. // for more information.
  4946. func (c *ProjectsServiceAccountsKeysDeleteCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysDeleteCall {
  4947. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4948. return c
  4949. }
  4950. // Context sets the context to be used in this call's Do method. Any
  4951. // pending HTTP request will be aborted if the provided context is
  4952. // canceled.
  4953. func (c *ProjectsServiceAccountsKeysDeleteCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysDeleteCall {
  4954. c.ctx_ = ctx
  4955. return c
  4956. }
  4957. // Header returns an http.Header that can be modified by the caller to
  4958. // add HTTP headers to the request.
  4959. func (c *ProjectsServiceAccountsKeysDeleteCall) Header() http.Header {
  4960. if c.header_ == nil {
  4961. c.header_ = make(http.Header)
  4962. }
  4963. return c.header_
  4964. }
  4965. func (c *ProjectsServiceAccountsKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
  4966. reqHeaders := make(http.Header)
  4967. for k, v := range c.header_ {
  4968. reqHeaders[k] = v
  4969. }
  4970. reqHeaders.Set("User-Agent", c.s.userAgent())
  4971. var body io.Reader = nil
  4972. c.urlParams_.Set("alt", alt)
  4973. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4974. urls += "?" + c.urlParams_.Encode()
  4975. req, _ := http.NewRequest("DELETE", urls, body)
  4976. req.Header = reqHeaders
  4977. googleapi.Expand(req.URL, map[string]string{
  4978. "name": c.name,
  4979. })
  4980. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4981. }
  4982. // Do executes the "iam.projects.serviceAccounts.keys.delete" call.
  4983. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4984. // code is an error. Response headers are in either
  4985. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4986. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4987. // check whether the returned error was because http.StatusNotModified
  4988. // was returned.
  4989. func (c *ProjectsServiceAccountsKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4990. gensupport.SetOptions(c.urlParams_, opts...)
  4991. res, err := c.doRequest("json")
  4992. if res != nil && res.StatusCode == http.StatusNotModified {
  4993. if res.Body != nil {
  4994. res.Body.Close()
  4995. }
  4996. return nil, &googleapi.Error{
  4997. Code: res.StatusCode,
  4998. Header: res.Header,
  4999. }
  5000. }
  5001. if err != nil {
  5002. return nil, err
  5003. }
  5004. defer googleapi.CloseBody(res)
  5005. if err := googleapi.CheckResponse(res); err != nil {
  5006. return nil, err
  5007. }
  5008. ret := &Empty{
  5009. ServerResponse: googleapi.ServerResponse{
  5010. Header: res.Header,
  5011. HTTPStatusCode: res.StatusCode,
  5012. },
  5013. }
  5014. target := &ret
  5015. if err := gensupport.DecodeResponse(target, res); err != nil {
  5016. return nil, err
  5017. }
  5018. return ret, nil
  5019. // {
  5020. // "description": "Deletes a ServiceAccountKey.",
  5021. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}",
  5022. // "httpMethod": "DELETE",
  5023. // "id": "iam.projects.serviceAccounts.keys.delete",
  5024. // "parameterOrder": [
  5025. // "name"
  5026. // ],
  5027. // "parameters": {
  5028. // "name": {
  5029. // "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.",
  5030. // "location": "path",
  5031. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+/keys/[^/]+$",
  5032. // "required": true,
  5033. // "type": "string"
  5034. // }
  5035. // },
  5036. // "path": "v1/{+name}",
  5037. // "response": {
  5038. // "$ref": "Empty"
  5039. // },
  5040. // "scopes": [
  5041. // "https://www.googleapis.com/auth/cloud-platform"
  5042. // ]
  5043. // }
  5044. }
  5045. // method id "iam.projects.serviceAccounts.keys.get":
  5046. type ProjectsServiceAccountsKeysGetCall struct {
  5047. s *Service
  5048. name string
  5049. urlParams_ gensupport.URLParams
  5050. ifNoneMatch_ string
  5051. ctx_ context.Context
  5052. header_ http.Header
  5053. }
  5054. // Get: Gets the ServiceAccountKey
  5055. // by key id.
  5056. func (r *ProjectsServiceAccountsKeysService) Get(name string) *ProjectsServiceAccountsKeysGetCall {
  5057. c := &ProjectsServiceAccountsKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5058. c.name = name
  5059. return c
  5060. }
  5061. // PublicKeyType sets the optional parameter "publicKeyType": The output
  5062. // format of the public key requested.
  5063. // X509_PEM is the default output format.
  5064. //
  5065. // Possible values:
  5066. // "TYPE_NONE"
  5067. // "TYPE_X509_PEM_FILE"
  5068. // "TYPE_RAW_PUBLIC_KEY"
  5069. func (c *ProjectsServiceAccountsKeysGetCall) PublicKeyType(publicKeyType string) *ProjectsServiceAccountsKeysGetCall {
  5070. c.urlParams_.Set("publicKeyType", publicKeyType)
  5071. return c
  5072. }
  5073. // Fields allows partial responses to be retrieved. See
  5074. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5075. // for more information.
  5076. func (c *ProjectsServiceAccountsKeysGetCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysGetCall {
  5077. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5078. return c
  5079. }
  5080. // IfNoneMatch sets the optional parameter which makes the operation
  5081. // fail if the object's ETag matches the given value. This is useful for
  5082. // getting updates only after the object has changed since the last
  5083. // request. Use googleapi.IsNotModified to check whether the response
  5084. // error from Do is the result of In-None-Match.
  5085. func (c *ProjectsServiceAccountsKeysGetCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsKeysGetCall {
  5086. c.ifNoneMatch_ = entityTag
  5087. return c
  5088. }
  5089. // Context sets the context to be used in this call's Do method. Any
  5090. // pending HTTP request will be aborted if the provided context is
  5091. // canceled.
  5092. func (c *ProjectsServiceAccountsKeysGetCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysGetCall {
  5093. c.ctx_ = ctx
  5094. return c
  5095. }
  5096. // Header returns an http.Header that can be modified by the caller to
  5097. // add HTTP headers to the request.
  5098. func (c *ProjectsServiceAccountsKeysGetCall) Header() http.Header {
  5099. if c.header_ == nil {
  5100. c.header_ = make(http.Header)
  5101. }
  5102. return c.header_
  5103. }
  5104. func (c *ProjectsServiceAccountsKeysGetCall) doRequest(alt string) (*http.Response, error) {
  5105. reqHeaders := make(http.Header)
  5106. for k, v := range c.header_ {
  5107. reqHeaders[k] = v
  5108. }
  5109. reqHeaders.Set("User-Agent", c.s.userAgent())
  5110. if c.ifNoneMatch_ != "" {
  5111. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5112. }
  5113. var body io.Reader = nil
  5114. c.urlParams_.Set("alt", alt)
  5115. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5116. urls += "?" + c.urlParams_.Encode()
  5117. req, _ := http.NewRequest("GET", urls, body)
  5118. req.Header = reqHeaders
  5119. googleapi.Expand(req.URL, map[string]string{
  5120. "name": c.name,
  5121. })
  5122. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5123. }
  5124. // Do executes the "iam.projects.serviceAccounts.keys.get" call.
  5125. // Exactly one of *ServiceAccountKey or error will be non-nil. Any
  5126. // non-2xx status code is an error. Response headers are in either
  5127. // *ServiceAccountKey.ServerResponse.Header or (if a response was
  5128. // returned at all) in error.(*googleapi.Error).Header. Use
  5129. // googleapi.IsNotModified to check whether the returned error was
  5130. // because http.StatusNotModified was returned.
  5131. func (c *ProjectsServiceAccountsKeysGetCall) Do(opts ...googleapi.CallOption) (*ServiceAccountKey, error) {
  5132. gensupport.SetOptions(c.urlParams_, opts...)
  5133. res, err := c.doRequest("json")
  5134. if res != nil && res.StatusCode == http.StatusNotModified {
  5135. if res.Body != nil {
  5136. res.Body.Close()
  5137. }
  5138. return nil, &googleapi.Error{
  5139. Code: res.StatusCode,
  5140. Header: res.Header,
  5141. }
  5142. }
  5143. if err != nil {
  5144. return nil, err
  5145. }
  5146. defer googleapi.CloseBody(res)
  5147. if err := googleapi.CheckResponse(res); err != nil {
  5148. return nil, err
  5149. }
  5150. ret := &ServiceAccountKey{
  5151. ServerResponse: googleapi.ServerResponse{
  5152. Header: res.Header,
  5153. HTTPStatusCode: res.StatusCode,
  5154. },
  5155. }
  5156. target := &ret
  5157. if err := gensupport.DecodeResponse(target, res); err != nil {
  5158. return nil, err
  5159. }
  5160. return ret, nil
  5161. // {
  5162. // "description": "Gets the ServiceAccountKey\nby key id.",
  5163. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys/{keysId}",
  5164. // "httpMethod": "GET",
  5165. // "id": "iam.projects.serviceAccounts.keys.get",
  5166. // "parameterOrder": [
  5167. // "name"
  5168. // ],
  5169. // "parameters": {
  5170. // "name": {
  5171. // "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.",
  5172. // "location": "path",
  5173. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+/keys/[^/]+$",
  5174. // "required": true,
  5175. // "type": "string"
  5176. // },
  5177. // "publicKeyType": {
  5178. // "description": "The output format of the public key requested.\nX509_PEM is the default output format.",
  5179. // "enum": [
  5180. // "TYPE_NONE",
  5181. // "TYPE_X509_PEM_FILE",
  5182. // "TYPE_RAW_PUBLIC_KEY"
  5183. // ],
  5184. // "location": "query",
  5185. // "type": "string"
  5186. // }
  5187. // },
  5188. // "path": "v1/{+name}",
  5189. // "response": {
  5190. // "$ref": "ServiceAccountKey"
  5191. // },
  5192. // "scopes": [
  5193. // "https://www.googleapis.com/auth/cloud-platform"
  5194. // ]
  5195. // }
  5196. }
  5197. // method id "iam.projects.serviceAccounts.keys.list":
  5198. type ProjectsServiceAccountsKeysListCall struct {
  5199. s *Service
  5200. name string
  5201. urlParams_ gensupport.URLParams
  5202. ifNoneMatch_ string
  5203. ctx_ context.Context
  5204. header_ http.Header
  5205. }
  5206. // List: Lists ServiceAccountKeys.
  5207. func (r *ProjectsServiceAccountsKeysService) List(name string) *ProjectsServiceAccountsKeysListCall {
  5208. c := &ProjectsServiceAccountsKeysListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5209. c.name = name
  5210. return c
  5211. }
  5212. // KeyTypes sets the optional parameter "keyTypes": Filters the types of
  5213. // keys the user wants to include in the list
  5214. // response. Duplicate key types are not allowed. If no key type
  5215. // is provided, all keys are returned.
  5216. //
  5217. // Possible values:
  5218. // "KEY_TYPE_UNSPECIFIED"
  5219. // "USER_MANAGED"
  5220. // "SYSTEM_MANAGED"
  5221. func (c *ProjectsServiceAccountsKeysListCall) KeyTypes(keyTypes ...string) *ProjectsServiceAccountsKeysListCall {
  5222. c.urlParams_.SetMulti("keyTypes", append([]string{}, keyTypes...))
  5223. return c
  5224. }
  5225. // Fields allows partial responses to be retrieved. See
  5226. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5227. // for more information.
  5228. func (c *ProjectsServiceAccountsKeysListCall) Fields(s ...googleapi.Field) *ProjectsServiceAccountsKeysListCall {
  5229. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5230. return c
  5231. }
  5232. // IfNoneMatch sets the optional parameter which makes the operation
  5233. // fail if the object's ETag matches the given value. This is useful for
  5234. // getting updates only after the object has changed since the last
  5235. // request. Use googleapi.IsNotModified to check whether the response
  5236. // error from Do is the result of In-None-Match.
  5237. func (c *ProjectsServiceAccountsKeysListCall) IfNoneMatch(entityTag string) *ProjectsServiceAccountsKeysListCall {
  5238. c.ifNoneMatch_ = entityTag
  5239. return c
  5240. }
  5241. // Context sets the context to be used in this call's Do method. Any
  5242. // pending HTTP request will be aborted if the provided context is
  5243. // canceled.
  5244. func (c *ProjectsServiceAccountsKeysListCall) Context(ctx context.Context) *ProjectsServiceAccountsKeysListCall {
  5245. c.ctx_ = ctx
  5246. return c
  5247. }
  5248. // Header returns an http.Header that can be modified by the caller to
  5249. // add HTTP headers to the request.
  5250. func (c *ProjectsServiceAccountsKeysListCall) Header() http.Header {
  5251. if c.header_ == nil {
  5252. c.header_ = make(http.Header)
  5253. }
  5254. return c.header_
  5255. }
  5256. func (c *ProjectsServiceAccountsKeysListCall) doRequest(alt string) (*http.Response, error) {
  5257. reqHeaders := make(http.Header)
  5258. for k, v := range c.header_ {
  5259. reqHeaders[k] = v
  5260. }
  5261. reqHeaders.Set("User-Agent", c.s.userAgent())
  5262. if c.ifNoneMatch_ != "" {
  5263. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5264. }
  5265. var body io.Reader = nil
  5266. c.urlParams_.Set("alt", alt)
  5267. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/keys")
  5268. urls += "?" + c.urlParams_.Encode()
  5269. req, _ := http.NewRequest("GET", urls, body)
  5270. req.Header = reqHeaders
  5271. googleapi.Expand(req.URL, map[string]string{
  5272. "name": c.name,
  5273. })
  5274. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5275. }
  5276. // Do executes the "iam.projects.serviceAccounts.keys.list" call.
  5277. // Exactly one of *ListServiceAccountKeysResponse or error will be
  5278. // non-nil. Any non-2xx status code is an error. Response headers are in
  5279. // either *ListServiceAccountKeysResponse.ServerResponse.Header or (if a
  5280. // response was returned at all) in error.(*googleapi.Error).Header. Use
  5281. // googleapi.IsNotModified to check whether the returned error was
  5282. // because http.StatusNotModified was returned.
  5283. func (c *ProjectsServiceAccountsKeysListCall) Do(opts ...googleapi.CallOption) (*ListServiceAccountKeysResponse, error) {
  5284. gensupport.SetOptions(c.urlParams_, opts...)
  5285. res, err := c.doRequest("json")
  5286. if res != nil && res.StatusCode == http.StatusNotModified {
  5287. if res.Body != nil {
  5288. res.Body.Close()
  5289. }
  5290. return nil, &googleapi.Error{
  5291. Code: res.StatusCode,
  5292. Header: res.Header,
  5293. }
  5294. }
  5295. if err != nil {
  5296. return nil, err
  5297. }
  5298. defer googleapi.CloseBody(res)
  5299. if err := googleapi.CheckResponse(res); err != nil {
  5300. return nil, err
  5301. }
  5302. ret := &ListServiceAccountKeysResponse{
  5303. ServerResponse: googleapi.ServerResponse{
  5304. Header: res.Header,
  5305. HTTPStatusCode: res.StatusCode,
  5306. },
  5307. }
  5308. target := &ret
  5309. if err := gensupport.DecodeResponse(target, res); err != nil {
  5310. return nil, err
  5311. }
  5312. return ret, nil
  5313. // {
  5314. // "description": "Lists ServiceAccountKeys.",
  5315. // "flatPath": "v1/projects/{projectsId}/serviceAccounts/{serviceAccountsId}/keys",
  5316. // "httpMethod": "GET",
  5317. // "id": "iam.projects.serviceAccounts.keys.list",
  5318. // "parameterOrder": [
  5319. // "name"
  5320. // ],
  5321. // "parameters": {
  5322. // "keyTypes": {
  5323. // "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.",
  5324. // "enum": [
  5325. // "KEY_TYPE_UNSPECIFIED",
  5326. // "USER_MANAGED",
  5327. // "SYSTEM_MANAGED"
  5328. // ],
  5329. // "location": "query",
  5330. // "repeated": true,
  5331. // "type": "string"
  5332. // },
  5333. // "name": {
  5334. // "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.",
  5335. // "location": "path",
  5336. // "pattern": "^projects/[^/]+/serviceAccounts/[^/]+$",
  5337. // "required": true,
  5338. // "type": "string"
  5339. // }
  5340. // },
  5341. // "path": "v1/{+name}/keys",
  5342. // "response": {
  5343. // "$ref": "ListServiceAccountKeysResponse"
  5344. // },
  5345. // "scopes": [
  5346. // "https://www.googleapis.com/auth/cloud-platform"
  5347. // ]
  5348. // }
  5349. }
  5350. // method id "iam.roles.get":
  5351. type RolesGetCall struct {
  5352. s *Service
  5353. name string
  5354. urlParams_ gensupport.URLParams
  5355. ifNoneMatch_ string
  5356. ctx_ context.Context
  5357. header_ http.Header
  5358. }
  5359. // Get: Gets a Role definition.
  5360. func (r *RolesService) Get(name string) *RolesGetCall {
  5361. c := &RolesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5362. c.name = name
  5363. return c
  5364. }
  5365. // Fields allows partial responses to be retrieved. See
  5366. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5367. // for more information.
  5368. func (c *RolesGetCall) Fields(s ...googleapi.Field) *RolesGetCall {
  5369. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5370. return c
  5371. }
  5372. // IfNoneMatch sets the optional parameter which makes the operation
  5373. // fail if the object's ETag matches the given value. This is useful for
  5374. // getting updates only after the object has changed since the last
  5375. // request. Use googleapi.IsNotModified to check whether the response
  5376. // error from Do is the result of In-None-Match.
  5377. func (c *RolesGetCall) IfNoneMatch(entityTag string) *RolesGetCall {
  5378. c.ifNoneMatch_ = entityTag
  5379. return c
  5380. }
  5381. // Context sets the context to be used in this call's Do method. Any
  5382. // pending HTTP request will be aborted if the provided context is
  5383. // canceled.
  5384. func (c *RolesGetCall) Context(ctx context.Context) *RolesGetCall {
  5385. c.ctx_ = ctx
  5386. return c
  5387. }
  5388. // Header returns an http.Header that can be modified by the caller to
  5389. // add HTTP headers to the request.
  5390. func (c *RolesGetCall) Header() http.Header {
  5391. if c.header_ == nil {
  5392. c.header_ = make(http.Header)
  5393. }
  5394. return c.header_
  5395. }
  5396. func (c *RolesGetCall) doRequest(alt string) (*http.Response, error) {
  5397. reqHeaders := make(http.Header)
  5398. for k, v := range c.header_ {
  5399. reqHeaders[k] = v
  5400. }
  5401. reqHeaders.Set("User-Agent", c.s.userAgent())
  5402. if c.ifNoneMatch_ != "" {
  5403. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5404. }
  5405. var body io.Reader = nil
  5406. c.urlParams_.Set("alt", alt)
  5407. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5408. urls += "?" + c.urlParams_.Encode()
  5409. req, _ := http.NewRequest("GET", urls, body)
  5410. req.Header = reqHeaders
  5411. googleapi.Expand(req.URL, map[string]string{
  5412. "name": c.name,
  5413. })
  5414. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5415. }
  5416. // Do executes the "iam.roles.get" call.
  5417. // Exactly one of *Role or error will be non-nil. Any non-2xx status
  5418. // code is an error. Response headers are in either
  5419. // *Role.ServerResponse.Header or (if a response was returned at all) in
  5420. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5421. // whether the returned error was because http.StatusNotModified was
  5422. // returned.
  5423. func (c *RolesGetCall) Do(opts ...googleapi.CallOption) (*Role, error) {
  5424. gensupport.SetOptions(c.urlParams_, opts...)
  5425. res, err := c.doRequest("json")
  5426. if res != nil && res.StatusCode == http.StatusNotModified {
  5427. if res.Body != nil {
  5428. res.Body.Close()
  5429. }
  5430. return nil, &googleapi.Error{
  5431. Code: res.StatusCode,
  5432. Header: res.Header,
  5433. }
  5434. }
  5435. if err != nil {
  5436. return nil, err
  5437. }
  5438. defer googleapi.CloseBody(res)
  5439. if err := googleapi.CheckResponse(res); err != nil {
  5440. return nil, err
  5441. }
  5442. ret := &Role{
  5443. ServerResponse: googleapi.ServerResponse{
  5444. Header: res.Header,
  5445. HTTPStatusCode: res.StatusCode,
  5446. },
  5447. }
  5448. target := &ret
  5449. if err := gensupport.DecodeResponse(target, res); err != nil {
  5450. return nil, err
  5451. }
  5452. return ret, nil
  5453. // {
  5454. // "description": "Gets a Role definition.",
  5455. // "flatPath": "v1/roles/{rolesId}",
  5456. // "httpMethod": "GET",
  5457. // "id": "iam.roles.get",
  5458. // "parameterOrder": [
  5459. // "name"
  5460. // ],
  5461. // "parameters": {
  5462. // "name": {
  5463. // "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}`",
  5464. // "location": "path",
  5465. // "pattern": "^roles/[^/]+$",
  5466. // "required": true,
  5467. // "type": "string"
  5468. // }
  5469. // },
  5470. // "path": "v1/{+name}",
  5471. // "response": {
  5472. // "$ref": "Role"
  5473. // },
  5474. // "scopes": [
  5475. // "https://www.googleapis.com/auth/cloud-platform"
  5476. // ]
  5477. // }
  5478. }
  5479. // method id "iam.roles.list":
  5480. type RolesListCall struct {
  5481. s *Service
  5482. urlParams_ gensupport.URLParams
  5483. ifNoneMatch_ string
  5484. ctx_ context.Context
  5485. header_ http.Header
  5486. }
  5487. // List: Lists the Roles defined on a resource.
  5488. func (r *RolesService) List() *RolesListCall {
  5489. c := &RolesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5490. return c
  5491. }
  5492. // PageSize sets the optional parameter "pageSize": Optional limit on
  5493. // the number of roles to include in the response.
  5494. func (c *RolesListCall) PageSize(pageSize int64) *RolesListCall {
  5495. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5496. return c
  5497. }
  5498. // PageToken sets the optional parameter "pageToken": Optional
  5499. // pagination token returned in an earlier ListRolesResponse.
  5500. func (c *RolesListCall) PageToken(pageToken string) *RolesListCall {
  5501. c.urlParams_.Set("pageToken", pageToken)
  5502. return c
  5503. }
  5504. // Parent sets the optional parameter "parent": The resource name of the
  5505. // parent resource in one of the following formats:
  5506. // `` (empty string) -- this refers to curated
  5507. // roles.
  5508. // `organizations/{ORGANIZATION_ID}`
  5509. // `projects/{PROJECT_ID}`
  5510. func (c *RolesListCall) Parent(parent string) *RolesListCall {
  5511. c.urlParams_.Set("parent", parent)
  5512. return c
  5513. }
  5514. // ShowDeleted sets the optional parameter "showDeleted": Include Roles
  5515. // that have been deleted.
  5516. func (c *RolesListCall) ShowDeleted(showDeleted bool) *RolesListCall {
  5517. c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted))
  5518. return c
  5519. }
  5520. // View sets the optional parameter "view": Optional view for the
  5521. // returned Role objects.
  5522. //
  5523. // Possible values:
  5524. // "BASIC"
  5525. // "FULL"
  5526. func (c *RolesListCall) View(view string) *RolesListCall {
  5527. c.urlParams_.Set("view", view)
  5528. return c
  5529. }
  5530. // Fields allows partial responses to be retrieved. See
  5531. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5532. // for more information.
  5533. func (c *RolesListCall) Fields(s ...googleapi.Field) *RolesListCall {
  5534. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5535. return c
  5536. }
  5537. // IfNoneMatch sets the optional parameter which makes the operation
  5538. // fail if the object's ETag matches the given value. This is useful for
  5539. // getting updates only after the object has changed since the last
  5540. // request. Use googleapi.IsNotModified to check whether the response
  5541. // error from Do is the result of In-None-Match.
  5542. func (c *RolesListCall) IfNoneMatch(entityTag string) *RolesListCall {
  5543. c.ifNoneMatch_ = entityTag
  5544. return c
  5545. }
  5546. // Context sets the context to be used in this call's Do method. Any
  5547. // pending HTTP request will be aborted if the provided context is
  5548. // canceled.
  5549. func (c *RolesListCall) Context(ctx context.Context) *RolesListCall {
  5550. c.ctx_ = ctx
  5551. return c
  5552. }
  5553. // Header returns an http.Header that can be modified by the caller to
  5554. // add HTTP headers to the request.
  5555. func (c *RolesListCall) Header() http.Header {
  5556. if c.header_ == nil {
  5557. c.header_ = make(http.Header)
  5558. }
  5559. return c.header_
  5560. }
  5561. func (c *RolesListCall) doRequest(alt string) (*http.Response, error) {
  5562. reqHeaders := make(http.Header)
  5563. for k, v := range c.header_ {
  5564. reqHeaders[k] = v
  5565. }
  5566. reqHeaders.Set("User-Agent", c.s.userAgent())
  5567. if c.ifNoneMatch_ != "" {
  5568. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5569. }
  5570. var body io.Reader = nil
  5571. c.urlParams_.Set("alt", alt)
  5572. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/roles")
  5573. urls += "?" + c.urlParams_.Encode()
  5574. req, _ := http.NewRequest("GET", urls, body)
  5575. req.Header = reqHeaders
  5576. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5577. }
  5578. // Do executes the "iam.roles.list" call.
  5579. // Exactly one of *ListRolesResponse or error will be non-nil. Any
  5580. // non-2xx status code is an error. Response headers are in either
  5581. // *ListRolesResponse.ServerResponse.Header or (if a response was
  5582. // returned at all) in error.(*googleapi.Error).Header. Use
  5583. // googleapi.IsNotModified to check whether the returned error was
  5584. // because http.StatusNotModified was returned.
  5585. func (c *RolesListCall) Do(opts ...googleapi.CallOption) (*ListRolesResponse, error) {
  5586. gensupport.SetOptions(c.urlParams_, opts...)
  5587. res, err := c.doRequest("json")
  5588. if res != nil && res.StatusCode == http.StatusNotModified {
  5589. if res.Body != nil {
  5590. res.Body.Close()
  5591. }
  5592. return nil, &googleapi.Error{
  5593. Code: res.StatusCode,
  5594. Header: res.Header,
  5595. }
  5596. }
  5597. if err != nil {
  5598. return nil, err
  5599. }
  5600. defer googleapi.CloseBody(res)
  5601. if err := googleapi.CheckResponse(res); err != nil {
  5602. return nil, err
  5603. }
  5604. ret := &ListRolesResponse{
  5605. ServerResponse: googleapi.ServerResponse{
  5606. Header: res.Header,
  5607. HTTPStatusCode: res.StatusCode,
  5608. },
  5609. }
  5610. target := &ret
  5611. if err := gensupport.DecodeResponse(target, res); err != nil {
  5612. return nil, err
  5613. }
  5614. return ret, nil
  5615. // {
  5616. // "description": "Lists the Roles defined on a resource.",
  5617. // "flatPath": "v1/roles",
  5618. // "httpMethod": "GET",
  5619. // "id": "iam.roles.list",
  5620. // "parameterOrder": [],
  5621. // "parameters": {
  5622. // "pageSize": {
  5623. // "description": "Optional limit on the number of roles to include in the response.",
  5624. // "format": "int32",
  5625. // "location": "query",
  5626. // "type": "integer"
  5627. // },
  5628. // "pageToken": {
  5629. // "description": "Optional pagination token returned in an earlier ListRolesResponse.",
  5630. // "location": "query",
  5631. // "type": "string"
  5632. // },
  5633. // "parent": {
  5634. // "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}`",
  5635. // "location": "query",
  5636. // "type": "string"
  5637. // },
  5638. // "showDeleted": {
  5639. // "description": "Include Roles that have been deleted.",
  5640. // "location": "query",
  5641. // "type": "boolean"
  5642. // },
  5643. // "view": {
  5644. // "description": "Optional view for the returned Role objects.",
  5645. // "enum": [
  5646. // "BASIC",
  5647. // "FULL"
  5648. // ],
  5649. // "location": "query",
  5650. // "type": "string"
  5651. // }
  5652. // },
  5653. // "path": "v1/roles",
  5654. // "response": {
  5655. // "$ref": "ListRolesResponse"
  5656. // },
  5657. // "scopes": [
  5658. // "https://www.googleapis.com/auth/cloud-platform"
  5659. // ]
  5660. // }
  5661. }
  5662. // Pages invokes f for each page of results.
  5663. // A non-nil error returned from f will halt the iteration.
  5664. // The provided context supersedes any context provided to the Context method.
  5665. func (c *RolesListCall) Pages(ctx context.Context, f func(*ListRolesResponse) error) error {
  5666. c.ctx_ = ctx
  5667. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5668. for {
  5669. x, err := c.Do()
  5670. if err != nil {
  5671. return err
  5672. }
  5673. if err := f(x); err != nil {
  5674. return err
  5675. }
  5676. if x.NextPageToken == "" {
  5677. return nil
  5678. }
  5679. c.PageToken(x.NextPageToken)
  5680. }
  5681. }
  5682. // method id "iam.roles.queryGrantableRoles":
  5683. type RolesQueryGrantableRolesCall struct {
  5684. s *Service
  5685. querygrantablerolesrequest *QueryGrantableRolesRequest
  5686. urlParams_ gensupport.URLParams
  5687. ctx_ context.Context
  5688. header_ http.Header
  5689. }
  5690. // QueryGrantableRoles: Queries roles that can be granted on a
  5691. // particular resource.
  5692. // A role is grantable if it can be used as the role in a binding for a
  5693. // policy
  5694. // for that resource.
  5695. func (r *RolesService) QueryGrantableRoles(querygrantablerolesrequest *QueryGrantableRolesRequest) *RolesQueryGrantableRolesCall {
  5696. c := &RolesQueryGrantableRolesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5697. c.querygrantablerolesrequest = querygrantablerolesrequest
  5698. return c
  5699. }
  5700. // Fields allows partial responses to be retrieved. See
  5701. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5702. // for more information.
  5703. func (c *RolesQueryGrantableRolesCall) Fields(s ...googleapi.Field) *RolesQueryGrantableRolesCall {
  5704. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5705. return c
  5706. }
  5707. // Context sets the context to be used in this call's Do method. Any
  5708. // pending HTTP request will be aborted if the provided context is
  5709. // canceled.
  5710. func (c *RolesQueryGrantableRolesCall) Context(ctx context.Context) *RolesQueryGrantableRolesCall {
  5711. c.ctx_ = ctx
  5712. return c
  5713. }
  5714. // Header returns an http.Header that can be modified by the caller to
  5715. // add HTTP headers to the request.
  5716. func (c *RolesQueryGrantableRolesCall) Header() http.Header {
  5717. if c.header_ == nil {
  5718. c.header_ = make(http.Header)
  5719. }
  5720. return c.header_
  5721. }
  5722. func (c *RolesQueryGrantableRolesCall) doRequest(alt string) (*http.Response, error) {
  5723. reqHeaders := make(http.Header)
  5724. for k, v := range c.header_ {
  5725. reqHeaders[k] = v
  5726. }
  5727. reqHeaders.Set("User-Agent", c.s.userAgent())
  5728. var body io.Reader = nil
  5729. body, err := googleapi.WithoutDataWrapper.JSONReader(c.querygrantablerolesrequest)
  5730. if err != nil {
  5731. return nil, err
  5732. }
  5733. reqHeaders.Set("Content-Type", "application/json")
  5734. c.urlParams_.Set("alt", alt)
  5735. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/roles:queryGrantableRoles")
  5736. urls += "?" + c.urlParams_.Encode()
  5737. req, _ := http.NewRequest("POST", urls, body)
  5738. req.Header = reqHeaders
  5739. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5740. }
  5741. // Do executes the "iam.roles.queryGrantableRoles" call.
  5742. // Exactly one of *QueryGrantableRolesResponse or error will be non-nil.
  5743. // Any non-2xx status code is an error. Response headers are in either
  5744. // *QueryGrantableRolesResponse.ServerResponse.Header or (if a response
  5745. // was returned at all) in error.(*googleapi.Error).Header. Use
  5746. // googleapi.IsNotModified to check whether the returned error was
  5747. // because http.StatusNotModified was returned.
  5748. func (c *RolesQueryGrantableRolesCall) Do(opts ...googleapi.CallOption) (*QueryGrantableRolesResponse, error) {
  5749. gensupport.SetOptions(c.urlParams_, opts...)
  5750. res, err := c.doRequest("json")
  5751. if res != nil && res.StatusCode == http.StatusNotModified {
  5752. if res.Body != nil {
  5753. res.Body.Close()
  5754. }
  5755. return nil, &googleapi.Error{
  5756. Code: res.StatusCode,
  5757. Header: res.Header,
  5758. }
  5759. }
  5760. if err != nil {
  5761. return nil, err
  5762. }
  5763. defer googleapi.CloseBody(res)
  5764. if err := googleapi.CheckResponse(res); err != nil {
  5765. return nil, err
  5766. }
  5767. ret := &QueryGrantableRolesResponse{
  5768. ServerResponse: googleapi.ServerResponse{
  5769. Header: res.Header,
  5770. HTTPStatusCode: res.StatusCode,
  5771. },
  5772. }
  5773. target := &ret
  5774. if err := gensupport.DecodeResponse(target, res); err != nil {
  5775. return nil, err
  5776. }
  5777. return ret, nil
  5778. // {
  5779. // "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.",
  5780. // "flatPath": "v1/roles:queryGrantableRoles",
  5781. // "httpMethod": "POST",
  5782. // "id": "iam.roles.queryGrantableRoles",
  5783. // "parameterOrder": [],
  5784. // "parameters": {},
  5785. // "path": "v1/roles:queryGrantableRoles",
  5786. // "request": {
  5787. // "$ref": "QueryGrantableRolesRequest"
  5788. // },
  5789. // "response": {
  5790. // "$ref": "QueryGrantableRolesResponse"
  5791. // },
  5792. // "scopes": [
  5793. // "https://www.googleapis.com/auth/cloud-platform"
  5794. // ]
  5795. // }
  5796. }
  5797. // Pages invokes f for each page of results.
  5798. // A non-nil error returned from f will halt the iteration.
  5799. // The provided context supersedes any context provided to the Context method.
  5800. func (c *RolesQueryGrantableRolesCall) Pages(ctx context.Context, f func(*QueryGrantableRolesResponse) error) error {
  5801. c.ctx_ = ctx
  5802. defer func(pt string) { c.querygrantablerolesrequest.PageToken = pt }(c.querygrantablerolesrequest.PageToken) // reset paging to original point
  5803. for {
  5804. x, err := c.Do()
  5805. if err != nil {
  5806. return err
  5807. }
  5808. if err := f(x); err != nil {
  5809. return err
  5810. }
  5811. if x.NextPageToken == "" {
  5812. return nil
  5813. }
  5814. c.querygrantablerolesrequest.PageToken = x.NextPageToken
  5815. }
  5816. }