選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

8358 行
288 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package cloudresourcemanager provides access to the Cloud Resource Manager API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/resource-manager
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/cloudresourcemanager/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // cloudresourcemanagerService, err := cloudresourcemanager.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // cloudresourcemanagerService, err := cloudresourcemanager.NewService(ctx, option.WithScopes(cloudresourcemanager.CloudPlatformReadOnlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // cloudresourcemanagerService, err := cloudresourcemanager.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // cloudresourcemanagerService, err := cloudresourcemanager.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package cloudresourcemanager // import "google.golang.org/api/cloudresourcemanager/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "cloudresourcemanager:v1"
  71. const apiName = "cloudresourcemanager"
  72. const apiVersion = "v1"
  73. const basePath = "https://cloudresourcemanager.googleapis.com/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage your data across Google Cloud Platform services
  77. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  78. // View your data across Google Cloud Platform services
  79. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  80. )
  81. // NewService creates a new Service.
  82. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  83. scopesOption := option.WithScopes(
  84. "https://www.googleapis.com/auth/cloud-platform",
  85. "https://www.googleapis.com/auth/cloud-platform.read-only",
  86. )
  87. // NOTE: prepend, so we don't override user-specified scopes.
  88. opts = append([]option.ClientOption{scopesOption}, opts...)
  89. client, endpoint, err := htransport.NewClient(ctx, opts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. s, err := New(client)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if endpoint != "" {
  98. s.BasePath = endpoint
  99. }
  100. return s, nil
  101. }
  102. // New creates a new Service. It uses the provided http.Client for requests.
  103. //
  104. // Deprecated: please use NewService instead.
  105. // To provide a custom HTTP client, use option.WithHTTPClient.
  106. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  107. func New(client *http.Client) (*Service, error) {
  108. if client == nil {
  109. return nil, errors.New("client is nil")
  110. }
  111. s := &Service{client: client, BasePath: basePath}
  112. s.Folders = NewFoldersService(s)
  113. s.Liens = NewLiensService(s)
  114. s.Operations = NewOperationsService(s)
  115. s.Organizations = NewOrganizationsService(s)
  116. s.Projects = NewProjectsService(s)
  117. return s, nil
  118. }
  119. type Service struct {
  120. client *http.Client
  121. BasePath string // API endpoint base URL
  122. UserAgent string // optional additional User-Agent fragment
  123. Folders *FoldersService
  124. Liens *LiensService
  125. Operations *OperationsService
  126. Organizations *OrganizationsService
  127. Projects *ProjectsService
  128. }
  129. func (s *Service) userAgent() string {
  130. if s.UserAgent == "" {
  131. return googleapi.UserAgent
  132. }
  133. return googleapi.UserAgent + " " + s.UserAgent
  134. }
  135. func NewFoldersService(s *Service) *FoldersService {
  136. rs := &FoldersService{s: s}
  137. return rs
  138. }
  139. type FoldersService struct {
  140. s *Service
  141. }
  142. func NewLiensService(s *Service) *LiensService {
  143. rs := &LiensService{s: s}
  144. return rs
  145. }
  146. type LiensService struct {
  147. s *Service
  148. }
  149. func NewOperationsService(s *Service) *OperationsService {
  150. rs := &OperationsService{s: s}
  151. return rs
  152. }
  153. type OperationsService struct {
  154. s *Service
  155. }
  156. func NewOrganizationsService(s *Service) *OrganizationsService {
  157. rs := &OrganizationsService{s: s}
  158. return rs
  159. }
  160. type OrganizationsService struct {
  161. s *Service
  162. }
  163. func NewProjectsService(s *Service) *ProjectsService {
  164. rs := &ProjectsService{s: s}
  165. return rs
  166. }
  167. type ProjectsService struct {
  168. s *Service
  169. }
  170. // Ancestor: Identifying information for a single ancestor of a project.
  171. type Ancestor struct {
  172. // ResourceId: Resource id of the ancestor.
  173. ResourceId *ResourceId `json:"resourceId,omitempty"`
  174. // ForceSendFields is a list of field names (e.g. "ResourceId") to
  175. // unconditionally include in API requests. By default, fields with
  176. // empty values are omitted from API requests. However, any non-pointer,
  177. // non-interface field appearing in ForceSendFields will be sent to the
  178. // server regardless of whether the field is empty or not. This may be
  179. // used to include empty fields in Patch requests.
  180. ForceSendFields []string `json:"-"`
  181. // NullFields is a list of field names (e.g. "ResourceId") to include in
  182. // API requests with the JSON null value. By default, fields with empty
  183. // values are omitted from API requests. However, any field with an
  184. // empty value appearing in NullFields will be sent to the server as
  185. // null. It is an error if a field in this list has a non-empty value.
  186. // This may be used to include null fields in Patch requests.
  187. NullFields []string `json:"-"`
  188. }
  189. func (s *Ancestor) MarshalJSON() ([]byte, error) {
  190. type NoMethod Ancestor
  191. raw := NoMethod(*s)
  192. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  193. }
  194. // AuditConfig: Specifies the audit configuration for a service.
  195. // The configuration determines which permission types are logged, and
  196. // what
  197. // identities, if any, are exempted from logging.
  198. // An AuditConfig must have one or more AuditLogConfigs.
  199. //
  200. // If there are AuditConfigs for both `allServices` and a specific
  201. // service,
  202. // the union of the two AuditConfigs is used for that service: the
  203. // log_types
  204. // specified in each AuditConfig are enabled, and the exempted_members
  205. // in each
  206. // AuditLogConfig are exempted.
  207. //
  208. // Example Policy with multiple AuditConfigs:
  209. //
  210. // {
  211. // "audit_configs": [
  212. // {
  213. // "service": "allServices"
  214. // "audit_log_configs": [
  215. // {
  216. // "log_type": "DATA_READ",
  217. // "exempted_members": [
  218. // "user:foo@gmail.com"
  219. // ]
  220. // },
  221. // {
  222. // "log_type": "DATA_WRITE",
  223. // },
  224. // {
  225. // "log_type": "ADMIN_READ",
  226. // }
  227. // ]
  228. // },
  229. // {
  230. // "service": "fooservice.googleapis.com"
  231. // "audit_log_configs": [
  232. // {
  233. // "log_type": "DATA_READ",
  234. // },
  235. // {
  236. // "log_type": "DATA_WRITE",
  237. // "exempted_members": [
  238. // "user:bar@gmail.com"
  239. // ]
  240. // }
  241. // ]
  242. // }
  243. // ]
  244. // }
  245. //
  246. // For fooservice, this policy enables DATA_READ, DATA_WRITE and
  247. // ADMIN_READ
  248. // logging. It also exempts foo@gmail.com from DATA_READ logging,
  249. // and
  250. // bar@gmail.com from DATA_WRITE logging.
  251. type AuditConfig struct {
  252. // AuditLogConfigs: The configuration for logging of each type of
  253. // permission.
  254. AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
  255. // Service: Specifies a service that will be enabled for audit
  256. // logging.
  257. // For example, `storage.googleapis.com`,
  258. // `cloudsql.googleapis.com`.
  259. // `allServices` is a special value that covers all services.
  260. Service string `json:"service,omitempty"`
  261. // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to
  262. // unconditionally include in API requests. By default, fields with
  263. // empty values are omitted from API requests. However, any non-pointer,
  264. // non-interface field appearing in ForceSendFields will be sent to the
  265. // server regardless of whether the field is empty or not. This may be
  266. // used to include empty fields in Patch requests.
  267. ForceSendFields []string `json:"-"`
  268. // NullFields is a list of field names (e.g. "AuditLogConfigs") to
  269. // include in API requests with the JSON null value. By default, fields
  270. // with empty values are omitted from API requests. However, any field
  271. // with an empty value appearing in NullFields will be sent to the
  272. // server as null. It is an error if a field in this list has a
  273. // non-empty value. This may be used to include null fields in Patch
  274. // requests.
  275. NullFields []string `json:"-"`
  276. }
  277. func (s *AuditConfig) MarshalJSON() ([]byte, error) {
  278. type NoMethod AuditConfig
  279. raw := NoMethod(*s)
  280. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  281. }
  282. // AuditLogConfig: Provides the configuration for logging a type of
  283. // permissions.
  284. // Example:
  285. //
  286. // {
  287. // "audit_log_configs": [
  288. // {
  289. // "log_type": "DATA_READ",
  290. // "exempted_members": [
  291. // "user:foo@gmail.com"
  292. // ]
  293. // },
  294. // {
  295. // "log_type": "DATA_WRITE",
  296. // }
  297. // ]
  298. // }
  299. //
  300. // This enables 'DATA_READ' and 'DATA_WRITE' logging, while
  301. // exempting
  302. // foo@gmail.com from DATA_READ logging.
  303. type AuditLogConfig struct {
  304. // ExemptedMembers: Specifies the identities that do not cause logging
  305. // for this type of
  306. // permission.
  307. // Follows the same format of Binding.members.
  308. ExemptedMembers []string `json:"exemptedMembers,omitempty"`
  309. // LogType: The log type that this config enables.
  310. //
  311. // Possible values:
  312. // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this.
  313. // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy
  314. // "DATA_WRITE" - Data writes. Example: CloudSQL Users create
  315. // "DATA_READ" - Data reads. Example: CloudSQL Users list
  316. LogType string `json:"logType,omitempty"`
  317. // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to
  318. // unconditionally include in API requests. By default, fields with
  319. // empty values are omitted from API requests. However, any non-pointer,
  320. // non-interface field appearing in ForceSendFields will be sent to the
  321. // server regardless of whether the field is empty or not. This may be
  322. // used to include empty fields in Patch requests.
  323. ForceSendFields []string `json:"-"`
  324. // NullFields is a list of field names (e.g. "ExemptedMembers") to
  325. // include in API requests with the JSON null value. By default, fields
  326. // with empty values are omitted from API requests. However, any field
  327. // with an empty value appearing in NullFields will be sent to the
  328. // server as null. It is an error if a field in this list has a
  329. // non-empty value. This may be used to include null fields in Patch
  330. // requests.
  331. NullFields []string `json:"-"`
  332. }
  333. func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
  334. type NoMethod AuditLogConfig
  335. raw := NoMethod(*s)
  336. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  337. }
  338. // Binding: Associates `members` with a `role`.
  339. type Binding struct {
  340. // Condition: Unimplemented. The condition that is associated with this
  341. // binding.
  342. // NOTE: an unsatisfied condition will not allow user access via
  343. // current
  344. // binding. Different bindings, including their conditions, are
  345. // examined
  346. // independently.
  347. Condition *Expr `json:"condition,omitempty"`
  348. // Members: Specifies the identities requesting access for a Cloud
  349. // Platform resource.
  350. // `members` can have the following values:
  351. //
  352. // * `allUsers`: A special identifier that represents anyone who is
  353. // on the internet; with or without a Google account.
  354. //
  355. // * `allAuthenticatedUsers`: A special identifier that represents
  356. // anyone
  357. // who is authenticated with a Google account or a service
  358. // account.
  359. //
  360. // * `user:{emailid}`: An email address that represents a specific
  361. // Google
  362. // account. For example, `alice@gmail.com` .
  363. //
  364. //
  365. // * `serviceAccount:{emailid}`: An email address that represents a
  366. // service
  367. // account. For example,
  368. // `my-other-app@appspot.gserviceaccount.com`.
  369. //
  370. // * `group:{emailid}`: An email address that represents a Google
  371. // group.
  372. // For example, `admins@example.com`.
  373. //
  374. //
  375. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  376. // the
  377. // users of that domain. For example, `google.com` or
  378. // `example.com`.
  379. //
  380. //
  381. Members []string `json:"members,omitempty"`
  382. // Role: Role that is assigned to `members`.
  383. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  384. Role string `json:"role,omitempty"`
  385. // ForceSendFields is a list of field names (e.g. "Condition") to
  386. // unconditionally include in API requests. By default, fields with
  387. // empty values are omitted from API requests. However, any non-pointer,
  388. // non-interface field appearing in ForceSendFields will be sent to the
  389. // server regardless of whether the field is empty or not. This may be
  390. // used to include empty fields in Patch requests.
  391. ForceSendFields []string `json:"-"`
  392. // NullFields is a list of field names (e.g. "Condition") to include in
  393. // API requests with the JSON null value. By default, fields with empty
  394. // values are omitted from API requests. However, any field with an
  395. // empty value appearing in NullFields will be sent to the server as
  396. // null. It is an error if a field in this list has a non-empty value.
  397. // This may be used to include null fields in Patch requests.
  398. NullFields []string `json:"-"`
  399. }
  400. func (s *Binding) MarshalJSON() ([]byte, error) {
  401. type NoMethod Binding
  402. raw := NoMethod(*s)
  403. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  404. }
  405. // BooleanConstraint: A `Constraint` that is either enforced or
  406. // not.
  407. //
  408. // For example a constraint
  409. // `constraints/compute.disableSerialPortAccess`.
  410. // If it is enforced on a VM instance, serial port connections will not
  411. // be
  412. // opened to that instance.
  413. type BooleanConstraint struct {
  414. }
  415. // BooleanPolicy: Used in `policy_type` to specify how `boolean_policy`
  416. // will behave at this
  417. // resource.
  418. type BooleanPolicy struct {
  419. // Enforced: If `true`, then the `Policy` is enforced. If `false`, then
  420. // any
  421. // configuration is acceptable.
  422. //
  423. // Suppose you have a
  424. // `Constraint`
  425. // `constraints/compute.disableSerialPortAccess` with
  426. // `constraint_default`
  427. // set to `ALLOW`. A `Policy` for that `Constraint` exhibits the
  428. // following
  429. // behavior:
  430. // - If the `Policy` at this resource has enforced set to `false`,
  431. // serial
  432. // port connection attempts will be allowed.
  433. // - If the `Policy` at this resource has enforced set to `true`,
  434. // serial
  435. // port connection attempts will be refused.
  436. // - If the `Policy` at this resource is `RestoreDefault`, serial
  437. // port
  438. // connection attempts will be allowed.
  439. // - If no `Policy` is set at this resource or anywhere higher in the
  440. // resource hierarchy, serial port connection attempts will be
  441. // allowed.
  442. // - If no `Policy` is set at this resource, but one exists higher in
  443. // the
  444. // resource hierarchy, the behavior is as if the`Policy` were set
  445. // at
  446. // this resource.
  447. //
  448. // The following examples demonstrate the different possible
  449. // layerings:
  450. //
  451. // Example 1 (nearest `Constraint` wins):
  452. // `organizations/foo` has a `Policy` with:
  453. // {enforced: false}
  454. // `projects/bar` has no `Policy` set.
  455. // The constraint at `projects/bar` and `organizations/foo` will not
  456. // be
  457. // enforced.
  458. //
  459. // Example 2 (enforcement gets replaced):
  460. // `organizations/foo` has a `Policy` with:
  461. // {enforced: false}
  462. // `projects/bar` has a `Policy` with:
  463. // {enforced: true}
  464. // The constraint at `organizations/foo` is not enforced.
  465. // The constraint at `projects/bar` is enforced.
  466. //
  467. // Example 3 (RestoreDefault):
  468. // `organizations/foo` has a `Policy` with:
  469. // {enforced: true}
  470. // `projects/bar` has a `Policy` with:
  471. // {RestoreDefault: {}}
  472. // The constraint at `organizations/foo` is enforced.
  473. // The constraint at `projects/bar` is not enforced,
  474. // because
  475. // `constraint_default` for the `Constraint` is `ALLOW`.
  476. Enforced bool `json:"enforced,omitempty"`
  477. // ForceSendFields is a list of field names (e.g. "Enforced") to
  478. // unconditionally include in API requests. By default, fields with
  479. // empty values are omitted from API requests. However, any non-pointer,
  480. // non-interface field appearing in ForceSendFields will be sent to the
  481. // server regardless of whether the field is empty or not. This may be
  482. // used to include empty fields in Patch requests.
  483. ForceSendFields []string `json:"-"`
  484. // NullFields is a list of field names (e.g. "Enforced") to include in
  485. // API requests with the JSON null value. By default, fields with empty
  486. // values are omitted from API requests. However, any field with an
  487. // empty value appearing in NullFields will be sent to the server as
  488. // null. It is an error if a field in this list has a non-empty value.
  489. // This may be used to include null fields in Patch requests.
  490. NullFields []string `json:"-"`
  491. }
  492. func (s *BooleanPolicy) MarshalJSON() ([]byte, error) {
  493. type NoMethod BooleanPolicy
  494. raw := NoMethod(*s)
  495. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  496. }
  497. // ClearOrgPolicyRequest: The request sent to the ClearOrgPolicy method.
  498. type ClearOrgPolicyRequest struct {
  499. // Constraint: Name of the `Constraint` of the `Policy` to clear.
  500. Constraint string `json:"constraint,omitempty"`
  501. // Etag: The current version, for concurrency control. Not sending an
  502. // `etag`
  503. // will cause the `Policy` to be cleared blindly.
  504. Etag string `json:"etag,omitempty"`
  505. // ForceSendFields is a list of field names (e.g. "Constraint") to
  506. // unconditionally include in API requests. By default, fields with
  507. // empty values are omitted from API requests. However, any non-pointer,
  508. // non-interface field appearing in ForceSendFields will be sent to the
  509. // server regardless of whether the field is empty or not. This may be
  510. // used to include empty fields in Patch requests.
  511. ForceSendFields []string `json:"-"`
  512. // NullFields is a list of field names (e.g. "Constraint") to include in
  513. // API requests with the JSON null value. By default, fields with empty
  514. // values are omitted from API requests. However, any field with an
  515. // empty value appearing in NullFields will be sent to the server as
  516. // null. It is an error if a field in this list has a non-empty value.
  517. // This may be used to include null fields in Patch requests.
  518. NullFields []string `json:"-"`
  519. }
  520. func (s *ClearOrgPolicyRequest) MarshalJSON() ([]byte, error) {
  521. type NoMethod ClearOrgPolicyRequest
  522. raw := NoMethod(*s)
  523. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  524. }
  525. // Constraint: A `Constraint` describes a way in which a resource's
  526. // configuration can be
  527. // restricted. For example, it controls which cloud services can be
  528. // activated
  529. // across an organization, or whether a Compute Engine instance can
  530. // have
  531. // serial port connections established. `Constraints` can be configured
  532. // by the
  533. // organization's policy adminstrator to fit the needs of the
  534. // organzation by
  535. // setting Policies for `Constraints` at different locations in
  536. // the
  537. // organization's resource hierarchy. Policies are inherited down the
  538. // resource
  539. // hierarchy from higher levels, but can also be overridden. For details
  540. // about
  541. // the inheritance rules please read about
  542. // Policies.
  543. //
  544. // `Constraints` have a default behavior determined by the
  545. // `constraint_default`
  546. // field, which is the enforcement behavior that is used in the absence
  547. // of a
  548. // `Policy` being defined or inherited for the resource in question.
  549. type Constraint struct {
  550. // BooleanConstraint: Defines this constraint as being a
  551. // BooleanConstraint.
  552. BooleanConstraint *BooleanConstraint `json:"booleanConstraint,omitempty"`
  553. // ConstraintDefault: The evaluation behavior of this constraint in the
  554. // absense of 'Policy'.
  555. //
  556. // Possible values:
  557. // "CONSTRAINT_DEFAULT_UNSPECIFIED" - This is only used for
  558. // distinguishing unset values and should never be
  559. // used.
  560. // "ALLOW" - Indicate that all values are allowed for list
  561. // constraints.
  562. // Indicate that enforcement is off for boolean constraints.
  563. // "DENY" - Indicate that all values are denied for list
  564. // constraints.
  565. // Indicate that enforcement is on for boolean constraints.
  566. ConstraintDefault string `json:"constraintDefault,omitempty"`
  567. // Description: Detailed description of what this `Constraint` controls
  568. // as well as how and
  569. // where it is enforced.
  570. //
  571. // Mutable.
  572. Description string `json:"description,omitempty"`
  573. // DisplayName: The human readable name.
  574. //
  575. // Mutable.
  576. DisplayName string `json:"displayName,omitempty"`
  577. // ListConstraint: Defines this constraint as being a ListConstraint.
  578. ListConstraint *ListConstraint `json:"listConstraint,omitempty"`
  579. // Name: Immutable value, required to globally be unique. For
  580. // example,
  581. // `constraints/serviceuser.services`
  582. Name string `json:"name,omitempty"`
  583. // Version: Version of the `Constraint`. Default version is 0;
  584. Version int64 `json:"version,omitempty"`
  585. // ForceSendFields is a list of field names (e.g. "BooleanConstraint")
  586. // to 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. "BooleanConstraint") to
  593. // include in API requests with the JSON null value. By default, fields
  594. // with empty values are omitted from API requests. However, any field
  595. // with an empty value appearing in NullFields will be sent to the
  596. // server as null. It is an error if a field in this list has a
  597. // non-empty value. This may be used to include null fields in Patch
  598. // requests.
  599. NullFields []string `json:"-"`
  600. }
  601. func (s *Constraint) MarshalJSON() ([]byte, error) {
  602. type NoMethod Constraint
  603. raw := NoMethod(*s)
  604. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  605. }
  606. // Empty: A generic empty message that you can re-use to avoid defining
  607. // duplicated
  608. // empty messages in your APIs. A typical example is to use it as the
  609. // request
  610. // or the response type of an API method. For instance:
  611. //
  612. // service Foo {
  613. // rpc Bar(google.protobuf.Empty) returns
  614. // (google.protobuf.Empty);
  615. // }
  616. //
  617. // The JSON representation for `Empty` is empty JSON object `{}`.
  618. type Empty struct {
  619. // ServerResponse contains the HTTP response code and headers from the
  620. // server.
  621. googleapi.ServerResponse `json:"-"`
  622. }
  623. // Expr: Represents an expression text. Example:
  624. //
  625. // title: "User account presence"
  626. // description: "Determines whether the request has a user account"
  627. // expression: "size(request.user) > 0"
  628. type Expr struct {
  629. // Description: An optional description of the expression. This is a
  630. // longer text which
  631. // describes the expression, e.g. when hovered over it in a UI.
  632. Description string `json:"description,omitempty"`
  633. // Expression: Textual representation of an expression in
  634. // Common Expression Language syntax.
  635. //
  636. // The application context of the containing message determines
  637. // which
  638. // well-known feature set of CEL is supported.
  639. Expression string `json:"expression,omitempty"`
  640. // Location: An optional string indicating the location of the
  641. // expression for error
  642. // reporting, e.g. a file name and a position in the file.
  643. Location string `json:"location,omitempty"`
  644. // Title: An optional title for the expression, i.e. a short string
  645. // describing
  646. // its purpose. This can be used e.g. in UIs which allow to enter
  647. // the
  648. // expression.
  649. Title string `json:"title,omitempty"`
  650. // ForceSendFields is a list of field names (e.g. "Description") to
  651. // unconditionally include in API requests. By default, fields with
  652. // empty values are omitted from API requests. However, any non-pointer,
  653. // non-interface field appearing in ForceSendFields will be sent to the
  654. // server regardless of whether the field is empty or not. This may be
  655. // used to include empty fields in Patch requests.
  656. ForceSendFields []string `json:"-"`
  657. // NullFields is a list of field names (e.g. "Description") to include
  658. // in API requests with the JSON null value. By default, fields with
  659. // empty values are omitted from API requests. However, any field with
  660. // an empty value appearing in NullFields will be sent to the server as
  661. // null. It is an error if a field in this list has a non-empty value.
  662. // This may be used to include null fields in Patch requests.
  663. NullFields []string `json:"-"`
  664. }
  665. func (s *Expr) MarshalJSON() ([]byte, error) {
  666. type NoMethod Expr
  667. raw := NoMethod(*s)
  668. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  669. }
  670. // FolderOperation: Metadata describing a long running folder operation
  671. type FolderOperation struct {
  672. // DestinationParent: The resource name of the folder or organization we
  673. // are either creating
  674. // the folder under or moving the folder to.
  675. DestinationParent string `json:"destinationParent,omitempty"`
  676. // DisplayName: The display name of the folder.
  677. DisplayName string `json:"displayName,omitempty"`
  678. // OperationType: The type of this operation.
  679. //
  680. // Possible values:
  681. // "OPERATION_TYPE_UNSPECIFIED" - Operation type not specified.
  682. // "CREATE" - A create folder operation.
  683. // "MOVE" - A move folder operation.
  684. OperationType string `json:"operationType,omitempty"`
  685. // SourceParent: The resource name of the folder's parent.
  686. // Only applicable when the operation_type is MOVE.
  687. SourceParent string `json:"sourceParent,omitempty"`
  688. // ForceSendFields is a list of field names (e.g. "DestinationParent")
  689. // to unconditionally include in API requests. By default, fields with
  690. // empty values are omitted from API requests. However, any non-pointer,
  691. // non-interface field appearing in ForceSendFields will be sent to the
  692. // server regardless of whether the field is empty or not. This may be
  693. // used to include empty fields in Patch requests.
  694. ForceSendFields []string `json:"-"`
  695. // NullFields is a list of field names (e.g. "DestinationParent") to
  696. // include in API requests with the JSON null value. By default, fields
  697. // with empty values are omitted from API requests. However, any field
  698. // with an empty value appearing in NullFields will be sent to the
  699. // server as null. It is an error if a field in this list has a
  700. // non-empty value. This may be used to include null fields in Patch
  701. // requests.
  702. NullFields []string `json:"-"`
  703. }
  704. func (s *FolderOperation) MarshalJSON() ([]byte, error) {
  705. type NoMethod FolderOperation
  706. raw := NoMethod(*s)
  707. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  708. }
  709. // FolderOperationError: A classification of the Folder Operation error.
  710. type FolderOperationError struct {
  711. // ErrorMessageId: The type of operation error experienced.
  712. //
  713. // Possible values:
  714. // "ERROR_TYPE_UNSPECIFIED" - The error type was unrecognized or
  715. // unspecified.
  716. // "ACTIVE_FOLDER_HEIGHT_VIOLATION" - The attempted action would
  717. // violate the max folder depth constraint.
  718. // "MAX_CHILD_FOLDERS_VIOLATION" - The attempted action would violate
  719. // the max child folders constraint.
  720. // "FOLDER_NAME_UNIQUENESS_VIOLATION" - The attempted action would
  721. // violate the locally-unique folder
  722. // display_name constraint.
  723. // "RESOURCE_DELETED_VIOLATION" - The resource being moved has been
  724. // deleted.
  725. // "PARENT_DELETED_VIOLATION" - The resource a folder was being added
  726. // to has been deleted.
  727. // "CYCLE_INTRODUCED_VIOLATION" - The attempted action would introduce
  728. // cycle in resource path.
  729. // "FOLDER_BEING_MOVED_VIOLATION" - The attempted action would move a
  730. // folder that is already being moved.
  731. // "FOLDER_TO_DELETE_NON_EMPTY_VIOLATION" - The folder the caller is
  732. // trying to delete contains active resources.
  733. // "DELETED_FOLDER_HEIGHT_VIOLATION" - The attempted action would
  734. // violate the max deleted folder depth
  735. // constraint.
  736. ErrorMessageId string `json:"errorMessageId,omitempty"`
  737. // ForceSendFields is a list of field names (e.g. "ErrorMessageId") to
  738. // unconditionally include in API requests. By default, fields with
  739. // empty values are omitted from API requests. However, any non-pointer,
  740. // non-interface field appearing in ForceSendFields will be sent to the
  741. // server regardless of whether the field is empty or not. This may be
  742. // used to include empty fields in Patch requests.
  743. ForceSendFields []string `json:"-"`
  744. // NullFields is a list of field names (e.g. "ErrorMessageId") to
  745. // include in API requests with the JSON null value. By default, fields
  746. // with empty values are omitted from API requests. However, any field
  747. // with an empty value appearing in NullFields will be sent to the
  748. // server as null. It is an error if a field in this list has a
  749. // non-empty value. This may be used to include null fields in Patch
  750. // requests.
  751. NullFields []string `json:"-"`
  752. }
  753. func (s *FolderOperationError) MarshalJSON() ([]byte, error) {
  754. type NoMethod FolderOperationError
  755. raw := NoMethod(*s)
  756. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  757. }
  758. // GetAncestryRequest: The request sent to the
  759. // GetAncestry
  760. // method.
  761. type GetAncestryRequest struct {
  762. }
  763. // GetAncestryResponse: Response from the GetAncestry method.
  764. type GetAncestryResponse struct {
  765. // Ancestor: Ancestors are ordered from bottom to top of the resource
  766. // hierarchy. The
  767. // first ancestor is the project itself, followed by the project's
  768. // parent,
  769. // etc..
  770. Ancestor []*Ancestor `json:"ancestor,omitempty"`
  771. // ServerResponse contains the HTTP response code and headers from the
  772. // server.
  773. googleapi.ServerResponse `json:"-"`
  774. // ForceSendFields is a list of field names (e.g. "Ancestor") to
  775. // unconditionally include in API requests. By default, fields with
  776. // empty values are omitted from API requests. However, any non-pointer,
  777. // non-interface field appearing in ForceSendFields will be sent to the
  778. // server regardless of whether the field is empty or not. This may be
  779. // used to include empty fields in Patch requests.
  780. ForceSendFields []string `json:"-"`
  781. // NullFields is a list of field names (e.g. "Ancestor") to include in
  782. // API requests with the JSON null value. By default, fields with empty
  783. // values are omitted from API requests. However, any field with an
  784. // empty value appearing in NullFields will be sent to the server as
  785. // null. It is an error if a field in this list has a non-empty value.
  786. // This may be used to include null fields in Patch requests.
  787. NullFields []string `json:"-"`
  788. }
  789. func (s *GetAncestryResponse) MarshalJSON() ([]byte, error) {
  790. type NoMethod GetAncestryResponse
  791. raw := NoMethod(*s)
  792. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  793. }
  794. // GetEffectiveOrgPolicyRequest: The request sent to the
  795. // GetEffectiveOrgPolicy method.
  796. type GetEffectiveOrgPolicyRequest struct {
  797. // Constraint: The name of the `Constraint` to compute the effective
  798. // `Policy`.
  799. Constraint string `json:"constraint,omitempty"`
  800. // ForceSendFields is a list of field names (e.g. "Constraint") to
  801. // unconditionally include in API requests. By default, fields with
  802. // empty values are omitted from API requests. However, any non-pointer,
  803. // non-interface field appearing in ForceSendFields will be sent to the
  804. // server regardless of whether the field is empty or not. This may be
  805. // used to include empty fields in Patch requests.
  806. ForceSendFields []string `json:"-"`
  807. // NullFields is a list of field names (e.g. "Constraint") to include in
  808. // API requests with the JSON null value. By default, fields with empty
  809. // values are omitted from API requests. However, any field with an
  810. // empty value appearing in NullFields will be sent to the server as
  811. // null. It is an error if a field in this list has a non-empty value.
  812. // This may be used to include null fields in Patch requests.
  813. NullFields []string `json:"-"`
  814. }
  815. func (s *GetEffectiveOrgPolicyRequest) MarshalJSON() ([]byte, error) {
  816. type NoMethod GetEffectiveOrgPolicyRequest
  817. raw := NoMethod(*s)
  818. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  819. }
  820. // GetIamPolicyRequest: Request message for `GetIamPolicy` method.
  821. type GetIamPolicyRequest struct {
  822. }
  823. // GetOrgPolicyRequest: The request sent to the GetOrgPolicy method.
  824. type GetOrgPolicyRequest struct {
  825. // Constraint: Name of the `Constraint` to get the `Policy`.
  826. Constraint string `json:"constraint,omitempty"`
  827. // ForceSendFields is a list of field names (e.g. "Constraint") to
  828. // unconditionally include in API requests. By default, fields with
  829. // empty values are omitted from API requests. However, any non-pointer,
  830. // non-interface field appearing in ForceSendFields will be sent to the
  831. // server regardless of whether the field is empty or not. This may be
  832. // used to include empty fields in Patch requests.
  833. ForceSendFields []string `json:"-"`
  834. // NullFields is a list of field names (e.g. "Constraint") to include in
  835. // API requests with the JSON null value. By default, fields with empty
  836. // values are omitted from API requests. However, any field with an
  837. // empty value appearing in NullFields will be sent to the server as
  838. // null. It is an error if a field in this list has a non-empty value.
  839. // This may be used to include null fields in Patch requests.
  840. NullFields []string `json:"-"`
  841. }
  842. func (s *GetOrgPolicyRequest) MarshalJSON() ([]byte, error) {
  843. type NoMethod GetOrgPolicyRequest
  844. raw := NoMethod(*s)
  845. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  846. }
  847. // Lien: A Lien represents an encumbrance on the actions that can be
  848. // performed on a
  849. // resource.
  850. type Lien struct {
  851. // CreateTime: The creation time of this Lien.
  852. CreateTime string `json:"createTime,omitempty"`
  853. // Name: A system-generated unique identifier for this Lien.
  854. //
  855. // Example: `liens/1234abcd`
  856. Name string `json:"name,omitempty"`
  857. // Origin: A stable, user-visible/meaningful string identifying the
  858. // origin of the
  859. // Lien, intended to be inspected programmatically. Maximum length of
  860. // 200
  861. // characters.
  862. //
  863. // Example: 'compute.googleapis.com'
  864. Origin string `json:"origin,omitempty"`
  865. // Parent: A reference to the resource this Lien is attached to. The
  866. // server will
  867. // validate the parent against those for which Liens are
  868. // supported.
  869. //
  870. // Example: `projects/1234`
  871. Parent string `json:"parent,omitempty"`
  872. // Reason: Concise user-visible strings indicating why an action cannot
  873. // be performed
  874. // on a resource. Maximum length of 200 characters.
  875. //
  876. // Example: 'Holds production API key'
  877. Reason string `json:"reason,omitempty"`
  878. // Restrictions: The types of operations which should be blocked as a
  879. // result of this Lien.
  880. // Each value should correspond to an IAM permission. The server
  881. // will
  882. // validate the permissions against those for which Liens are
  883. // supported.
  884. //
  885. // An empty list is meaningless and will be rejected.
  886. //
  887. // Example: ['resourcemanager.projects.delete']
  888. Restrictions []string `json:"restrictions,omitempty"`
  889. // ServerResponse contains the HTTP response code and headers from the
  890. // server.
  891. googleapi.ServerResponse `json:"-"`
  892. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  893. // unconditionally include in API requests. By default, fields with
  894. // empty values are omitted from API requests. However, any non-pointer,
  895. // non-interface field appearing in ForceSendFields will be sent to the
  896. // server regardless of whether the field is empty or not. This may be
  897. // used to include empty fields in Patch requests.
  898. ForceSendFields []string `json:"-"`
  899. // NullFields is a list of field names (e.g. "CreateTime") to include in
  900. // API requests with the JSON null value. By default, fields with empty
  901. // values are omitted from API requests. However, any field with an
  902. // empty value appearing in NullFields will be sent to the server as
  903. // null. It is an error if a field in this list has a non-empty value.
  904. // This may be used to include null fields in Patch requests.
  905. NullFields []string `json:"-"`
  906. }
  907. func (s *Lien) MarshalJSON() ([]byte, error) {
  908. type NoMethod Lien
  909. raw := NoMethod(*s)
  910. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  911. }
  912. // ListAvailableOrgPolicyConstraintsRequest: The request sent to the
  913. // [ListAvailableOrgPolicyConstraints]
  914. // google.cloud.OrgPolicy.v1.ListAvai
  915. // lableOrgPolicyConstraints] method.
  916. type ListAvailableOrgPolicyConstraintsRequest struct {
  917. // PageSize: Size of the pages to be returned. This is currently
  918. // unsupported and will
  919. // be ignored. The server may at any point start using this field to
  920. // limit
  921. // page size.
  922. PageSize int64 `json:"pageSize,omitempty"`
  923. // PageToken: Page token used to retrieve the next page. This is
  924. // currently unsupported
  925. // and will be ignored. The server may at any point start using this
  926. // field.
  927. PageToken string `json:"pageToken,omitempty"`
  928. // ForceSendFields is a list of field names (e.g. "PageSize") to
  929. // unconditionally include in API requests. By default, fields with
  930. // empty values are omitted from API requests. However, any non-pointer,
  931. // non-interface field appearing in ForceSendFields will be sent to the
  932. // server regardless of whether the field is empty or not. This may be
  933. // used to include empty fields in Patch requests.
  934. ForceSendFields []string `json:"-"`
  935. // NullFields is a list of field names (e.g. "PageSize") to include in
  936. // API requests with the JSON null value. By default, fields with empty
  937. // values are omitted from API requests. However, any field with an
  938. // empty value appearing in NullFields will be sent to the server as
  939. // null. It is an error if a field in this list has a non-empty value.
  940. // This may be used to include null fields in Patch requests.
  941. NullFields []string `json:"-"`
  942. }
  943. func (s *ListAvailableOrgPolicyConstraintsRequest) MarshalJSON() ([]byte, error) {
  944. type NoMethod ListAvailableOrgPolicyConstraintsRequest
  945. raw := NoMethod(*s)
  946. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  947. }
  948. // ListAvailableOrgPolicyConstraintsResponse: The response returned from
  949. // the ListAvailableOrgPolicyConstraints method.
  950. // Returns all `Constraints` that could be set at this level of the
  951. // hierarchy
  952. // (contrast with the response from `ListPolicies`, which returns all
  953. // policies
  954. // which are set).
  955. type ListAvailableOrgPolicyConstraintsResponse struct {
  956. // Constraints: The collection of constraints that are settable on the
  957. // request resource.
  958. Constraints []*Constraint `json:"constraints,omitempty"`
  959. // NextPageToken: Page token used to retrieve the next page. This is
  960. // currently not used.
  961. NextPageToken string `json:"nextPageToken,omitempty"`
  962. // ServerResponse contains the HTTP response code and headers from the
  963. // server.
  964. googleapi.ServerResponse `json:"-"`
  965. // ForceSendFields is a list of field names (e.g. "Constraints") to
  966. // unconditionally include in API requests. By default, fields with
  967. // empty values are omitted from API requests. However, any non-pointer,
  968. // non-interface field appearing in ForceSendFields will be sent to the
  969. // server regardless of whether the field is empty or not. This may be
  970. // used to include empty fields in Patch requests.
  971. ForceSendFields []string `json:"-"`
  972. // NullFields is a list of field names (e.g. "Constraints") to include
  973. // in API requests with the JSON null value. By default, fields with
  974. // empty values are omitted from API requests. However, any field with
  975. // an empty value appearing in NullFields will be sent to the server as
  976. // null. It is an error if a field in this list has a non-empty value.
  977. // This may be used to include null fields in Patch requests.
  978. NullFields []string `json:"-"`
  979. }
  980. func (s *ListAvailableOrgPolicyConstraintsResponse) MarshalJSON() ([]byte, error) {
  981. type NoMethod ListAvailableOrgPolicyConstraintsResponse
  982. raw := NoMethod(*s)
  983. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  984. }
  985. // ListConstraint: A `Constraint` that allows or disallows a list of
  986. // string values, which are
  987. // configured by an Organization's policy administrator with a `Policy`.
  988. type ListConstraint struct {
  989. // SuggestedValue: Optional. The Google Cloud Console will try to
  990. // default to a configuration
  991. // that matches the value specified in this `Constraint`.
  992. SuggestedValue string `json:"suggestedValue,omitempty"`
  993. // SupportsUnder: Indicates whether subtrees of Cloud Resource Manager
  994. // resource hierarchy
  995. // can be used in `Policy.allowed_values` and `Policy.denied_values`.
  996. // For
  997. // example, "under:folders/123" would match any resource under
  998. // the
  999. // 'folders/123' folder.
  1000. SupportsUnder bool `json:"supportsUnder,omitempty"`
  1001. // ForceSendFields is a list of field names (e.g. "SuggestedValue") to
  1002. // unconditionally include in API requests. By default, fields with
  1003. // empty values are omitted from API requests. However, any non-pointer,
  1004. // non-interface field appearing in ForceSendFields will be sent to the
  1005. // server regardless of whether the field is empty or not. This may be
  1006. // used to include empty fields in Patch requests.
  1007. ForceSendFields []string `json:"-"`
  1008. // NullFields is a list of field names (e.g. "SuggestedValue") to
  1009. // include in API requests with the JSON null value. By default, fields
  1010. // with empty values are omitted from API requests. However, any field
  1011. // with an empty value appearing in NullFields will be sent to the
  1012. // server as null. It is an error if a field in this list has a
  1013. // non-empty value. This may be used to include null fields in Patch
  1014. // requests.
  1015. NullFields []string `json:"-"`
  1016. }
  1017. func (s *ListConstraint) MarshalJSON() ([]byte, error) {
  1018. type NoMethod ListConstraint
  1019. raw := NoMethod(*s)
  1020. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1021. }
  1022. // ListLiensResponse: The response message for Liens.ListLiens.
  1023. type ListLiensResponse struct {
  1024. // Liens: A list of Liens.
  1025. Liens []*Lien `json:"liens,omitempty"`
  1026. // NextPageToken: Token to retrieve the next page of results, or empty
  1027. // if there are no more
  1028. // results in the list.
  1029. NextPageToken string `json:"nextPageToken,omitempty"`
  1030. // ServerResponse contains the HTTP response code and headers from the
  1031. // server.
  1032. googleapi.ServerResponse `json:"-"`
  1033. // ForceSendFields is a list of field names (e.g. "Liens") to
  1034. // unconditionally include in API requests. By default, fields with
  1035. // empty values are omitted from API requests. However, any non-pointer,
  1036. // non-interface field appearing in ForceSendFields will be sent to the
  1037. // server regardless of whether the field is empty or not. This may be
  1038. // used to include empty fields in Patch requests.
  1039. ForceSendFields []string `json:"-"`
  1040. // NullFields is a list of field names (e.g. "Liens") to include in API
  1041. // requests with the JSON null value. By default, fields with empty
  1042. // values are omitted from API requests. However, any field with an
  1043. // empty value appearing in NullFields will be sent to the server as
  1044. // null. It is an error if a field in this list has a non-empty value.
  1045. // This may be used to include null fields in Patch requests.
  1046. NullFields []string `json:"-"`
  1047. }
  1048. func (s *ListLiensResponse) MarshalJSON() ([]byte, error) {
  1049. type NoMethod ListLiensResponse
  1050. raw := NoMethod(*s)
  1051. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1052. }
  1053. // ListOrgPoliciesRequest: The request sent to the ListOrgPolicies
  1054. // method.
  1055. type ListOrgPoliciesRequest struct {
  1056. // PageSize: Size of the pages to be returned. This is currently
  1057. // unsupported and will
  1058. // be ignored. The server may at any point start using this field to
  1059. // limit
  1060. // page size.
  1061. PageSize int64 `json:"pageSize,omitempty"`
  1062. // PageToken: Page token used to retrieve the next page. This is
  1063. // currently unsupported
  1064. // and will be ignored. The server may at any point start using this
  1065. // field.
  1066. PageToken string `json:"pageToken,omitempty"`
  1067. // ForceSendFields is a list of field names (e.g. "PageSize") to
  1068. // unconditionally include in API requests. By default, fields with
  1069. // empty values are omitted from API requests. However, any non-pointer,
  1070. // non-interface field appearing in ForceSendFields will be sent to the
  1071. // server regardless of whether the field is empty or not. This may be
  1072. // used to include empty fields in Patch requests.
  1073. ForceSendFields []string `json:"-"`
  1074. // NullFields is a list of field names (e.g. "PageSize") to include in
  1075. // API requests with the JSON null value. By default, fields with empty
  1076. // values are omitted from API requests. However, any field with an
  1077. // empty value appearing in NullFields will be sent to the server as
  1078. // null. It is an error if a field in this list has a non-empty value.
  1079. // This may be used to include null fields in Patch requests.
  1080. NullFields []string `json:"-"`
  1081. }
  1082. func (s *ListOrgPoliciesRequest) MarshalJSON() ([]byte, error) {
  1083. type NoMethod ListOrgPoliciesRequest
  1084. raw := NoMethod(*s)
  1085. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1086. }
  1087. // ListOrgPoliciesResponse: The response returned from the
  1088. // ListOrgPolicies method. It will be empty
  1089. // if no `Policies` are set on the resource.
  1090. type ListOrgPoliciesResponse struct {
  1091. // NextPageToken: Page token used to retrieve the next page. This is
  1092. // currently not used, but
  1093. // the server may at any point start supplying a valid token.
  1094. NextPageToken string `json:"nextPageToken,omitempty"`
  1095. // Policies: The `Policies` that are set on the resource. It will be
  1096. // empty if no
  1097. // `Policies` are set.
  1098. Policies []*OrgPolicy `json:"policies,omitempty"`
  1099. // ServerResponse contains the HTTP response code and headers from the
  1100. // server.
  1101. googleapi.ServerResponse `json:"-"`
  1102. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1103. // unconditionally include in API requests. By default, fields with
  1104. // empty values are omitted from API requests. However, any non-pointer,
  1105. // non-interface field appearing in ForceSendFields will be sent to the
  1106. // server regardless of whether the field is empty or not. This may be
  1107. // used to include empty fields in Patch requests.
  1108. ForceSendFields []string `json:"-"`
  1109. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1110. // in API requests with the JSON null value. By default, fields with
  1111. // empty values are omitted from API requests. However, any field with
  1112. // an empty value appearing in NullFields will be sent to the server as
  1113. // null. It is an error if a field in this list has a non-empty value.
  1114. // This may be used to include null fields in Patch requests.
  1115. NullFields []string `json:"-"`
  1116. }
  1117. func (s *ListOrgPoliciesResponse) MarshalJSON() ([]byte, error) {
  1118. type NoMethod ListOrgPoliciesResponse
  1119. raw := NoMethod(*s)
  1120. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1121. }
  1122. // ListPolicy: Used in `policy_type` to specify how `list_policy`
  1123. // behaves at this
  1124. // resource.
  1125. //
  1126. // `ListPolicy` can define specific values and subtrees of Cloud
  1127. // Resource
  1128. // Manager resource hierarchy (`Organizations`, `Folders`, `Projects`)
  1129. // that
  1130. // are allowed or denied by setting the `allowed_values` and
  1131. // `denied_values`
  1132. // fields. This is achieved by using the `under:` and optional `is:`
  1133. // prefixes.
  1134. // The `under:` prefix is used to denote resource subtree values.
  1135. // The `is:` prefix is used to denote specific values, and is required
  1136. // only
  1137. // if the value contains a ":". Values prefixed with "is:" are treated
  1138. // the
  1139. // same as values with no prefix.
  1140. // Ancestry subtrees must be in one of the following formats:
  1141. // - “projects/<project-id>”, e.g.
  1142. // “projects/tokyo-rain-123”
  1143. // - “folders/<folder-id>”, e.g. “folders/1234”
  1144. // - “organizations/<organization-id>”, e.g.
  1145. // “organizations/1234”
  1146. // The `supports_under` field of the associated `Constraint` defines
  1147. // whether
  1148. // ancestry prefixes can be used. You can set `allowed_values`
  1149. // and
  1150. // `denied_values` in the same `Policy` if `all_values`
  1151. // is
  1152. // `ALL_VALUES_UNSPECIFIED`. `ALLOW` or `DENY` are used to allow or deny
  1153. // all
  1154. // values. If `all_values` is set to either `ALLOW` or
  1155. // `DENY`,
  1156. // `allowed_values` and `denied_values` must be unset.
  1157. type ListPolicy struct {
  1158. // AllValues: The policy all_values state.
  1159. //
  1160. // Possible values:
  1161. // "ALL_VALUES_UNSPECIFIED" - Indicates that allowed_values or
  1162. // denied_values must be set.
  1163. // "ALLOW" - A policy with this set allows all values.
  1164. // "DENY" - A policy with this set denies all values.
  1165. AllValues string `json:"allValues,omitempty"`
  1166. // AllowedValues: List of values allowed at this resource. Can only be
  1167. // set if `all_values`
  1168. // is set to `ALL_VALUES_UNSPECIFIED`.
  1169. AllowedValues []string `json:"allowedValues,omitempty"`
  1170. // DeniedValues: List of values denied at this resource. Can only be set
  1171. // if `all_values`
  1172. // is set to `ALL_VALUES_UNSPECIFIED`.
  1173. DeniedValues []string `json:"deniedValues,omitempty"`
  1174. // InheritFromParent: Determines the inheritance behavior for this
  1175. // `Policy`.
  1176. //
  1177. // By default, a `ListPolicy` set at a resource supercedes any `Policy`
  1178. // set
  1179. // anywhere up the resource hierarchy. However, if `inherit_from_parent`
  1180. // is
  1181. // set to `true`, then the values from the effective `Policy` of the
  1182. // parent
  1183. // resource are inherited, meaning the values set in this `Policy`
  1184. // are
  1185. // added to the values inherited up the hierarchy.
  1186. //
  1187. // Setting `Policy` hierarchies that inherit both allowed values and
  1188. // denied
  1189. // values isn't recommended in most circumstances to keep the
  1190. // configuration
  1191. // simple and understandable. However, it is possible to set a `Policy`
  1192. // with
  1193. // `allowed_values` set that inherits a `Policy` with `denied_values`
  1194. // set.
  1195. // In this case, the values that are allowed must be in `allowed_values`
  1196. // and
  1197. // not present in `denied_values`.
  1198. //
  1199. // For example, suppose you have a
  1200. // `Constraint`
  1201. // `constraints/serviceuser.services`, which has a `constraint_type`
  1202. // of
  1203. // `list_constraint`, and with `constraint_default` set to
  1204. // `ALLOW`.
  1205. // Suppose that at the Organization level, a `Policy` is applied
  1206. // that
  1207. // restricts the allowed API activations to {`E1`, `E2`}. Then, if
  1208. // a
  1209. // `Policy` is applied to a project below the Organization that
  1210. // has
  1211. // `inherit_from_parent` set to `false` and field all_values set to
  1212. // DENY,
  1213. // then an attempt to activate any API will be denied.
  1214. //
  1215. // The following examples demonstrate different possible layerings
  1216. // for
  1217. // `projects/bar` parented by `organizations/foo`:
  1218. //
  1219. // Example 1 (no inherited values):
  1220. // `organizations/foo` has a `Policy` with values:
  1221. // {allowed_values: “E1” allowed_values:”E2”}
  1222. // `projects/bar` has `inherit_from_parent` `false` and values:
  1223. // {allowed_values: "E3" allowed_values: "E4"}
  1224. // The accepted values at `organizations/foo` are `E1`, `E2`.
  1225. // The accepted values at `projects/bar` are `E3`, and `E4`.
  1226. //
  1227. // Example 2 (inherited values):
  1228. // `organizations/foo` has a `Policy` with values:
  1229. // {allowed_values: “E1” allowed_values:”E2”}
  1230. // `projects/bar` has a `Policy` with values:
  1231. // {value: “E3” value: ”E4” inherit_from_parent: true}
  1232. // The accepted values at `organizations/foo` are `E1`, `E2`.
  1233. // The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and
  1234. // `E4`.
  1235. //
  1236. // Example 3 (inheriting both allowed and denied values):
  1237. // `organizations/foo` has a `Policy` with values:
  1238. // {allowed_values: "E1" allowed_values: "E2"}
  1239. // `projects/bar` has a `Policy` with:
  1240. // {denied_values: "E1"}
  1241. // The accepted values at `organizations/foo` are `E1`, `E2`.
  1242. // The value accepted at `projects/bar` is `E2`.
  1243. //
  1244. // Example 4 (RestoreDefault):
  1245. // `organizations/foo` has a `Policy` with values:
  1246. // {allowed_values: “E1” allowed_values:”E2”}
  1247. // `projects/bar` has a `Policy` with values:
  1248. // {RestoreDefault: {}}
  1249. // The accepted values at `organizations/foo` are `E1`, `E2`.
  1250. // The accepted values at `projects/bar` are either all or none
  1251. // depending on
  1252. // the value of `constraint_default` (if `ALLOW`, all; if
  1253. // `DENY`, none).
  1254. //
  1255. // Example 5 (no policy inherits parent policy):
  1256. // `organizations/foo` has no `Policy` set.
  1257. // `projects/bar` has no `Policy` set.
  1258. // The accepted values at both levels are either all or none depending
  1259. // on
  1260. // the value of `constraint_default` (if `ALLOW`, all; if
  1261. // `DENY`, none).
  1262. //
  1263. // Example 6 (ListConstraint allowing all):
  1264. // `organizations/foo` has a `Policy` with values:
  1265. // {allowed_values: “E1” allowed_values: ”E2”}
  1266. // `projects/bar` has a `Policy` with:
  1267. // {all: ALLOW}
  1268. // The accepted values at `organizations/foo` are `E1`, E2`.
  1269. // Any value is accepted at `projects/bar`.
  1270. //
  1271. // Example 7 (ListConstraint allowing none):
  1272. // `organizations/foo` has a `Policy` with values:
  1273. // {allowed_values: “E1” allowed_values: ”E2”}
  1274. // `projects/bar` has a `Policy` with:
  1275. // {all: DENY}
  1276. // The accepted values at `organizations/foo` are `E1`, E2`.
  1277. // No value is accepted at `projects/bar`.
  1278. //
  1279. // Example 10 (allowed and denied subtrees of Resource Manager
  1280. // hierarchy):
  1281. // Given the following resource hierarchy
  1282. // O1->{F1, F2}; F1->{P1}; F2->{P2, P3},
  1283. // `organizations/foo` has a `Policy` with values:
  1284. // {allowed_values: "under:organizations/O1"}
  1285. // `projects/bar` has a `Policy` with:
  1286. // {allowed_values: "under:projects/P3"}
  1287. // {denied_values: "under:folders/F2"}
  1288. // The accepted values at `organizations/foo` are `organizations/O1`,
  1289. // `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`,
  1290. // `projects/P3`.
  1291. // The accepted values at `projects/bar` are `organizations/O1`,
  1292. // `folders/F1`, `projects/P1`.
  1293. InheritFromParent bool `json:"inheritFromParent,omitempty"`
  1294. // SuggestedValue: Optional. The Google Cloud Console will try to
  1295. // default to a configuration
  1296. // that matches the value specified in this `Policy`. If
  1297. // `suggested_value`
  1298. // is not set, it will inherit the value specified higher in the
  1299. // hierarchy,
  1300. // unless `inherit_from_parent` is `false`.
  1301. SuggestedValue string `json:"suggestedValue,omitempty"`
  1302. // ForceSendFields is a list of field names (e.g. "AllValues") to
  1303. // unconditionally include in API requests. By default, fields with
  1304. // empty values are omitted from API requests. However, any non-pointer,
  1305. // non-interface field appearing in ForceSendFields will be sent to the
  1306. // server regardless of whether the field is empty or not. This may be
  1307. // used to include empty fields in Patch requests.
  1308. ForceSendFields []string `json:"-"`
  1309. // NullFields is a list of field names (e.g. "AllValues") to include in
  1310. // API requests with the JSON null value. By default, fields with empty
  1311. // values are omitted from API requests. However, any field with an
  1312. // empty value appearing in NullFields will be sent to the server as
  1313. // null. It is an error if a field in this list has a non-empty value.
  1314. // This may be used to include null fields in Patch requests.
  1315. NullFields []string `json:"-"`
  1316. }
  1317. func (s *ListPolicy) MarshalJSON() ([]byte, error) {
  1318. type NoMethod ListPolicy
  1319. raw := NoMethod(*s)
  1320. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1321. }
  1322. // ListProjectsResponse: A page of the response received from
  1323. // the
  1324. // ListProjects
  1325. // method.
  1326. //
  1327. // A paginated response where more pages are available
  1328. // has
  1329. // `next_page_token` set. This token can be used in a subsequent request
  1330. // to
  1331. // retrieve the next request page.
  1332. type ListProjectsResponse struct {
  1333. // NextPageToken: Pagination token.
  1334. //
  1335. // If the result set is too large to fit in a single response, this
  1336. // token
  1337. // is returned. It encodes the position of the current result
  1338. // cursor.
  1339. // Feeding this value into a new list request with the `page_token`
  1340. // parameter
  1341. // gives the next page of the results.
  1342. //
  1343. // When `next_page_token` is not filled in, there is no next page
  1344. // and
  1345. // the list returned is the last page in the result set.
  1346. //
  1347. // Pagination tokens have a limited lifetime.
  1348. NextPageToken string `json:"nextPageToken,omitempty"`
  1349. // Projects: The list of Projects that matched the list filter. This
  1350. // list can
  1351. // be paginated.
  1352. Projects []*Project `json:"projects,omitempty"`
  1353. // ServerResponse contains the HTTP response code and headers from the
  1354. // server.
  1355. googleapi.ServerResponse `json:"-"`
  1356. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1357. // unconditionally include in API requests. By default, fields with
  1358. // empty values are omitted from API requests. However, any non-pointer,
  1359. // non-interface field appearing in ForceSendFields will be sent to the
  1360. // server regardless of whether the field is empty or not. This may be
  1361. // used to include empty fields in Patch requests.
  1362. ForceSendFields []string `json:"-"`
  1363. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1364. // in API requests with the JSON null value. By default, fields with
  1365. // empty values are omitted from API requests. However, any field with
  1366. // an empty value appearing in NullFields will be sent to the server as
  1367. // null. It is an error if a field in this list has a non-empty value.
  1368. // This may be used to include null fields in Patch requests.
  1369. NullFields []string `json:"-"`
  1370. }
  1371. func (s *ListProjectsResponse) MarshalJSON() ([]byte, error) {
  1372. type NoMethod ListProjectsResponse
  1373. raw := NoMethod(*s)
  1374. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1375. }
  1376. // Operation: This resource represents a long-running operation that is
  1377. // the result of a
  1378. // network API call.
  1379. type Operation struct {
  1380. // Done: If the value is `false`, it means the operation is still in
  1381. // progress.
  1382. // If `true`, the operation is completed, and either `error` or
  1383. // `response` is
  1384. // available.
  1385. Done bool `json:"done,omitempty"`
  1386. // Error: The error result of the operation in case of failure or
  1387. // cancellation.
  1388. Error *Status `json:"error,omitempty"`
  1389. // Metadata: Service-specific metadata associated with the operation.
  1390. // It typically
  1391. // contains progress information and common metadata such as create
  1392. // time.
  1393. // Some services might not provide such metadata. Any method that
  1394. // returns a
  1395. // long-running operation should document the metadata type, if any.
  1396. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  1397. // Name: The server-assigned name, which is only unique within the same
  1398. // service that
  1399. // originally returns it. If you use the default HTTP mapping,
  1400. // the
  1401. // `name` should have the format of `operations/some/unique/name`.
  1402. Name string `json:"name,omitempty"`
  1403. // Response: The normal response of the operation in case of success.
  1404. // If the original
  1405. // method returns no data on success, such as `Delete`, the response
  1406. // is
  1407. // `google.protobuf.Empty`. If the original method is
  1408. // standard
  1409. // `Get`/`Create`/`Update`, the response should be the resource. For
  1410. // other
  1411. // methods, the response should have the type `XxxResponse`, where
  1412. // `Xxx`
  1413. // is the original method name. For example, if the original method
  1414. // name
  1415. // is `TakeSnapshot()`, the inferred response type
  1416. // is
  1417. // `TakeSnapshotResponse`.
  1418. Response googleapi.RawMessage `json:"response,omitempty"`
  1419. // ServerResponse contains the HTTP response code and headers from the
  1420. // server.
  1421. googleapi.ServerResponse `json:"-"`
  1422. // ForceSendFields is a list of field names (e.g. "Done") to
  1423. // unconditionally include in API requests. By default, fields with
  1424. // empty values are omitted from API requests. However, any non-pointer,
  1425. // non-interface field appearing in ForceSendFields will be sent to the
  1426. // server regardless of whether the field is empty or not. This may be
  1427. // used to include empty fields in Patch requests.
  1428. ForceSendFields []string `json:"-"`
  1429. // NullFields is a list of field names (e.g. "Done") to include in API
  1430. // requests with the JSON null value. By default, fields with empty
  1431. // values are omitted from API requests. However, any field with an
  1432. // empty value appearing in NullFields will be sent to the server as
  1433. // null. It is an error if a field in this list has a non-empty value.
  1434. // This may be used to include null fields in Patch requests.
  1435. NullFields []string `json:"-"`
  1436. }
  1437. func (s *Operation) MarshalJSON() ([]byte, error) {
  1438. type NoMethod Operation
  1439. raw := NoMethod(*s)
  1440. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1441. }
  1442. // OrgPolicy: Defines a Cloud Organization `Policy` which is used to
  1443. // specify `Constraints`
  1444. // for configurations of Cloud Platform resources.
  1445. type OrgPolicy struct {
  1446. // BooleanPolicy: For boolean `Constraints`, whether to enforce the
  1447. // `Constraint` or not.
  1448. BooleanPolicy *BooleanPolicy `json:"booleanPolicy,omitempty"`
  1449. // Constraint: The name of the `Constraint` the `Policy` is configuring,
  1450. // for example,
  1451. // `constraints/serviceuser.services`.
  1452. //
  1453. // Immutable after creation.
  1454. Constraint string `json:"constraint,omitempty"`
  1455. // Etag: An opaque tag indicating the current version of the `Policy`,
  1456. // used for
  1457. // concurrency control.
  1458. //
  1459. // When the `Policy` is returned from either a `GetPolicy` or
  1460. // a
  1461. // `ListOrgPolicy` request, this `etag` indicates the version of the
  1462. // current
  1463. // `Policy` to use when executing a read-modify-write loop.
  1464. //
  1465. // When the `Policy` is returned from a `GetEffectivePolicy` request,
  1466. // the
  1467. // `etag` will be unset.
  1468. //
  1469. // When the `Policy` is used in a `SetOrgPolicy` method, use the `etag`
  1470. // value
  1471. // that was returned from a `GetOrgPolicy` request as part of
  1472. // a
  1473. // read-modify-write loop for concurrency control. Not setting the
  1474. // `etag`in a
  1475. // `SetOrgPolicy` request will result in an unconditional write of
  1476. // the
  1477. // `Policy`.
  1478. Etag string `json:"etag,omitempty"`
  1479. // ListPolicy: List of values either allowed or disallowed.
  1480. ListPolicy *ListPolicy `json:"listPolicy,omitempty"`
  1481. // RestoreDefault: Restores the default behavior of the constraint;
  1482. // independent of
  1483. // `Constraint` type.
  1484. RestoreDefault *RestoreDefault `json:"restoreDefault,omitempty"`
  1485. // UpdateTime: The time stamp the `Policy` was previously updated. This
  1486. // is set by the
  1487. // server, not specified by the caller, and represents the last time a
  1488. // call to
  1489. // `SetOrgPolicy` was made for that `Policy`. Any value set by the
  1490. // client will
  1491. // be ignored.
  1492. UpdateTime string `json:"updateTime,omitempty"`
  1493. // Version: Version of the `Policy`. Default version is 0;
  1494. Version int64 `json:"version,omitempty"`
  1495. // ServerResponse contains the HTTP response code and headers from the
  1496. // server.
  1497. googleapi.ServerResponse `json:"-"`
  1498. // ForceSendFields is a list of field names (e.g. "BooleanPolicy") to
  1499. // unconditionally include in API requests. By default, fields with
  1500. // empty values are omitted from API requests. However, any non-pointer,
  1501. // non-interface field appearing in ForceSendFields will be sent to the
  1502. // server regardless of whether the field is empty or not. This may be
  1503. // used to include empty fields in Patch requests.
  1504. ForceSendFields []string `json:"-"`
  1505. // NullFields is a list of field names (e.g. "BooleanPolicy") to include
  1506. // in API requests with the JSON null value. By default, fields with
  1507. // empty values are omitted from API requests. However, any field with
  1508. // an empty value appearing in NullFields will be sent to the server as
  1509. // null. It is an error if a field in this list has a non-empty value.
  1510. // This may be used to include null fields in Patch requests.
  1511. NullFields []string `json:"-"`
  1512. }
  1513. func (s *OrgPolicy) MarshalJSON() ([]byte, error) {
  1514. type NoMethod OrgPolicy
  1515. raw := NoMethod(*s)
  1516. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1517. }
  1518. // Organization: The root node in the resource hierarchy to which a
  1519. // particular entity's
  1520. // (e.g., company) resources belong.
  1521. type Organization struct {
  1522. // CreationTime: Timestamp when the Organization was created. Assigned
  1523. // by the server.
  1524. // @OutputOnly
  1525. CreationTime string `json:"creationTime,omitempty"`
  1526. // DisplayName: A human-readable string that refers to the Organization
  1527. // in the
  1528. // GCP Console UI. This string is set by the server and cannot
  1529. // be
  1530. // changed. The string will be set to the primary domain (for
  1531. // example,
  1532. // "google.com") of the G Suite customer that owns the
  1533. // organization.
  1534. // @OutputOnly
  1535. DisplayName string `json:"displayName,omitempty"`
  1536. // LifecycleState: The organization's current lifecycle state. Assigned
  1537. // by the server.
  1538. // @OutputOnly
  1539. //
  1540. // Possible values:
  1541. // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state. This is only
  1542. // useful for distinguishing unset values.
  1543. // "ACTIVE" - The normal and active state.
  1544. // "DELETE_REQUESTED" - The organization has been marked for deletion
  1545. // by the user.
  1546. LifecycleState string `json:"lifecycleState,omitempty"`
  1547. // Name: Output Only. The resource name of the organization. This is
  1548. // the
  1549. // organization's relative path in the API. Its format
  1550. // is
  1551. // "organizations/[organization_id]". For example, "organizations/1234".
  1552. Name string `json:"name,omitempty"`
  1553. // Owner: The owner of this Organization. The owner should be specified
  1554. // on
  1555. // creation. Once set, it cannot be changed.
  1556. // This field is required.
  1557. Owner *OrganizationOwner `json:"owner,omitempty"`
  1558. // ServerResponse contains the HTTP response code and headers from the
  1559. // server.
  1560. googleapi.ServerResponse `json:"-"`
  1561. // ForceSendFields is a list of field names (e.g. "CreationTime") to
  1562. // unconditionally include in API requests. By default, fields with
  1563. // empty values are omitted from API requests. However, any non-pointer,
  1564. // non-interface field appearing in ForceSendFields will be sent to the
  1565. // server regardless of whether the field is empty or not. This may be
  1566. // used to include empty fields in Patch requests.
  1567. ForceSendFields []string `json:"-"`
  1568. // NullFields is a list of field names (e.g. "CreationTime") to include
  1569. // in API requests with the JSON null value. By default, fields with
  1570. // empty values are omitted from API requests. However, any field with
  1571. // an empty value appearing in NullFields will be sent to the server as
  1572. // null. It is an error if a field in this list has a non-empty value.
  1573. // This may be used to include null fields in Patch requests.
  1574. NullFields []string `json:"-"`
  1575. }
  1576. func (s *Organization) MarshalJSON() ([]byte, error) {
  1577. type NoMethod Organization
  1578. raw := NoMethod(*s)
  1579. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1580. }
  1581. // OrganizationOwner: The entity that owns an Organization. The lifetime
  1582. // of the Organization and
  1583. // all of its descendants are bound to the `OrganizationOwner`. If
  1584. // the
  1585. // `OrganizationOwner` is deleted, the Organization and all its
  1586. // descendants will
  1587. // be deleted.
  1588. type OrganizationOwner struct {
  1589. // DirectoryCustomerId: The G Suite customer id used in the Directory
  1590. // API.
  1591. DirectoryCustomerId string `json:"directoryCustomerId,omitempty"`
  1592. // ForceSendFields is a list of field names (e.g. "DirectoryCustomerId")
  1593. // to unconditionally include in API requests. By default, fields with
  1594. // empty values are omitted from API requests. However, any non-pointer,
  1595. // non-interface field appearing in ForceSendFields will be sent to the
  1596. // server regardless of whether the field is empty or not. This may be
  1597. // used to include empty fields in Patch requests.
  1598. ForceSendFields []string `json:"-"`
  1599. // NullFields is a list of field names (e.g. "DirectoryCustomerId") to
  1600. // include in API requests with the JSON null value. By default, fields
  1601. // with empty values are omitted from API requests. However, any field
  1602. // with an empty value appearing in NullFields will be sent to the
  1603. // server as null. It is an error if a field in this list has a
  1604. // non-empty value. This may be used to include null fields in Patch
  1605. // requests.
  1606. NullFields []string `json:"-"`
  1607. }
  1608. func (s *OrganizationOwner) MarshalJSON() ([]byte, error) {
  1609. type NoMethod OrganizationOwner
  1610. raw := NoMethod(*s)
  1611. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1612. }
  1613. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  1614. // used to
  1615. // specify access control policies for Cloud Platform resources.
  1616. //
  1617. //
  1618. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  1619. // of
  1620. // `members` to a `role`, where the members can be user accounts, Google
  1621. // groups,
  1622. // Google domains, and service accounts. A `role` is a named list of
  1623. // permissions
  1624. // defined by IAM.
  1625. //
  1626. // **JSON Example**
  1627. //
  1628. // {
  1629. // "bindings": [
  1630. // {
  1631. // "role": "roles/owner",
  1632. // "members": [
  1633. // "user:mike@example.com",
  1634. // "group:admins@example.com",
  1635. // "domain:google.com",
  1636. //
  1637. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  1638. // ]
  1639. // },
  1640. // {
  1641. // "role": "roles/viewer",
  1642. // "members": ["user:sean@example.com"]
  1643. // }
  1644. // ]
  1645. // }
  1646. //
  1647. // **YAML Example**
  1648. //
  1649. // bindings:
  1650. // - members:
  1651. // - user:mike@example.com
  1652. // - group:admins@example.com
  1653. // - domain:google.com
  1654. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  1655. // role: roles/owner
  1656. // - members:
  1657. // - user:sean@example.com
  1658. // role: roles/viewer
  1659. //
  1660. //
  1661. // For a description of IAM and its features, see the
  1662. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  1663. type Policy struct {
  1664. // AuditConfigs: Specifies cloud audit logging configuration for this
  1665. // policy.
  1666. AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
  1667. // Bindings: Associates a list of `members` to a `role`.
  1668. // `bindings` with no members will result in an error.
  1669. Bindings []*Binding `json:"bindings,omitempty"`
  1670. // Etag: `etag` is used for optimistic concurrency control as a way to
  1671. // help
  1672. // prevent simultaneous updates of a policy from overwriting each
  1673. // other.
  1674. // It is strongly suggested that systems make use of the `etag` in
  1675. // the
  1676. // read-modify-write cycle to perform policy updates in order to avoid
  1677. // race
  1678. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  1679. // and
  1680. // systems are expected to put that etag in the request to
  1681. // `setIamPolicy` to
  1682. // ensure that their change will be applied to the same version of the
  1683. // policy.
  1684. //
  1685. // If no `etag` is provided in the call to `setIamPolicy`, then the
  1686. // existing
  1687. // policy is overwritten blindly.
  1688. Etag string `json:"etag,omitempty"`
  1689. // Version: Deprecated.
  1690. Version int64 `json:"version,omitempty"`
  1691. // ServerResponse contains the HTTP response code and headers from the
  1692. // server.
  1693. googleapi.ServerResponse `json:"-"`
  1694. // ForceSendFields is a list of field names (e.g. "AuditConfigs") to
  1695. // unconditionally include in API requests. By default, fields with
  1696. // empty values are omitted from API requests. However, any non-pointer,
  1697. // non-interface field appearing in ForceSendFields will be sent to the
  1698. // server regardless of whether the field is empty or not. This may be
  1699. // used to include empty fields in Patch requests.
  1700. ForceSendFields []string `json:"-"`
  1701. // NullFields is a list of field names (e.g. "AuditConfigs") to include
  1702. // in API requests with the JSON null value. By default, fields with
  1703. // empty values are omitted from API requests. However, any field with
  1704. // an empty value appearing in NullFields will be sent to the server as
  1705. // null. It is an error if a field in this list has a non-empty value.
  1706. // This may be used to include null fields in Patch requests.
  1707. NullFields []string `json:"-"`
  1708. }
  1709. func (s *Policy) MarshalJSON() ([]byte, error) {
  1710. type NoMethod Policy
  1711. raw := NoMethod(*s)
  1712. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1713. }
  1714. // Project: A Project is a high-level Google Cloud Platform entity. It
  1715. // is a
  1716. // container for ACLs, APIs, App Engine Apps, VMs, and other
  1717. // Google Cloud Platform resources.
  1718. type Project struct {
  1719. // CreateTime: Creation time.
  1720. //
  1721. // Read-only.
  1722. CreateTime string `json:"createTime,omitempty"`
  1723. // Labels: The labels associated with this Project.
  1724. //
  1725. // Label keys must be between 1 and 63 characters long and must
  1726. // conform
  1727. // to the following regular expression:
  1728. // \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?.
  1729. //
  1730. // Label values must be between 0 and 63 characters long and must
  1731. // conform
  1732. // to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. A
  1733. // label
  1734. // value can be empty.
  1735. //
  1736. // No more than 256 labels can be associated with a given
  1737. // resource.
  1738. //
  1739. // Clients should store labels in a representation such as JSON that
  1740. // does not
  1741. // depend on specific characters being disallowed.
  1742. //
  1743. // Example: <code>"environment" : "dev"</code>
  1744. // Read-write.
  1745. Labels map[string]string `json:"labels,omitempty"`
  1746. // LifecycleState: The Project lifecycle state.
  1747. //
  1748. // Read-only.
  1749. //
  1750. // Possible values:
  1751. // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state. This is only
  1752. // used/useful for distinguishing
  1753. // unset values.
  1754. // "ACTIVE" - The normal and active state.
  1755. // "DELETE_REQUESTED" - The project has been marked for deletion by
  1756. // the user
  1757. // (by invoking
  1758. // DeleteProject)
  1759. // or by the system (Google Cloud Platform).
  1760. // This can generally be reversed by invoking UndeleteProject.
  1761. // "DELETE_IN_PROGRESS" - This lifecycle state is no longer used and
  1762. // not returned by the API.
  1763. LifecycleState string `json:"lifecycleState,omitempty"`
  1764. // Name: The optional user-assigned display name of the Project.
  1765. // When present it must be between 4 to 30 characters.
  1766. // Allowed characters are: lowercase and uppercase letters,
  1767. // numbers,
  1768. // hyphen, single-quote, double-quote, space, and exclamation
  1769. // point.
  1770. //
  1771. // Example: <code>My Project</code>
  1772. // Read-write.
  1773. Name string `json:"name,omitempty"`
  1774. // Parent: An optional reference to a parent Resource.
  1775. //
  1776. // Supported parent types include "organization" and "folder". Once set,
  1777. // the
  1778. // parent cannot be cleared. The `parent` can be set on creation or
  1779. // using the
  1780. // `UpdateProject` method; the end user must have
  1781. // the
  1782. // `resourcemanager.projects.create` permission on the
  1783. // parent.
  1784. //
  1785. // Read-write.
  1786. Parent *ResourceId `json:"parent,omitempty"`
  1787. // ProjectId: The unique, user-assigned ID of the Project.
  1788. // It must be 6 to 30 lowercase letters, digits, or hyphens.
  1789. // It must start with a letter.
  1790. // Trailing hyphens are prohibited.
  1791. //
  1792. // Example: <code>tokyo-rain-123</code>
  1793. // Read-only after creation.
  1794. ProjectId string `json:"projectId,omitempty"`
  1795. // ProjectNumber: The number uniquely identifying the project.
  1796. //
  1797. // Example: <code>415104041262</code>
  1798. // Read-only.
  1799. ProjectNumber int64 `json:"projectNumber,omitempty,string"`
  1800. // ServerResponse contains the HTTP response code and headers from the
  1801. // server.
  1802. googleapi.ServerResponse `json:"-"`
  1803. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1804. // unconditionally include in API requests. By default, fields with
  1805. // empty values are omitted from API requests. However, any non-pointer,
  1806. // non-interface field appearing in ForceSendFields will be sent to the
  1807. // server regardless of whether the field is empty or not. This may be
  1808. // used to include empty fields in Patch requests.
  1809. ForceSendFields []string `json:"-"`
  1810. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1811. // API requests with the JSON null value. By default, fields with empty
  1812. // values are omitted from API requests. However, any field with an
  1813. // empty value appearing in NullFields will be sent to the server as
  1814. // null. It is an error if a field in this list has a non-empty value.
  1815. // This may be used to include null fields in Patch requests.
  1816. NullFields []string `json:"-"`
  1817. }
  1818. func (s *Project) MarshalJSON() ([]byte, error) {
  1819. type NoMethod Project
  1820. raw := NoMethod(*s)
  1821. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1822. }
  1823. // ProjectCreationStatus: A status object which is used as the
  1824. // `metadata` field for the Operation
  1825. // returned by CreateProject. It provides insight for when significant
  1826. // phases of
  1827. // Project creation have completed.
  1828. type ProjectCreationStatus struct {
  1829. // CreateTime: Creation time of the project creation workflow.
  1830. CreateTime string `json:"createTime,omitempty"`
  1831. // Gettable: True if the project can be retrieved using GetProject. No
  1832. // other operations
  1833. // on the project are guaranteed to work until the project creation
  1834. // is
  1835. // complete.
  1836. Gettable bool `json:"gettable,omitempty"`
  1837. // Ready: True if the project creation process is complete.
  1838. Ready bool `json:"ready,omitempty"`
  1839. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  1840. // unconditionally include in API requests. By default, fields with
  1841. // empty values are omitted from API requests. However, any non-pointer,
  1842. // non-interface field appearing in ForceSendFields will be sent to the
  1843. // server regardless of whether the field is empty or not. This may be
  1844. // used to include empty fields in Patch requests.
  1845. ForceSendFields []string `json:"-"`
  1846. // NullFields is a list of field names (e.g. "CreateTime") to include in
  1847. // API requests with the JSON null value. By default, fields with empty
  1848. // values are omitted from API requests. However, any field with an
  1849. // empty value appearing in NullFields will be sent to the server as
  1850. // null. It is an error if a field in this list has a non-empty value.
  1851. // This may be used to include null fields in Patch requests.
  1852. NullFields []string `json:"-"`
  1853. }
  1854. func (s *ProjectCreationStatus) MarshalJSON() ([]byte, error) {
  1855. type NoMethod ProjectCreationStatus
  1856. raw := NoMethod(*s)
  1857. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1858. }
  1859. // ResourceId: A container to reference an id for any resource type. A
  1860. // `resource` in Google
  1861. // Cloud Platform is a generic term for something you (a developer) may
  1862. // want to
  1863. // interact with through one of our API's. Some examples are an App
  1864. // Engine app,
  1865. // a Compute Engine instance, a Cloud SQL database, and so on.
  1866. type ResourceId struct {
  1867. // Id: Required field for the type-specific id. This should correspond
  1868. // to the id
  1869. // used in the type-specific API's.
  1870. Id string `json:"id,omitempty"`
  1871. // Type: Required field representing the resource type this id is
  1872. // for.
  1873. // At present, the valid types are: "organization" and "folder".
  1874. Type string `json:"type,omitempty"`
  1875. // ForceSendFields is a list of field names (e.g. "Id") to
  1876. // unconditionally include in API requests. By default, fields with
  1877. // empty values are omitted from API requests. However, any non-pointer,
  1878. // non-interface field appearing in ForceSendFields will be sent to the
  1879. // server regardless of whether the field is empty or not. This may be
  1880. // used to include empty fields in Patch requests.
  1881. ForceSendFields []string `json:"-"`
  1882. // NullFields is a list of field names (e.g. "Id") to include in API
  1883. // requests with the JSON null value. By default, fields with empty
  1884. // values are omitted from API requests. However, any field with an
  1885. // empty value appearing in NullFields will be sent to the server as
  1886. // null. It is an error if a field in this list has a non-empty value.
  1887. // This may be used to include null fields in Patch requests.
  1888. NullFields []string `json:"-"`
  1889. }
  1890. func (s *ResourceId) MarshalJSON() ([]byte, error) {
  1891. type NoMethod ResourceId
  1892. raw := NoMethod(*s)
  1893. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1894. }
  1895. // RestoreDefault: Ignores policies set above this resource and restores
  1896. // the
  1897. // `constraint_default` enforcement behavior of the specific
  1898. // `Constraint` at
  1899. // this resource.
  1900. //
  1901. // Suppose that `constraint_default` is set to `ALLOW` for
  1902. // the
  1903. // `Constraint` `constraints/serviceuser.services`. Suppose that
  1904. // organization
  1905. // foo.com sets a `Policy` at their Organization resource node that
  1906. // restricts
  1907. // the allowed service activations to deny all service activations.
  1908. // They
  1909. // could then set a `Policy` with the `policy_type` `restore_default`
  1910. // on
  1911. // several experimental projects, restoring the
  1912. // `constraint_default`
  1913. // enforcement of the `Constraint` for only those projects, allowing
  1914. // those
  1915. // projects to have all services activated.
  1916. type RestoreDefault struct {
  1917. }
  1918. // SearchOrganizationsRequest: The request sent to the
  1919. // `SearchOrganizations` method.
  1920. type SearchOrganizationsRequest struct {
  1921. // Filter: An optional query string used to filter the Organizations to
  1922. // return in
  1923. // the response. Filter rules are case-insensitive.
  1924. //
  1925. //
  1926. // Organizations may be filtered by `owner.directoryCustomerId` or
  1927. // by
  1928. // `domain`, where the domain is a G Suite domain, for
  1929. // example:
  1930. //
  1931. // |Filter|Description|
  1932. // |------|-----------|
  1933. // |owner.directorycu
  1934. // stomerid:123456789|Organizations with
  1935. // `owner.directory_customer_id` equal to
  1936. // `123456789`.|
  1937. // |domain:google.com|Organizations corresponding to the domain
  1938. // `google.com`.|
  1939. //
  1940. // This field is optional.
  1941. Filter string `json:"filter,omitempty"`
  1942. // PageSize: The maximum number of Organizations to return in the
  1943. // response.
  1944. // This field is optional.
  1945. PageSize int64 `json:"pageSize,omitempty"`
  1946. // PageToken: A pagination token returned from a previous call to
  1947. // `SearchOrganizations`
  1948. // that indicates from where listing should continue.
  1949. // This field is optional.
  1950. PageToken string `json:"pageToken,omitempty"`
  1951. // ForceSendFields is a list of field names (e.g. "Filter") to
  1952. // unconditionally include in API requests. By default, fields with
  1953. // empty values are omitted from API requests. However, any non-pointer,
  1954. // non-interface field appearing in ForceSendFields will be sent to the
  1955. // server regardless of whether the field is empty or not. This may be
  1956. // used to include empty fields in Patch requests.
  1957. ForceSendFields []string `json:"-"`
  1958. // NullFields is a list of field names (e.g. "Filter") to include in API
  1959. // requests with the JSON null value. By default, fields with empty
  1960. // values are omitted from API requests. However, any field with an
  1961. // empty value appearing in NullFields will be sent to the server as
  1962. // null. It is an error if a field in this list has a non-empty value.
  1963. // This may be used to include null fields in Patch requests.
  1964. NullFields []string `json:"-"`
  1965. }
  1966. func (s *SearchOrganizationsRequest) MarshalJSON() ([]byte, error) {
  1967. type NoMethod SearchOrganizationsRequest
  1968. raw := NoMethod(*s)
  1969. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1970. }
  1971. // SearchOrganizationsResponse: The response returned from the
  1972. // `SearchOrganizations` method.
  1973. type SearchOrganizationsResponse struct {
  1974. // NextPageToken: A pagination token to be used to retrieve the next
  1975. // page of results. If the
  1976. // result is too large to fit within the page size specified in the
  1977. // request,
  1978. // this field will be set with a token that can be used to fetch the
  1979. // next page
  1980. // of results. If this field is empty, it indicates that this
  1981. // response
  1982. // contains the last page of results.
  1983. NextPageToken string `json:"nextPageToken,omitempty"`
  1984. // Organizations: The list of Organizations that matched the search
  1985. // query, possibly
  1986. // paginated.
  1987. Organizations []*Organization `json:"organizations,omitempty"`
  1988. // ServerResponse contains the HTTP response code and headers from the
  1989. // server.
  1990. googleapi.ServerResponse `json:"-"`
  1991. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1992. // unconditionally include in API requests. By default, fields with
  1993. // empty values are omitted from API requests. However, any non-pointer,
  1994. // non-interface field appearing in ForceSendFields will be sent to the
  1995. // server regardless of whether the field is empty or not. This may be
  1996. // used to include empty fields in Patch requests.
  1997. ForceSendFields []string `json:"-"`
  1998. // NullFields is a list of field names (e.g. "NextPageToken") to include
  1999. // in API requests with the JSON null value. By default, fields with
  2000. // empty values are omitted from API requests. However, any field with
  2001. // an empty value appearing in NullFields will be sent to the server as
  2002. // null. It is an error if a field in this list has a non-empty value.
  2003. // This may be used to include null fields in Patch requests.
  2004. NullFields []string `json:"-"`
  2005. }
  2006. func (s *SearchOrganizationsResponse) MarshalJSON() ([]byte, error) {
  2007. type NoMethod SearchOrganizationsResponse
  2008. raw := NoMethod(*s)
  2009. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2010. }
  2011. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  2012. type SetIamPolicyRequest struct {
  2013. // Policy: REQUIRED: The complete policy to be applied to the
  2014. // `resource`. The size of
  2015. // the policy is limited to a few 10s of KB. An empty policy is a
  2016. // valid policy but certain Cloud Platform services (such as
  2017. // Projects)
  2018. // might reject them.
  2019. Policy *Policy `json:"policy,omitempty"`
  2020. // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the
  2021. // policy to modify. Only
  2022. // the fields in the mask will be modified. If no mask is provided,
  2023. // the
  2024. // following default mask is used:
  2025. // paths: "bindings, etag"
  2026. // This field is only used by Cloud IAM.
  2027. UpdateMask string `json:"updateMask,omitempty"`
  2028. // ForceSendFields is a list of field names (e.g. "Policy") to
  2029. // unconditionally include in API requests. By default, fields with
  2030. // empty values are omitted from API requests. However, any non-pointer,
  2031. // non-interface field appearing in ForceSendFields will be sent to the
  2032. // server regardless of whether the field is empty or not. This may be
  2033. // used to include empty fields in Patch requests.
  2034. ForceSendFields []string `json:"-"`
  2035. // NullFields is a list of field names (e.g. "Policy") to include in API
  2036. // requests with the JSON null value. By default, fields with empty
  2037. // values are omitted from API requests. However, any field with an
  2038. // empty value appearing in NullFields will be sent to the server as
  2039. // null. It is an error if a field in this list has a non-empty value.
  2040. // This may be used to include null fields in Patch requests.
  2041. NullFields []string `json:"-"`
  2042. }
  2043. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  2044. type NoMethod SetIamPolicyRequest
  2045. raw := NoMethod(*s)
  2046. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2047. }
  2048. // SetOrgPolicyRequest: The request sent to the SetOrgPolicyRequest
  2049. // method.
  2050. type SetOrgPolicyRequest struct {
  2051. // Policy: `Policy` to set on the resource.
  2052. Policy *OrgPolicy `json:"policy,omitempty"`
  2053. // ForceSendFields is a list of field names (e.g. "Policy") to
  2054. // unconditionally include in API requests. By default, fields with
  2055. // empty values are omitted from API requests. However, any non-pointer,
  2056. // non-interface field appearing in ForceSendFields will be sent to the
  2057. // server regardless of whether the field is empty or not. This may be
  2058. // used to include empty fields in Patch requests.
  2059. ForceSendFields []string `json:"-"`
  2060. // NullFields is a list of field names (e.g. "Policy") to include in API
  2061. // requests with the JSON null value. By default, fields with empty
  2062. // values are omitted from API requests. However, any field with an
  2063. // empty value appearing in NullFields will be sent to the server as
  2064. // null. It is an error if a field in this list has a non-empty value.
  2065. // This may be used to include null fields in Patch requests.
  2066. NullFields []string `json:"-"`
  2067. }
  2068. func (s *SetOrgPolicyRequest) MarshalJSON() ([]byte, error) {
  2069. type NoMethod SetOrgPolicyRequest
  2070. raw := NoMethod(*s)
  2071. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2072. }
  2073. // Status: The `Status` type defines a logical error model that is
  2074. // suitable for different
  2075. // programming environments, including REST APIs and RPC APIs. It is
  2076. // used by
  2077. // [gRPC](https://github.com/grpc). The error model is designed to
  2078. // be:
  2079. //
  2080. // - Simple to use and understand for most users
  2081. // - Flexible enough to meet unexpected needs
  2082. //
  2083. // # Overview
  2084. //
  2085. // The `Status` message contains three pieces of data: error code, error
  2086. // message,
  2087. // and error details. The error code should be an enum value
  2088. // of
  2089. // google.rpc.Code, but it may accept additional error codes if needed.
  2090. // The
  2091. // error message should be a developer-facing English message that
  2092. // helps
  2093. // developers *understand* and *resolve* the error. If a localized
  2094. // user-facing
  2095. // error message is needed, put the localized message in the error
  2096. // details or
  2097. // localize it in the client. The optional error details may contain
  2098. // arbitrary
  2099. // information about the error. There is a predefined set of error
  2100. // detail types
  2101. // in the package `google.rpc` that can be used for common error
  2102. // conditions.
  2103. //
  2104. // # Language mapping
  2105. //
  2106. // The `Status` message is the logical representation of the error
  2107. // model, but it
  2108. // is not necessarily the actual wire format. When the `Status` message
  2109. // is
  2110. // exposed in different client libraries and different wire protocols,
  2111. // it can be
  2112. // mapped differently. For example, it will likely be mapped to some
  2113. // exceptions
  2114. // in Java, but more likely mapped to some error codes in C.
  2115. //
  2116. // # Other uses
  2117. //
  2118. // The error model and the `Status` message can be used in a variety
  2119. // of
  2120. // environments, either with or without APIs, to provide a
  2121. // consistent developer experience across different
  2122. // environments.
  2123. //
  2124. // Example uses of this error model include:
  2125. //
  2126. // - Partial errors. If a service needs to return partial errors to the
  2127. // client,
  2128. // it may embed the `Status` in the normal response to indicate the
  2129. // partial
  2130. // errors.
  2131. //
  2132. // - Workflow errors. A typical workflow has multiple steps. Each step
  2133. // may
  2134. // have a `Status` message for error reporting.
  2135. //
  2136. // - Batch operations. If a client uses batch request and batch
  2137. // response, the
  2138. // `Status` message should be used directly inside batch response,
  2139. // one for
  2140. // each error sub-response.
  2141. //
  2142. // - Asynchronous operations. If an API call embeds asynchronous
  2143. // operation
  2144. // results in its response, the status of those operations should
  2145. // be
  2146. // represented directly using the `Status` message.
  2147. //
  2148. // - Logging. If some API errors are stored in logs, the message
  2149. // `Status` could
  2150. // be used directly after any stripping needed for security/privacy
  2151. // reasons.
  2152. type Status struct {
  2153. // Code: The status code, which should be an enum value of
  2154. // google.rpc.Code.
  2155. Code int64 `json:"code,omitempty"`
  2156. // Details: A list of messages that carry the error details. There is a
  2157. // common set of
  2158. // message types for APIs to use.
  2159. Details []googleapi.RawMessage `json:"details,omitempty"`
  2160. // Message: A developer-facing error message, which should be in
  2161. // English. Any
  2162. // user-facing error message should be localized and sent in
  2163. // the
  2164. // google.rpc.Status.details field, or localized by the client.
  2165. Message string `json:"message,omitempty"`
  2166. // ForceSendFields is a list of field names (e.g. "Code") to
  2167. // unconditionally include in API requests. By default, fields with
  2168. // empty values are omitted from API requests. However, any non-pointer,
  2169. // non-interface field appearing in ForceSendFields will be sent to the
  2170. // server regardless of whether the field is empty or not. This may be
  2171. // used to include empty fields in Patch requests.
  2172. ForceSendFields []string `json:"-"`
  2173. // NullFields is a list of field names (e.g. "Code") to include in API
  2174. // requests with the JSON null value. By default, fields with empty
  2175. // values are omitted from API requests. However, any field with an
  2176. // empty value appearing in NullFields will be sent to the server as
  2177. // null. It is an error if a field in this list has a non-empty value.
  2178. // This may be used to include null fields in Patch requests.
  2179. NullFields []string `json:"-"`
  2180. }
  2181. func (s *Status) MarshalJSON() ([]byte, error) {
  2182. type NoMethod Status
  2183. raw := NoMethod(*s)
  2184. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2185. }
  2186. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  2187. // method.
  2188. type TestIamPermissionsRequest struct {
  2189. // Permissions: The set of permissions to check for the `resource`.
  2190. // Permissions with
  2191. // wildcards (such as '*' or 'storage.*') are not allowed. For
  2192. // more
  2193. // information see
  2194. // [IAM
  2195. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  2196. Permissions []string `json:"permissions,omitempty"`
  2197. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2198. // unconditionally include in API requests. By default, fields with
  2199. // empty values are omitted from API requests. However, any non-pointer,
  2200. // non-interface field appearing in ForceSendFields will be sent to the
  2201. // server regardless of whether the field is empty or not. This may be
  2202. // used to include empty fields in Patch requests.
  2203. ForceSendFields []string `json:"-"`
  2204. // NullFields is a list of field names (e.g. "Permissions") to include
  2205. // in API requests with the JSON null value. By default, fields with
  2206. // empty values are omitted from API requests. However, any field with
  2207. // an empty value appearing in NullFields will be sent to the server as
  2208. // null. It is an error if a field in this list has a non-empty value.
  2209. // This may be used to include null fields in Patch requests.
  2210. NullFields []string `json:"-"`
  2211. }
  2212. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  2213. type NoMethod TestIamPermissionsRequest
  2214. raw := NoMethod(*s)
  2215. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2216. }
  2217. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  2218. // method.
  2219. type TestIamPermissionsResponse struct {
  2220. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  2221. // the caller is
  2222. // allowed.
  2223. Permissions []string `json:"permissions,omitempty"`
  2224. // ServerResponse contains the HTTP response code and headers from the
  2225. // server.
  2226. googleapi.ServerResponse `json:"-"`
  2227. // ForceSendFields is a list of field names (e.g. "Permissions") to
  2228. // unconditionally include in API requests. By default, fields with
  2229. // empty values are omitted from API requests. However, any non-pointer,
  2230. // non-interface field appearing in ForceSendFields will be sent to the
  2231. // server regardless of whether the field is empty or not. This may be
  2232. // used to include empty fields in Patch requests.
  2233. ForceSendFields []string `json:"-"`
  2234. // NullFields is a list of field names (e.g. "Permissions") to include
  2235. // in API requests with the JSON null value. By default, fields with
  2236. // empty values are omitted from API requests. However, any field with
  2237. // an empty value appearing in NullFields will be sent to the server as
  2238. // null. It is an error if a field in this list has a non-empty value.
  2239. // This may be used to include null fields in Patch requests.
  2240. NullFields []string `json:"-"`
  2241. }
  2242. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  2243. type NoMethod TestIamPermissionsResponse
  2244. raw := NoMethod(*s)
  2245. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2246. }
  2247. // UndeleteProjectRequest: The request sent to the
  2248. // UndeleteProject
  2249. // method.
  2250. type UndeleteProjectRequest struct {
  2251. }
  2252. // method id "cloudresourcemanager.folders.clearOrgPolicy":
  2253. type FoldersClearOrgPolicyCall struct {
  2254. s *Service
  2255. resource string
  2256. clearorgpolicyrequest *ClearOrgPolicyRequest
  2257. urlParams_ gensupport.URLParams
  2258. ctx_ context.Context
  2259. header_ http.Header
  2260. }
  2261. // ClearOrgPolicy: Clears a `Policy` from a resource.
  2262. func (r *FoldersService) ClearOrgPolicy(resource string, clearorgpolicyrequest *ClearOrgPolicyRequest) *FoldersClearOrgPolicyCall {
  2263. c := &FoldersClearOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2264. c.resource = resource
  2265. c.clearorgpolicyrequest = clearorgpolicyrequest
  2266. return c
  2267. }
  2268. // Fields allows partial responses to be retrieved. See
  2269. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2270. // for more information.
  2271. func (c *FoldersClearOrgPolicyCall) Fields(s ...googleapi.Field) *FoldersClearOrgPolicyCall {
  2272. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2273. return c
  2274. }
  2275. // Context sets the context to be used in this call's Do method. Any
  2276. // pending HTTP request will be aborted if the provided context is
  2277. // canceled.
  2278. func (c *FoldersClearOrgPolicyCall) Context(ctx context.Context) *FoldersClearOrgPolicyCall {
  2279. c.ctx_ = ctx
  2280. return c
  2281. }
  2282. // Header returns an http.Header that can be modified by the caller to
  2283. // add HTTP headers to the request.
  2284. func (c *FoldersClearOrgPolicyCall) Header() http.Header {
  2285. if c.header_ == nil {
  2286. c.header_ = make(http.Header)
  2287. }
  2288. return c.header_
  2289. }
  2290. func (c *FoldersClearOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  2291. reqHeaders := make(http.Header)
  2292. for k, v := range c.header_ {
  2293. reqHeaders[k] = v
  2294. }
  2295. reqHeaders.Set("User-Agent", c.s.userAgent())
  2296. var body io.Reader = nil
  2297. body, err := googleapi.WithoutDataWrapper.JSONReader(c.clearorgpolicyrequest)
  2298. if err != nil {
  2299. return nil, err
  2300. }
  2301. reqHeaders.Set("Content-Type", "application/json")
  2302. c.urlParams_.Set("alt", alt)
  2303. c.urlParams_.Set("prettyPrint", "false")
  2304. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:clearOrgPolicy")
  2305. urls += "?" + c.urlParams_.Encode()
  2306. req, err := http.NewRequest("POST", urls, body)
  2307. if err != nil {
  2308. return nil, err
  2309. }
  2310. req.Header = reqHeaders
  2311. googleapi.Expand(req.URL, map[string]string{
  2312. "resource": c.resource,
  2313. })
  2314. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2315. }
  2316. // Do executes the "cloudresourcemanager.folders.clearOrgPolicy" call.
  2317. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2318. // code is an error. Response headers are in either
  2319. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2320. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2321. // check whether the returned error was because http.StatusNotModified
  2322. // was returned.
  2323. func (c *FoldersClearOrgPolicyCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2324. gensupport.SetOptions(c.urlParams_, opts...)
  2325. res, err := c.doRequest("json")
  2326. if res != nil && res.StatusCode == http.StatusNotModified {
  2327. if res.Body != nil {
  2328. res.Body.Close()
  2329. }
  2330. return nil, &googleapi.Error{
  2331. Code: res.StatusCode,
  2332. Header: res.Header,
  2333. }
  2334. }
  2335. if err != nil {
  2336. return nil, err
  2337. }
  2338. defer googleapi.CloseBody(res)
  2339. if err := googleapi.CheckResponse(res); err != nil {
  2340. return nil, err
  2341. }
  2342. ret := &Empty{
  2343. ServerResponse: googleapi.ServerResponse{
  2344. Header: res.Header,
  2345. HTTPStatusCode: res.StatusCode,
  2346. },
  2347. }
  2348. target := &ret
  2349. if err := gensupport.DecodeResponse(target, res); err != nil {
  2350. return nil, err
  2351. }
  2352. return ret, nil
  2353. // {
  2354. // "description": "Clears a `Policy` from a resource.",
  2355. // "flatPath": "v1/folders/{foldersId}:clearOrgPolicy",
  2356. // "httpMethod": "POST",
  2357. // "id": "cloudresourcemanager.folders.clearOrgPolicy",
  2358. // "parameterOrder": [
  2359. // "resource"
  2360. // ],
  2361. // "parameters": {
  2362. // "resource": {
  2363. // "description": "Name of the resource for the `Policy` to clear.",
  2364. // "location": "path",
  2365. // "pattern": "^folders/[^/]+$",
  2366. // "required": true,
  2367. // "type": "string"
  2368. // }
  2369. // },
  2370. // "path": "v1/{+resource}:clearOrgPolicy",
  2371. // "request": {
  2372. // "$ref": "ClearOrgPolicyRequest"
  2373. // },
  2374. // "response": {
  2375. // "$ref": "Empty"
  2376. // },
  2377. // "scopes": [
  2378. // "https://www.googleapis.com/auth/cloud-platform"
  2379. // ]
  2380. // }
  2381. }
  2382. // method id "cloudresourcemanager.folders.getEffectiveOrgPolicy":
  2383. type FoldersGetEffectiveOrgPolicyCall struct {
  2384. s *Service
  2385. resource string
  2386. geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest
  2387. urlParams_ gensupport.URLParams
  2388. ctx_ context.Context
  2389. header_ http.Header
  2390. }
  2391. // GetEffectiveOrgPolicy: Gets the effective `Policy` on a resource.
  2392. // This is the result of merging
  2393. // `Policies` in the resource hierarchy. The returned `Policy` will not
  2394. // have
  2395. // an `etag`set because it is a computed `Policy` across multiple
  2396. // resources.
  2397. // Subtrees of Resource Manager resource hierarchy with 'under:' prefix
  2398. // will
  2399. // not be expanded.
  2400. func (r *FoldersService) GetEffectiveOrgPolicy(resource string, geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest) *FoldersGetEffectiveOrgPolicyCall {
  2401. c := &FoldersGetEffectiveOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2402. c.resource = resource
  2403. c.geteffectiveorgpolicyrequest = geteffectiveorgpolicyrequest
  2404. return c
  2405. }
  2406. // Fields allows partial responses to be retrieved. See
  2407. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2408. // for more information.
  2409. func (c *FoldersGetEffectiveOrgPolicyCall) Fields(s ...googleapi.Field) *FoldersGetEffectiveOrgPolicyCall {
  2410. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2411. return c
  2412. }
  2413. // Context sets the context to be used in this call's Do method. Any
  2414. // pending HTTP request will be aborted if the provided context is
  2415. // canceled.
  2416. func (c *FoldersGetEffectiveOrgPolicyCall) Context(ctx context.Context) *FoldersGetEffectiveOrgPolicyCall {
  2417. c.ctx_ = ctx
  2418. return c
  2419. }
  2420. // Header returns an http.Header that can be modified by the caller to
  2421. // add HTTP headers to the request.
  2422. func (c *FoldersGetEffectiveOrgPolicyCall) Header() http.Header {
  2423. if c.header_ == nil {
  2424. c.header_ = make(http.Header)
  2425. }
  2426. return c.header_
  2427. }
  2428. func (c *FoldersGetEffectiveOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  2429. reqHeaders := make(http.Header)
  2430. for k, v := range c.header_ {
  2431. reqHeaders[k] = v
  2432. }
  2433. reqHeaders.Set("User-Agent", c.s.userAgent())
  2434. var body io.Reader = nil
  2435. body, err := googleapi.WithoutDataWrapper.JSONReader(c.geteffectiveorgpolicyrequest)
  2436. if err != nil {
  2437. return nil, err
  2438. }
  2439. reqHeaders.Set("Content-Type", "application/json")
  2440. c.urlParams_.Set("alt", alt)
  2441. c.urlParams_.Set("prettyPrint", "false")
  2442. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getEffectiveOrgPolicy")
  2443. urls += "?" + c.urlParams_.Encode()
  2444. req, err := http.NewRequest("POST", urls, body)
  2445. if err != nil {
  2446. return nil, err
  2447. }
  2448. req.Header = reqHeaders
  2449. googleapi.Expand(req.URL, map[string]string{
  2450. "resource": c.resource,
  2451. })
  2452. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2453. }
  2454. // Do executes the "cloudresourcemanager.folders.getEffectiveOrgPolicy" call.
  2455. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  2456. // status code is an error. Response headers are in either
  2457. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  2458. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2459. // to check whether the returned error was because
  2460. // http.StatusNotModified was returned.
  2461. func (c *FoldersGetEffectiveOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  2462. gensupport.SetOptions(c.urlParams_, opts...)
  2463. res, err := c.doRequest("json")
  2464. if res != nil && res.StatusCode == http.StatusNotModified {
  2465. if res.Body != nil {
  2466. res.Body.Close()
  2467. }
  2468. return nil, &googleapi.Error{
  2469. Code: res.StatusCode,
  2470. Header: res.Header,
  2471. }
  2472. }
  2473. if err != nil {
  2474. return nil, err
  2475. }
  2476. defer googleapi.CloseBody(res)
  2477. if err := googleapi.CheckResponse(res); err != nil {
  2478. return nil, err
  2479. }
  2480. ret := &OrgPolicy{
  2481. ServerResponse: googleapi.ServerResponse{
  2482. Header: res.Header,
  2483. HTTPStatusCode: res.StatusCode,
  2484. },
  2485. }
  2486. target := &ret
  2487. if err := gensupport.DecodeResponse(target, res); err != nil {
  2488. return nil, err
  2489. }
  2490. return ret, nil
  2491. // {
  2492. // "description": "Gets the effective `Policy` on a resource. This is the result of merging\n`Policies` in the resource hierarchy. The returned `Policy` will not have\nan `etag`set because it is a computed `Policy` across multiple resources.\nSubtrees of Resource Manager resource hierarchy with 'under:' prefix will\nnot be expanded.",
  2493. // "flatPath": "v1/folders/{foldersId}:getEffectiveOrgPolicy",
  2494. // "httpMethod": "POST",
  2495. // "id": "cloudresourcemanager.folders.getEffectiveOrgPolicy",
  2496. // "parameterOrder": [
  2497. // "resource"
  2498. // ],
  2499. // "parameters": {
  2500. // "resource": {
  2501. // "description": "The name of the resource to start computing the effective `Policy`.",
  2502. // "location": "path",
  2503. // "pattern": "^folders/[^/]+$",
  2504. // "required": true,
  2505. // "type": "string"
  2506. // }
  2507. // },
  2508. // "path": "v1/{+resource}:getEffectiveOrgPolicy",
  2509. // "request": {
  2510. // "$ref": "GetEffectiveOrgPolicyRequest"
  2511. // },
  2512. // "response": {
  2513. // "$ref": "OrgPolicy"
  2514. // },
  2515. // "scopes": [
  2516. // "https://www.googleapis.com/auth/cloud-platform",
  2517. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2518. // ]
  2519. // }
  2520. }
  2521. // method id "cloudresourcemanager.folders.getOrgPolicy":
  2522. type FoldersGetOrgPolicyCall struct {
  2523. s *Service
  2524. resource string
  2525. getorgpolicyrequest *GetOrgPolicyRequest
  2526. urlParams_ gensupport.URLParams
  2527. ctx_ context.Context
  2528. header_ http.Header
  2529. }
  2530. // GetOrgPolicy: Gets a `Policy` on a resource.
  2531. //
  2532. // If no `Policy` is set on the resource, a `Policy` is returned with
  2533. // default
  2534. // values including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`.
  2535. // The
  2536. // `etag` value can be used with `SetOrgPolicy()` to create or update
  2537. // a
  2538. // `Policy` during read-modify-write.
  2539. func (r *FoldersService) GetOrgPolicy(resource string, getorgpolicyrequest *GetOrgPolicyRequest) *FoldersGetOrgPolicyCall {
  2540. c := &FoldersGetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2541. c.resource = resource
  2542. c.getorgpolicyrequest = getorgpolicyrequest
  2543. return c
  2544. }
  2545. // Fields allows partial responses to be retrieved. See
  2546. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2547. // for more information.
  2548. func (c *FoldersGetOrgPolicyCall) Fields(s ...googleapi.Field) *FoldersGetOrgPolicyCall {
  2549. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2550. return c
  2551. }
  2552. // Context sets the context to be used in this call's Do method. Any
  2553. // pending HTTP request will be aborted if the provided context is
  2554. // canceled.
  2555. func (c *FoldersGetOrgPolicyCall) Context(ctx context.Context) *FoldersGetOrgPolicyCall {
  2556. c.ctx_ = ctx
  2557. return c
  2558. }
  2559. // Header returns an http.Header that can be modified by the caller to
  2560. // add HTTP headers to the request.
  2561. func (c *FoldersGetOrgPolicyCall) Header() http.Header {
  2562. if c.header_ == nil {
  2563. c.header_ = make(http.Header)
  2564. }
  2565. return c.header_
  2566. }
  2567. func (c *FoldersGetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  2568. reqHeaders := make(http.Header)
  2569. for k, v := range c.header_ {
  2570. reqHeaders[k] = v
  2571. }
  2572. reqHeaders.Set("User-Agent", c.s.userAgent())
  2573. var body io.Reader = nil
  2574. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getorgpolicyrequest)
  2575. if err != nil {
  2576. return nil, err
  2577. }
  2578. reqHeaders.Set("Content-Type", "application/json")
  2579. c.urlParams_.Set("alt", alt)
  2580. c.urlParams_.Set("prettyPrint", "false")
  2581. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getOrgPolicy")
  2582. urls += "?" + c.urlParams_.Encode()
  2583. req, err := http.NewRequest("POST", urls, body)
  2584. if err != nil {
  2585. return nil, err
  2586. }
  2587. req.Header = reqHeaders
  2588. googleapi.Expand(req.URL, map[string]string{
  2589. "resource": c.resource,
  2590. })
  2591. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2592. }
  2593. // Do executes the "cloudresourcemanager.folders.getOrgPolicy" call.
  2594. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  2595. // status code is an error. Response headers are in either
  2596. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  2597. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2598. // to check whether the returned error was because
  2599. // http.StatusNotModified was returned.
  2600. func (c *FoldersGetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  2601. gensupport.SetOptions(c.urlParams_, opts...)
  2602. res, err := c.doRequest("json")
  2603. if res != nil && res.StatusCode == http.StatusNotModified {
  2604. if res.Body != nil {
  2605. res.Body.Close()
  2606. }
  2607. return nil, &googleapi.Error{
  2608. Code: res.StatusCode,
  2609. Header: res.Header,
  2610. }
  2611. }
  2612. if err != nil {
  2613. return nil, err
  2614. }
  2615. defer googleapi.CloseBody(res)
  2616. if err := googleapi.CheckResponse(res); err != nil {
  2617. return nil, err
  2618. }
  2619. ret := &OrgPolicy{
  2620. ServerResponse: googleapi.ServerResponse{
  2621. Header: res.Header,
  2622. HTTPStatusCode: res.StatusCode,
  2623. },
  2624. }
  2625. target := &ret
  2626. if err := gensupport.DecodeResponse(target, res); err != nil {
  2627. return nil, err
  2628. }
  2629. return ret, nil
  2630. // {
  2631. // "description": "Gets a `Policy` on a resource.\n\nIf no `Policy` is set on the resource, a `Policy` is returned with default\nvalues including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`. The\n`etag` value can be used with `SetOrgPolicy()` to create or update a\n`Policy` during read-modify-write.",
  2632. // "flatPath": "v1/folders/{foldersId}:getOrgPolicy",
  2633. // "httpMethod": "POST",
  2634. // "id": "cloudresourcemanager.folders.getOrgPolicy",
  2635. // "parameterOrder": [
  2636. // "resource"
  2637. // ],
  2638. // "parameters": {
  2639. // "resource": {
  2640. // "description": "Name of the resource the `Policy` is set on.",
  2641. // "location": "path",
  2642. // "pattern": "^folders/[^/]+$",
  2643. // "required": true,
  2644. // "type": "string"
  2645. // }
  2646. // },
  2647. // "path": "v1/{+resource}:getOrgPolicy",
  2648. // "request": {
  2649. // "$ref": "GetOrgPolicyRequest"
  2650. // },
  2651. // "response": {
  2652. // "$ref": "OrgPolicy"
  2653. // },
  2654. // "scopes": [
  2655. // "https://www.googleapis.com/auth/cloud-platform",
  2656. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2657. // ]
  2658. // }
  2659. }
  2660. // method id "cloudresourcemanager.folders.listAvailableOrgPolicyConstraints":
  2661. type FoldersListAvailableOrgPolicyConstraintsCall struct {
  2662. s *Service
  2663. resource string
  2664. listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest
  2665. urlParams_ gensupport.URLParams
  2666. ctx_ context.Context
  2667. header_ http.Header
  2668. }
  2669. // ListAvailableOrgPolicyConstraints: Lists `Constraints` that could be
  2670. // applied on the specified resource.
  2671. func (r *FoldersService) ListAvailableOrgPolicyConstraints(resource string, listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest) *FoldersListAvailableOrgPolicyConstraintsCall {
  2672. c := &FoldersListAvailableOrgPolicyConstraintsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2673. c.resource = resource
  2674. c.listavailableorgpolicyconstraintsrequest = listavailableorgpolicyconstraintsrequest
  2675. return c
  2676. }
  2677. // Fields allows partial responses to be retrieved. See
  2678. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2679. // for more information.
  2680. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Fields(s ...googleapi.Field) *FoldersListAvailableOrgPolicyConstraintsCall {
  2681. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2682. return c
  2683. }
  2684. // Context sets the context to be used in this call's Do method. Any
  2685. // pending HTTP request will be aborted if the provided context is
  2686. // canceled.
  2687. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Context(ctx context.Context) *FoldersListAvailableOrgPolicyConstraintsCall {
  2688. c.ctx_ = ctx
  2689. return c
  2690. }
  2691. // Header returns an http.Header that can be modified by the caller to
  2692. // add HTTP headers to the request.
  2693. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Header() http.Header {
  2694. if c.header_ == nil {
  2695. c.header_ = make(http.Header)
  2696. }
  2697. return c.header_
  2698. }
  2699. func (c *FoldersListAvailableOrgPolicyConstraintsCall) doRequest(alt string) (*http.Response, error) {
  2700. reqHeaders := make(http.Header)
  2701. for k, v := range c.header_ {
  2702. reqHeaders[k] = v
  2703. }
  2704. reqHeaders.Set("User-Agent", c.s.userAgent())
  2705. var body io.Reader = nil
  2706. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listavailableorgpolicyconstraintsrequest)
  2707. if err != nil {
  2708. return nil, err
  2709. }
  2710. reqHeaders.Set("Content-Type", "application/json")
  2711. c.urlParams_.Set("alt", alt)
  2712. c.urlParams_.Set("prettyPrint", "false")
  2713. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listAvailableOrgPolicyConstraints")
  2714. urls += "?" + c.urlParams_.Encode()
  2715. req, err := http.NewRequest("POST", urls, body)
  2716. if err != nil {
  2717. return nil, err
  2718. }
  2719. req.Header = reqHeaders
  2720. googleapi.Expand(req.URL, map[string]string{
  2721. "resource": c.resource,
  2722. })
  2723. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2724. }
  2725. // Do executes the "cloudresourcemanager.folders.listAvailableOrgPolicyConstraints" call.
  2726. // Exactly one of *ListAvailableOrgPolicyConstraintsResponse or error
  2727. // will be non-nil. Any non-2xx status code is an error. Response
  2728. // headers are in either
  2729. // *ListAvailableOrgPolicyConstraintsResponse.ServerResponse.Header or
  2730. // (if a response was returned at all) in
  2731. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2732. // whether the returned error was because http.StatusNotModified was
  2733. // returned.
  2734. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Do(opts ...googleapi.CallOption) (*ListAvailableOrgPolicyConstraintsResponse, error) {
  2735. gensupport.SetOptions(c.urlParams_, opts...)
  2736. res, err := c.doRequest("json")
  2737. if res != nil && res.StatusCode == http.StatusNotModified {
  2738. if res.Body != nil {
  2739. res.Body.Close()
  2740. }
  2741. return nil, &googleapi.Error{
  2742. Code: res.StatusCode,
  2743. Header: res.Header,
  2744. }
  2745. }
  2746. if err != nil {
  2747. return nil, err
  2748. }
  2749. defer googleapi.CloseBody(res)
  2750. if err := googleapi.CheckResponse(res); err != nil {
  2751. return nil, err
  2752. }
  2753. ret := &ListAvailableOrgPolicyConstraintsResponse{
  2754. ServerResponse: googleapi.ServerResponse{
  2755. Header: res.Header,
  2756. HTTPStatusCode: res.StatusCode,
  2757. },
  2758. }
  2759. target := &ret
  2760. if err := gensupport.DecodeResponse(target, res); err != nil {
  2761. return nil, err
  2762. }
  2763. return ret, nil
  2764. // {
  2765. // "description": "Lists `Constraints` that could be applied on the specified resource.",
  2766. // "flatPath": "v1/folders/{foldersId}:listAvailableOrgPolicyConstraints",
  2767. // "httpMethod": "POST",
  2768. // "id": "cloudresourcemanager.folders.listAvailableOrgPolicyConstraints",
  2769. // "parameterOrder": [
  2770. // "resource"
  2771. // ],
  2772. // "parameters": {
  2773. // "resource": {
  2774. // "description": "Name of the resource to list `Constraints` for.",
  2775. // "location": "path",
  2776. // "pattern": "^folders/[^/]+$",
  2777. // "required": true,
  2778. // "type": "string"
  2779. // }
  2780. // },
  2781. // "path": "v1/{+resource}:listAvailableOrgPolicyConstraints",
  2782. // "request": {
  2783. // "$ref": "ListAvailableOrgPolicyConstraintsRequest"
  2784. // },
  2785. // "response": {
  2786. // "$ref": "ListAvailableOrgPolicyConstraintsResponse"
  2787. // },
  2788. // "scopes": [
  2789. // "https://www.googleapis.com/auth/cloud-platform",
  2790. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2791. // ]
  2792. // }
  2793. }
  2794. // Pages invokes f for each page of results.
  2795. // A non-nil error returned from f will halt the iteration.
  2796. // The provided context supersedes any context provided to the Context method.
  2797. func (c *FoldersListAvailableOrgPolicyConstraintsCall) Pages(ctx context.Context, f func(*ListAvailableOrgPolicyConstraintsResponse) error) error {
  2798. c.ctx_ = ctx
  2799. defer func(pt string) { c.listavailableorgpolicyconstraintsrequest.PageToken = pt }(c.listavailableorgpolicyconstraintsrequest.PageToken) // reset paging to original point
  2800. for {
  2801. x, err := c.Do()
  2802. if err != nil {
  2803. return err
  2804. }
  2805. if err := f(x); err != nil {
  2806. return err
  2807. }
  2808. if x.NextPageToken == "" {
  2809. return nil
  2810. }
  2811. c.listavailableorgpolicyconstraintsrequest.PageToken = x.NextPageToken
  2812. }
  2813. }
  2814. // method id "cloudresourcemanager.folders.listOrgPolicies":
  2815. type FoldersListOrgPoliciesCall struct {
  2816. s *Service
  2817. resource string
  2818. listorgpoliciesrequest *ListOrgPoliciesRequest
  2819. urlParams_ gensupport.URLParams
  2820. ctx_ context.Context
  2821. header_ http.Header
  2822. }
  2823. // ListOrgPolicies: Lists all the `Policies` set for a particular
  2824. // resource.
  2825. func (r *FoldersService) ListOrgPolicies(resource string, listorgpoliciesrequest *ListOrgPoliciesRequest) *FoldersListOrgPoliciesCall {
  2826. c := &FoldersListOrgPoliciesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2827. c.resource = resource
  2828. c.listorgpoliciesrequest = listorgpoliciesrequest
  2829. return c
  2830. }
  2831. // Fields allows partial responses to be retrieved. See
  2832. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2833. // for more information.
  2834. func (c *FoldersListOrgPoliciesCall) Fields(s ...googleapi.Field) *FoldersListOrgPoliciesCall {
  2835. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2836. return c
  2837. }
  2838. // Context sets the context to be used in this call's Do method. Any
  2839. // pending HTTP request will be aborted if the provided context is
  2840. // canceled.
  2841. func (c *FoldersListOrgPoliciesCall) Context(ctx context.Context) *FoldersListOrgPoliciesCall {
  2842. c.ctx_ = ctx
  2843. return c
  2844. }
  2845. // Header returns an http.Header that can be modified by the caller to
  2846. // add HTTP headers to the request.
  2847. func (c *FoldersListOrgPoliciesCall) Header() http.Header {
  2848. if c.header_ == nil {
  2849. c.header_ = make(http.Header)
  2850. }
  2851. return c.header_
  2852. }
  2853. func (c *FoldersListOrgPoliciesCall) doRequest(alt string) (*http.Response, error) {
  2854. reqHeaders := make(http.Header)
  2855. for k, v := range c.header_ {
  2856. reqHeaders[k] = v
  2857. }
  2858. reqHeaders.Set("User-Agent", c.s.userAgent())
  2859. var body io.Reader = nil
  2860. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listorgpoliciesrequest)
  2861. if err != nil {
  2862. return nil, err
  2863. }
  2864. reqHeaders.Set("Content-Type", "application/json")
  2865. c.urlParams_.Set("alt", alt)
  2866. c.urlParams_.Set("prettyPrint", "false")
  2867. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listOrgPolicies")
  2868. urls += "?" + c.urlParams_.Encode()
  2869. req, err := http.NewRequest("POST", urls, body)
  2870. if err != nil {
  2871. return nil, err
  2872. }
  2873. req.Header = reqHeaders
  2874. googleapi.Expand(req.URL, map[string]string{
  2875. "resource": c.resource,
  2876. })
  2877. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2878. }
  2879. // Do executes the "cloudresourcemanager.folders.listOrgPolicies" call.
  2880. // Exactly one of *ListOrgPoliciesResponse or error will be non-nil. Any
  2881. // non-2xx status code is an error. Response headers are in either
  2882. // *ListOrgPoliciesResponse.ServerResponse.Header or (if a response was
  2883. // returned at all) in error.(*googleapi.Error).Header. Use
  2884. // googleapi.IsNotModified to check whether the returned error was
  2885. // because http.StatusNotModified was returned.
  2886. func (c *FoldersListOrgPoliciesCall) Do(opts ...googleapi.CallOption) (*ListOrgPoliciesResponse, error) {
  2887. gensupport.SetOptions(c.urlParams_, opts...)
  2888. res, err := c.doRequest("json")
  2889. if res != nil && res.StatusCode == http.StatusNotModified {
  2890. if res.Body != nil {
  2891. res.Body.Close()
  2892. }
  2893. return nil, &googleapi.Error{
  2894. Code: res.StatusCode,
  2895. Header: res.Header,
  2896. }
  2897. }
  2898. if err != nil {
  2899. return nil, err
  2900. }
  2901. defer googleapi.CloseBody(res)
  2902. if err := googleapi.CheckResponse(res); err != nil {
  2903. return nil, err
  2904. }
  2905. ret := &ListOrgPoliciesResponse{
  2906. ServerResponse: googleapi.ServerResponse{
  2907. Header: res.Header,
  2908. HTTPStatusCode: res.StatusCode,
  2909. },
  2910. }
  2911. target := &ret
  2912. if err := gensupport.DecodeResponse(target, res); err != nil {
  2913. return nil, err
  2914. }
  2915. return ret, nil
  2916. // {
  2917. // "description": "Lists all the `Policies` set for a particular resource.",
  2918. // "flatPath": "v1/folders/{foldersId}:listOrgPolicies",
  2919. // "httpMethod": "POST",
  2920. // "id": "cloudresourcemanager.folders.listOrgPolicies",
  2921. // "parameterOrder": [
  2922. // "resource"
  2923. // ],
  2924. // "parameters": {
  2925. // "resource": {
  2926. // "description": "Name of the resource to list Policies for.",
  2927. // "location": "path",
  2928. // "pattern": "^folders/[^/]+$",
  2929. // "required": true,
  2930. // "type": "string"
  2931. // }
  2932. // },
  2933. // "path": "v1/{+resource}:listOrgPolicies",
  2934. // "request": {
  2935. // "$ref": "ListOrgPoliciesRequest"
  2936. // },
  2937. // "response": {
  2938. // "$ref": "ListOrgPoliciesResponse"
  2939. // },
  2940. // "scopes": [
  2941. // "https://www.googleapis.com/auth/cloud-platform",
  2942. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  2943. // ]
  2944. // }
  2945. }
  2946. // Pages invokes f for each page of results.
  2947. // A non-nil error returned from f will halt the iteration.
  2948. // The provided context supersedes any context provided to the Context method.
  2949. func (c *FoldersListOrgPoliciesCall) Pages(ctx context.Context, f func(*ListOrgPoliciesResponse) error) error {
  2950. c.ctx_ = ctx
  2951. defer func(pt string) { c.listorgpoliciesrequest.PageToken = pt }(c.listorgpoliciesrequest.PageToken) // reset paging to original point
  2952. for {
  2953. x, err := c.Do()
  2954. if err != nil {
  2955. return err
  2956. }
  2957. if err := f(x); err != nil {
  2958. return err
  2959. }
  2960. if x.NextPageToken == "" {
  2961. return nil
  2962. }
  2963. c.listorgpoliciesrequest.PageToken = x.NextPageToken
  2964. }
  2965. }
  2966. // method id "cloudresourcemanager.folders.setOrgPolicy":
  2967. type FoldersSetOrgPolicyCall struct {
  2968. s *Service
  2969. resource string
  2970. setorgpolicyrequest *SetOrgPolicyRequest
  2971. urlParams_ gensupport.URLParams
  2972. ctx_ context.Context
  2973. header_ http.Header
  2974. }
  2975. // SetOrgPolicy: Updates the specified `Policy` on the resource. Creates
  2976. // a new `Policy` for
  2977. // that `Constraint` on the resource if one does not exist.
  2978. //
  2979. // Not supplying an `etag` on the request `Policy` results in an
  2980. // unconditional
  2981. // write of the `Policy`.
  2982. func (r *FoldersService) SetOrgPolicy(resource string, setorgpolicyrequest *SetOrgPolicyRequest) *FoldersSetOrgPolicyCall {
  2983. c := &FoldersSetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2984. c.resource = resource
  2985. c.setorgpolicyrequest = setorgpolicyrequest
  2986. return c
  2987. }
  2988. // Fields allows partial responses to be retrieved. See
  2989. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2990. // for more information.
  2991. func (c *FoldersSetOrgPolicyCall) Fields(s ...googleapi.Field) *FoldersSetOrgPolicyCall {
  2992. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2993. return c
  2994. }
  2995. // Context sets the context to be used in this call's Do method. Any
  2996. // pending HTTP request will be aborted if the provided context is
  2997. // canceled.
  2998. func (c *FoldersSetOrgPolicyCall) Context(ctx context.Context) *FoldersSetOrgPolicyCall {
  2999. c.ctx_ = ctx
  3000. return c
  3001. }
  3002. // Header returns an http.Header that can be modified by the caller to
  3003. // add HTTP headers to the request.
  3004. func (c *FoldersSetOrgPolicyCall) Header() http.Header {
  3005. if c.header_ == nil {
  3006. c.header_ = make(http.Header)
  3007. }
  3008. return c.header_
  3009. }
  3010. func (c *FoldersSetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  3011. reqHeaders := make(http.Header)
  3012. for k, v := range c.header_ {
  3013. reqHeaders[k] = v
  3014. }
  3015. reqHeaders.Set("User-Agent", c.s.userAgent())
  3016. var body io.Reader = nil
  3017. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setorgpolicyrequest)
  3018. if err != nil {
  3019. return nil, err
  3020. }
  3021. reqHeaders.Set("Content-Type", "application/json")
  3022. c.urlParams_.Set("alt", alt)
  3023. c.urlParams_.Set("prettyPrint", "false")
  3024. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setOrgPolicy")
  3025. urls += "?" + c.urlParams_.Encode()
  3026. req, err := http.NewRequest("POST", urls, body)
  3027. if err != nil {
  3028. return nil, err
  3029. }
  3030. req.Header = reqHeaders
  3031. googleapi.Expand(req.URL, map[string]string{
  3032. "resource": c.resource,
  3033. })
  3034. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3035. }
  3036. // Do executes the "cloudresourcemanager.folders.setOrgPolicy" call.
  3037. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  3038. // status code is an error. Response headers are in either
  3039. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  3040. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3041. // to check whether the returned error was because
  3042. // http.StatusNotModified was returned.
  3043. func (c *FoldersSetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  3044. gensupport.SetOptions(c.urlParams_, opts...)
  3045. res, err := c.doRequest("json")
  3046. if res != nil && res.StatusCode == http.StatusNotModified {
  3047. if res.Body != nil {
  3048. res.Body.Close()
  3049. }
  3050. return nil, &googleapi.Error{
  3051. Code: res.StatusCode,
  3052. Header: res.Header,
  3053. }
  3054. }
  3055. if err != nil {
  3056. return nil, err
  3057. }
  3058. defer googleapi.CloseBody(res)
  3059. if err := googleapi.CheckResponse(res); err != nil {
  3060. return nil, err
  3061. }
  3062. ret := &OrgPolicy{
  3063. ServerResponse: googleapi.ServerResponse{
  3064. Header: res.Header,
  3065. HTTPStatusCode: res.StatusCode,
  3066. },
  3067. }
  3068. target := &ret
  3069. if err := gensupport.DecodeResponse(target, res); err != nil {
  3070. return nil, err
  3071. }
  3072. return ret, nil
  3073. // {
  3074. // "description": "Updates the specified `Policy` on the resource. Creates a new `Policy` for\nthat `Constraint` on the resource if one does not exist.\n\nNot supplying an `etag` on the request `Policy` results in an unconditional\nwrite of the `Policy`.",
  3075. // "flatPath": "v1/folders/{foldersId}:setOrgPolicy",
  3076. // "httpMethod": "POST",
  3077. // "id": "cloudresourcemanager.folders.setOrgPolicy",
  3078. // "parameterOrder": [
  3079. // "resource"
  3080. // ],
  3081. // "parameters": {
  3082. // "resource": {
  3083. // "description": "Resource name of the resource to attach the `Policy`.",
  3084. // "location": "path",
  3085. // "pattern": "^folders/[^/]+$",
  3086. // "required": true,
  3087. // "type": "string"
  3088. // }
  3089. // },
  3090. // "path": "v1/{+resource}:setOrgPolicy",
  3091. // "request": {
  3092. // "$ref": "SetOrgPolicyRequest"
  3093. // },
  3094. // "response": {
  3095. // "$ref": "OrgPolicy"
  3096. // },
  3097. // "scopes": [
  3098. // "https://www.googleapis.com/auth/cloud-platform"
  3099. // ]
  3100. // }
  3101. }
  3102. // method id "cloudresourcemanager.liens.create":
  3103. type LiensCreateCall struct {
  3104. s *Service
  3105. lien *Lien
  3106. urlParams_ gensupport.URLParams
  3107. ctx_ context.Context
  3108. header_ http.Header
  3109. }
  3110. // Create: Create a Lien which applies to the resource denoted by the
  3111. // `parent` field.
  3112. //
  3113. // Callers of this method will require permission on the `parent`
  3114. // resource.
  3115. // For example, applying to `projects/1234` requires
  3116. // permission
  3117. // `resourcemanager.projects.updateLiens`.
  3118. //
  3119. // NOTE: Some resources may limit the number of Liens which may be
  3120. // applied.
  3121. func (r *LiensService) Create(lien *Lien) *LiensCreateCall {
  3122. c := &LiensCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3123. c.lien = lien
  3124. return c
  3125. }
  3126. // Fields allows partial responses to be retrieved. See
  3127. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3128. // for more information.
  3129. func (c *LiensCreateCall) Fields(s ...googleapi.Field) *LiensCreateCall {
  3130. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3131. return c
  3132. }
  3133. // Context sets the context to be used in this call's Do method. Any
  3134. // pending HTTP request will be aborted if the provided context is
  3135. // canceled.
  3136. func (c *LiensCreateCall) Context(ctx context.Context) *LiensCreateCall {
  3137. c.ctx_ = ctx
  3138. return c
  3139. }
  3140. // Header returns an http.Header that can be modified by the caller to
  3141. // add HTTP headers to the request.
  3142. func (c *LiensCreateCall) Header() http.Header {
  3143. if c.header_ == nil {
  3144. c.header_ = make(http.Header)
  3145. }
  3146. return c.header_
  3147. }
  3148. func (c *LiensCreateCall) doRequest(alt string) (*http.Response, error) {
  3149. reqHeaders := make(http.Header)
  3150. for k, v := range c.header_ {
  3151. reqHeaders[k] = v
  3152. }
  3153. reqHeaders.Set("User-Agent", c.s.userAgent())
  3154. var body io.Reader = nil
  3155. body, err := googleapi.WithoutDataWrapper.JSONReader(c.lien)
  3156. if err != nil {
  3157. return nil, err
  3158. }
  3159. reqHeaders.Set("Content-Type", "application/json")
  3160. c.urlParams_.Set("alt", alt)
  3161. c.urlParams_.Set("prettyPrint", "false")
  3162. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/liens")
  3163. urls += "?" + c.urlParams_.Encode()
  3164. req, err := http.NewRequest("POST", urls, body)
  3165. if err != nil {
  3166. return nil, err
  3167. }
  3168. req.Header = reqHeaders
  3169. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3170. }
  3171. // Do executes the "cloudresourcemanager.liens.create" call.
  3172. // Exactly one of *Lien or error will be non-nil. Any non-2xx status
  3173. // code is an error. Response headers are in either
  3174. // *Lien.ServerResponse.Header or (if a response was returned at all) in
  3175. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3176. // whether the returned error was because http.StatusNotModified was
  3177. // returned.
  3178. func (c *LiensCreateCall) Do(opts ...googleapi.CallOption) (*Lien, error) {
  3179. gensupport.SetOptions(c.urlParams_, opts...)
  3180. res, err := c.doRequest("json")
  3181. if res != nil && res.StatusCode == http.StatusNotModified {
  3182. if res.Body != nil {
  3183. res.Body.Close()
  3184. }
  3185. return nil, &googleapi.Error{
  3186. Code: res.StatusCode,
  3187. Header: res.Header,
  3188. }
  3189. }
  3190. if err != nil {
  3191. return nil, err
  3192. }
  3193. defer googleapi.CloseBody(res)
  3194. if err := googleapi.CheckResponse(res); err != nil {
  3195. return nil, err
  3196. }
  3197. ret := &Lien{
  3198. ServerResponse: googleapi.ServerResponse{
  3199. Header: res.Header,
  3200. HTTPStatusCode: res.StatusCode,
  3201. },
  3202. }
  3203. target := &ret
  3204. if err := gensupport.DecodeResponse(target, res); err != nil {
  3205. return nil, err
  3206. }
  3207. return ret, nil
  3208. // {
  3209. // "description": "Create a Lien which applies to the resource denoted by the `parent` field.\n\nCallers of this method will require permission on the `parent` resource.\nFor example, applying to `projects/1234` requires permission\n`resourcemanager.projects.updateLiens`.\n\nNOTE: Some resources may limit the number of Liens which may be applied.",
  3210. // "flatPath": "v1/liens",
  3211. // "httpMethod": "POST",
  3212. // "id": "cloudresourcemanager.liens.create",
  3213. // "parameterOrder": [],
  3214. // "parameters": {},
  3215. // "path": "v1/liens",
  3216. // "request": {
  3217. // "$ref": "Lien"
  3218. // },
  3219. // "response": {
  3220. // "$ref": "Lien"
  3221. // },
  3222. // "scopes": [
  3223. // "https://www.googleapis.com/auth/cloud-platform",
  3224. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3225. // ]
  3226. // }
  3227. }
  3228. // method id "cloudresourcemanager.liens.delete":
  3229. type LiensDeleteCall struct {
  3230. s *Service
  3231. nameid string
  3232. urlParams_ gensupport.URLParams
  3233. ctx_ context.Context
  3234. header_ http.Header
  3235. }
  3236. // Delete: Delete a Lien by `name`.
  3237. //
  3238. // Callers of this method will require permission on the `parent`
  3239. // resource.
  3240. // For example, a Lien with a `parent` of `projects/1234` requires
  3241. // permission
  3242. // `resourcemanager.projects.updateLiens`.
  3243. func (r *LiensService) Delete(nameid string) *LiensDeleteCall {
  3244. c := &LiensDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3245. c.nameid = nameid
  3246. return c
  3247. }
  3248. // Fields allows partial responses to be retrieved. See
  3249. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3250. // for more information.
  3251. func (c *LiensDeleteCall) Fields(s ...googleapi.Field) *LiensDeleteCall {
  3252. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3253. return c
  3254. }
  3255. // Context sets the context to be used in this call's Do method. Any
  3256. // pending HTTP request will be aborted if the provided context is
  3257. // canceled.
  3258. func (c *LiensDeleteCall) Context(ctx context.Context) *LiensDeleteCall {
  3259. c.ctx_ = ctx
  3260. return c
  3261. }
  3262. // Header returns an http.Header that can be modified by the caller to
  3263. // add HTTP headers to the request.
  3264. func (c *LiensDeleteCall) Header() http.Header {
  3265. if c.header_ == nil {
  3266. c.header_ = make(http.Header)
  3267. }
  3268. return c.header_
  3269. }
  3270. func (c *LiensDeleteCall) doRequest(alt string) (*http.Response, error) {
  3271. reqHeaders := make(http.Header)
  3272. for k, v := range c.header_ {
  3273. reqHeaders[k] = v
  3274. }
  3275. reqHeaders.Set("User-Agent", c.s.userAgent())
  3276. var body io.Reader = nil
  3277. c.urlParams_.Set("alt", alt)
  3278. c.urlParams_.Set("prettyPrint", "false")
  3279. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3280. urls += "?" + c.urlParams_.Encode()
  3281. req, err := http.NewRequest("DELETE", urls, body)
  3282. if err != nil {
  3283. return nil, err
  3284. }
  3285. req.Header = reqHeaders
  3286. googleapi.Expand(req.URL, map[string]string{
  3287. "name": c.nameid,
  3288. })
  3289. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3290. }
  3291. // Do executes the "cloudresourcemanager.liens.delete" call.
  3292. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3293. // code is an error. Response headers are in either
  3294. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3295. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3296. // check whether the returned error was because http.StatusNotModified
  3297. // was returned.
  3298. func (c *LiensDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3299. gensupport.SetOptions(c.urlParams_, opts...)
  3300. res, err := c.doRequest("json")
  3301. if res != nil && res.StatusCode == http.StatusNotModified {
  3302. if res.Body != nil {
  3303. res.Body.Close()
  3304. }
  3305. return nil, &googleapi.Error{
  3306. Code: res.StatusCode,
  3307. Header: res.Header,
  3308. }
  3309. }
  3310. if err != nil {
  3311. return nil, err
  3312. }
  3313. defer googleapi.CloseBody(res)
  3314. if err := googleapi.CheckResponse(res); err != nil {
  3315. return nil, err
  3316. }
  3317. ret := &Empty{
  3318. ServerResponse: googleapi.ServerResponse{
  3319. Header: res.Header,
  3320. HTTPStatusCode: res.StatusCode,
  3321. },
  3322. }
  3323. target := &ret
  3324. if err := gensupport.DecodeResponse(target, res); err != nil {
  3325. return nil, err
  3326. }
  3327. return ret, nil
  3328. // {
  3329. // "description": "Delete a Lien by `name`.\n\nCallers of this method will require permission on the `parent` resource.\nFor example, a Lien with a `parent` of `projects/1234` requires permission\n`resourcemanager.projects.updateLiens`.",
  3330. // "flatPath": "v1/liens/{liensId}",
  3331. // "httpMethod": "DELETE",
  3332. // "id": "cloudresourcemanager.liens.delete",
  3333. // "parameterOrder": [
  3334. // "name"
  3335. // ],
  3336. // "parameters": {
  3337. // "name": {
  3338. // "description": "The name/identifier of the Lien to delete.",
  3339. // "location": "path",
  3340. // "pattern": "^liens/.+$",
  3341. // "required": true,
  3342. // "type": "string"
  3343. // }
  3344. // },
  3345. // "path": "v1/{+name}",
  3346. // "response": {
  3347. // "$ref": "Empty"
  3348. // },
  3349. // "scopes": [
  3350. // "https://www.googleapis.com/auth/cloud-platform",
  3351. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3352. // ]
  3353. // }
  3354. }
  3355. // method id "cloudresourcemanager.liens.get":
  3356. type LiensGetCall struct {
  3357. s *Service
  3358. nameid string
  3359. urlParams_ gensupport.URLParams
  3360. ifNoneMatch_ string
  3361. ctx_ context.Context
  3362. header_ http.Header
  3363. }
  3364. // Get: Retrieve a Lien by `name`.
  3365. //
  3366. // Callers of this method will require permission on the `parent`
  3367. // resource.
  3368. // For example, a Lien with a `parent` of `projects/1234` requires
  3369. // permission
  3370. // requires permission `resourcemanager.projects.get`
  3371. // or
  3372. // `resourcemanager.projects.updateLiens`.
  3373. func (r *LiensService) Get(nameid string) *LiensGetCall {
  3374. c := &LiensGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3375. c.nameid = nameid
  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 *LiensGetCall) Fields(s ...googleapi.Field) *LiensGetCall {
  3382. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3383. return c
  3384. }
  3385. // IfNoneMatch sets the optional parameter which makes the operation
  3386. // fail if the object's ETag matches the given value. This is useful for
  3387. // getting updates only after the object has changed since the last
  3388. // request. Use googleapi.IsNotModified to check whether the response
  3389. // error from Do is the result of In-None-Match.
  3390. func (c *LiensGetCall) IfNoneMatch(entityTag string) *LiensGetCall {
  3391. c.ifNoneMatch_ = entityTag
  3392. return c
  3393. }
  3394. // Context sets the context to be used in this call's Do method. Any
  3395. // pending HTTP request will be aborted if the provided context is
  3396. // canceled.
  3397. func (c *LiensGetCall) Context(ctx context.Context) *LiensGetCall {
  3398. c.ctx_ = ctx
  3399. return c
  3400. }
  3401. // Header returns an http.Header that can be modified by the caller to
  3402. // add HTTP headers to the request.
  3403. func (c *LiensGetCall) Header() http.Header {
  3404. if c.header_ == nil {
  3405. c.header_ = make(http.Header)
  3406. }
  3407. return c.header_
  3408. }
  3409. func (c *LiensGetCall) doRequest(alt string) (*http.Response, error) {
  3410. reqHeaders := make(http.Header)
  3411. for k, v := range c.header_ {
  3412. reqHeaders[k] = v
  3413. }
  3414. reqHeaders.Set("User-Agent", c.s.userAgent())
  3415. if c.ifNoneMatch_ != "" {
  3416. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3417. }
  3418. var body io.Reader = nil
  3419. c.urlParams_.Set("alt", alt)
  3420. c.urlParams_.Set("prettyPrint", "false")
  3421. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3422. urls += "?" + c.urlParams_.Encode()
  3423. req, err := http.NewRequest("GET", urls, body)
  3424. if err != nil {
  3425. return nil, err
  3426. }
  3427. req.Header = reqHeaders
  3428. googleapi.Expand(req.URL, map[string]string{
  3429. "name": c.nameid,
  3430. })
  3431. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3432. }
  3433. // Do executes the "cloudresourcemanager.liens.get" call.
  3434. // Exactly one of *Lien or error will be non-nil. Any non-2xx status
  3435. // code is an error. Response headers are in either
  3436. // *Lien.ServerResponse.Header or (if a response was returned at all) in
  3437. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3438. // whether the returned error was because http.StatusNotModified was
  3439. // returned.
  3440. func (c *LiensGetCall) Do(opts ...googleapi.CallOption) (*Lien, error) {
  3441. gensupport.SetOptions(c.urlParams_, opts...)
  3442. res, err := c.doRequest("json")
  3443. if res != nil && res.StatusCode == http.StatusNotModified {
  3444. if res.Body != nil {
  3445. res.Body.Close()
  3446. }
  3447. return nil, &googleapi.Error{
  3448. Code: res.StatusCode,
  3449. Header: res.Header,
  3450. }
  3451. }
  3452. if err != nil {
  3453. return nil, err
  3454. }
  3455. defer googleapi.CloseBody(res)
  3456. if err := googleapi.CheckResponse(res); err != nil {
  3457. return nil, err
  3458. }
  3459. ret := &Lien{
  3460. ServerResponse: googleapi.ServerResponse{
  3461. Header: res.Header,
  3462. HTTPStatusCode: res.StatusCode,
  3463. },
  3464. }
  3465. target := &ret
  3466. if err := gensupport.DecodeResponse(target, res); err != nil {
  3467. return nil, err
  3468. }
  3469. return ret, nil
  3470. // {
  3471. // "description": "Retrieve a Lien by `name`.\n\nCallers of this method will require permission on the `parent` resource.\nFor example, a Lien with a `parent` of `projects/1234` requires permission\nrequires permission `resourcemanager.projects.get` or\n`resourcemanager.projects.updateLiens`.",
  3472. // "flatPath": "v1/liens/{liensId}",
  3473. // "httpMethod": "GET",
  3474. // "id": "cloudresourcemanager.liens.get",
  3475. // "parameterOrder": [
  3476. // "name"
  3477. // ],
  3478. // "parameters": {
  3479. // "name": {
  3480. // "description": "The name/identifier of the Lien.",
  3481. // "location": "path",
  3482. // "pattern": "^liens/.+$",
  3483. // "required": true,
  3484. // "type": "string"
  3485. // }
  3486. // },
  3487. // "path": "v1/{+name}",
  3488. // "response": {
  3489. // "$ref": "Lien"
  3490. // },
  3491. // "scopes": [
  3492. // "https://www.googleapis.com/auth/cloud-platform",
  3493. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3494. // ]
  3495. // }
  3496. }
  3497. // method id "cloudresourcemanager.liens.list":
  3498. type LiensListCall struct {
  3499. s *Service
  3500. urlParams_ gensupport.URLParams
  3501. ifNoneMatch_ string
  3502. ctx_ context.Context
  3503. header_ http.Header
  3504. }
  3505. // List: List all Liens applied to the `parent` resource.
  3506. //
  3507. // Callers of this method will require permission on the `parent`
  3508. // resource.
  3509. // For example, a Lien with a `parent` of `projects/1234` requires
  3510. // permission
  3511. // `resourcemanager.projects.get`.
  3512. func (r *LiensService) List() *LiensListCall {
  3513. c := &LiensListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3514. return c
  3515. }
  3516. // PageSize sets the optional parameter "pageSize": The maximum number
  3517. // of items to return. This is a suggestion for the server.
  3518. func (c *LiensListCall) PageSize(pageSize int64) *LiensListCall {
  3519. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3520. return c
  3521. }
  3522. // PageToken sets the optional parameter "pageToken": The
  3523. // `next_page_token` value returned from a previous List request, if
  3524. // any.
  3525. func (c *LiensListCall) PageToken(pageToken string) *LiensListCall {
  3526. c.urlParams_.Set("pageToken", pageToken)
  3527. return c
  3528. }
  3529. // Parent sets the optional parameter "parent": The name of the resource
  3530. // to list all attached Liens.
  3531. // For example, `projects/1234`.
  3532. func (c *LiensListCall) Parent(parent string) *LiensListCall {
  3533. c.urlParams_.Set("parent", parent)
  3534. return c
  3535. }
  3536. // Fields allows partial responses to be retrieved. See
  3537. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3538. // for more information.
  3539. func (c *LiensListCall) Fields(s ...googleapi.Field) *LiensListCall {
  3540. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3541. return c
  3542. }
  3543. // IfNoneMatch sets the optional parameter which makes the operation
  3544. // fail if the object's ETag matches the given value. This is useful for
  3545. // getting updates only after the object has changed since the last
  3546. // request. Use googleapi.IsNotModified to check whether the response
  3547. // error from Do is the result of In-None-Match.
  3548. func (c *LiensListCall) IfNoneMatch(entityTag string) *LiensListCall {
  3549. c.ifNoneMatch_ = entityTag
  3550. return c
  3551. }
  3552. // Context sets the context to be used in this call's Do method. Any
  3553. // pending HTTP request will be aborted if the provided context is
  3554. // canceled.
  3555. func (c *LiensListCall) Context(ctx context.Context) *LiensListCall {
  3556. c.ctx_ = ctx
  3557. return c
  3558. }
  3559. // Header returns an http.Header that can be modified by the caller to
  3560. // add HTTP headers to the request.
  3561. func (c *LiensListCall) Header() http.Header {
  3562. if c.header_ == nil {
  3563. c.header_ = make(http.Header)
  3564. }
  3565. return c.header_
  3566. }
  3567. func (c *LiensListCall) doRequest(alt string) (*http.Response, error) {
  3568. reqHeaders := make(http.Header)
  3569. for k, v := range c.header_ {
  3570. reqHeaders[k] = v
  3571. }
  3572. reqHeaders.Set("User-Agent", c.s.userAgent())
  3573. if c.ifNoneMatch_ != "" {
  3574. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3575. }
  3576. var body io.Reader = nil
  3577. c.urlParams_.Set("alt", alt)
  3578. c.urlParams_.Set("prettyPrint", "false")
  3579. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/liens")
  3580. urls += "?" + c.urlParams_.Encode()
  3581. req, err := http.NewRequest("GET", urls, body)
  3582. if err != nil {
  3583. return nil, err
  3584. }
  3585. req.Header = reqHeaders
  3586. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3587. }
  3588. // Do executes the "cloudresourcemanager.liens.list" call.
  3589. // Exactly one of *ListLiensResponse or error will be non-nil. Any
  3590. // non-2xx status code is an error. Response headers are in either
  3591. // *ListLiensResponse.ServerResponse.Header or (if a response was
  3592. // returned at all) in error.(*googleapi.Error).Header. Use
  3593. // googleapi.IsNotModified to check whether the returned error was
  3594. // because http.StatusNotModified was returned.
  3595. func (c *LiensListCall) Do(opts ...googleapi.CallOption) (*ListLiensResponse, error) {
  3596. gensupport.SetOptions(c.urlParams_, opts...)
  3597. res, err := c.doRequest("json")
  3598. if res != nil && res.StatusCode == http.StatusNotModified {
  3599. if res.Body != nil {
  3600. res.Body.Close()
  3601. }
  3602. return nil, &googleapi.Error{
  3603. Code: res.StatusCode,
  3604. Header: res.Header,
  3605. }
  3606. }
  3607. if err != nil {
  3608. return nil, err
  3609. }
  3610. defer googleapi.CloseBody(res)
  3611. if err := googleapi.CheckResponse(res); err != nil {
  3612. return nil, err
  3613. }
  3614. ret := &ListLiensResponse{
  3615. ServerResponse: googleapi.ServerResponse{
  3616. Header: res.Header,
  3617. HTTPStatusCode: res.StatusCode,
  3618. },
  3619. }
  3620. target := &ret
  3621. if err := gensupport.DecodeResponse(target, res); err != nil {
  3622. return nil, err
  3623. }
  3624. return ret, nil
  3625. // {
  3626. // "description": "List all Liens applied to the `parent` resource.\n\nCallers of this method will require permission on the `parent` resource.\nFor example, a Lien with a `parent` of `projects/1234` requires permission\n`resourcemanager.projects.get`.",
  3627. // "flatPath": "v1/liens",
  3628. // "httpMethod": "GET",
  3629. // "id": "cloudresourcemanager.liens.list",
  3630. // "parameterOrder": [],
  3631. // "parameters": {
  3632. // "pageSize": {
  3633. // "description": "The maximum number of items to return. This is a suggestion for the server.",
  3634. // "format": "int32",
  3635. // "location": "query",
  3636. // "type": "integer"
  3637. // },
  3638. // "pageToken": {
  3639. // "description": "The `next_page_token` value returned from a previous List request, if any.",
  3640. // "location": "query",
  3641. // "type": "string"
  3642. // },
  3643. // "parent": {
  3644. // "description": "The name of the resource to list all attached Liens.\nFor example, `projects/1234`.",
  3645. // "location": "query",
  3646. // "type": "string"
  3647. // }
  3648. // },
  3649. // "path": "v1/liens",
  3650. // "response": {
  3651. // "$ref": "ListLiensResponse"
  3652. // },
  3653. // "scopes": [
  3654. // "https://www.googleapis.com/auth/cloud-platform",
  3655. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3656. // ]
  3657. // }
  3658. }
  3659. // Pages invokes f for each page of results.
  3660. // A non-nil error returned from f will halt the iteration.
  3661. // The provided context supersedes any context provided to the Context method.
  3662. func (c *LiensListCall) Pages(ctx context.Context, f func(*ListLiensResponse) error) error {
  3663. c.ctx_ = ctx
  3664. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3665. for {
  3666. x, err := c.Do()
  3667. if err != nil {
  3668. return err
  3669. }
  3670. if err := f(x); err != nil {
  3671. return err
  3672. }
  3673. if x.NextPageToken == "" {
  3674. return nil
  3675. }
  3676. c.PageToken(x.NextPageToken)
  3677. }
  3678. }
  3679. // method id "cloudresourcemanager.operations.get":
  3680. type OperationsGetCall struct {
  3681. s *Service
  3682. name string
  3683. urlParams_ gensupport.URLParams
  3684. ifNoneMatch_ string
  3685. ctx_ context.Context
  3686. header_ http.Header
  3687. }
  3688. // Get: Gets the latest state of a long-running operation. Clients can
  3689. // use this
  3690. // method to poll the operation result at intervals as recommended by
  3691. // the API
  3692. // service.
  3693. func (r *OperationsService) Get(name string) *OperationsGetCall {
  3694. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3695. c.name = name
  3696. return c
  3697. }
  3698. // Fields allows partial responses to be retrieved. See
  3699. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3700. // for more information.
  3701. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  3702. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3703. return c
  3704. }
  3705. // IfNoneMatch sets the optional parameter which makes the operation
  3706. // fail if the object's ETag matches the given value. This is useful for
  3707. // getting updates only after the object has changed since the last
  3708. // request. Use googleapi.IsNotModified to check whether the response
  3709. // error from Do is the result of In-None-Match.
  3710. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  3711. c.ifNoneMatch_ = entityTag
  3712. return c
  3713. }
  3714. // Context sets the context to be used in this call's Do method. Any
  3715. // pending HTTP request will be aborted if the provided context is
  3716. // canceled.
  3717. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  3718. c.ctx_ = ctx
  3719. return c
  3720. }
  3721. // Header returns an http.Header that can be modified by the caller to
  3722. // add HTTP headers to the request.
  3723. func (c *OperationsGetCall) Header() http.Header {
  3724. if c.header_ == nil {
  3725. c.header_ = make(http.Header)
  3726. }
  3727. return c.header_
  3728. }
  3729. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  3730. reqHeaders := make(http.Header)
  3731. for k, v := range c.header_ {
  3732. reqHeaders[k] = v
  3733. }
  3734. reqHeaders.Set("User-Agent", c.s.userAgent())
  3735. if c.ifNoneMatch_ != "" {
  3736. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3737. }
  3738. var body io.Reader = nil
  3739. c.urlParams_.Set("alt", alt)
  3740. c.urlParams_.Set("prettyPrint", "false")
  3741. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3742. urls += "?" + c.urlParams_.Encode()
  3743. req, err := http.NewRequest("GET", urls, body)
  3744. if err != nil {
  3745. return nil, err
  3746. }
  3747. req.Header = reqHeaders
  3748. googleapi.Expand(req.URL, map[string]string{
  3749. "name": c.name,
  3750. })
  3751. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3752. }
  3753. // Do executes the "cloudresourcemanager.operations.get" call.
  3754. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  3755. // status code is an error. Response headers are in either
  3756. // *Operation.ServerResponse.Header or (if a response was returned at
  3757. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3758. // to check whether the returned error was because
  3759. // http.StatusNotModified was returned.
  3760. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  3761. gensupport.SetOptions(c.urlParams_, opts...)
  3762. res, err := c.doRequest("json")
  3763. if res != nil && res.StatusCode == http.StatusNotModified {
  3764. if res.Body != nil {
  3765. res.Body.Close()
  3766. }
  3767. return nil, &googleapi.Error{
  3768. Code: res.StatusCode,
  3769. Header: res.Header,
  3770. }
  3771. }
  3772. if err != nil {
  3773. return nil, err
  3774. }
  3775. defer googleapi.CloseBody(res)
  3776. if err := googleapi.CheckResponse(res); err != nil {
  3777. return nil, err
  3778. }
  3779. ret := &Operation{
  3780. ServerResponse: googleapi.ServerResponse{
  3781. Header: res.Header,
  3782. HTTPStatusCode: res.StatusCode,
  3783. },
  3784. }
  3785. target := &ret
  3786. if err := gensupport.DecodeResponse(target, res); err != nil {
  3787. return nil, err
  3788. }
  3789. return ret, nil
  3790. // {
  3791. // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.",
  3792. // "flatPath": "v1/operations/{operationsId}",
  3793. // "httpMethod": "GET",
  3794. // "id": "cloudresourcemanager.operations.get",
  3795. // "parameterOrder": [
  3796. // "name"
  3797. // ],
  3798. // "parameters": {
  3799. // "name": {
  3800. // "description": "The name of the operation resource.",
  3801. // "location": "path",
  3802. // "pattern": "^operations/.+$",
  3803. // "required": true,
  3804. // "type": "string"
  3805. // }
  3806. // },
  3807. // "path": "v1/{+name}",
  3808. // "response": {
  3809. // "$ref": "Operation"
  3810. // },
  3811. // "scopes": [
  3812. // "https://www.googleapis.com/auth/cloud-platform",
  3813. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3814. // ]
  3815. // }
  3816. }
  3817. // method id "cloudresourcemanager.organizations.clearOrgPolicy":
  3818. type OrganizationsClearOrgPolicyCall struct {
  3819. s *Service
  3820. resource string
  3821. clearorgpolicyrequest *ClearOrgPolicyRequest
  3822. urlParams_ gensupport.URLParams
  3823. ctx_ context.Context
  3824. header_ http.Header
  3825. }
  3826. // ClearOrgPolicy: Clears a `Policy` from a resource.
  3827. func (r *OrganizationsService) ClearOrgPolicy(resource string, clearorgpolicyrequest *ClearOrgPolicyRequest) *OrganizationsClearOrgPolicyCall {
  3828. c := &OrganizationsClearOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3829. c.resource = resource
  3830. c.clearorgpolicyrequest = clearorgpolicyrequest
  3831. return c
  3832. }
  3833. // Fields allows partial responses to be retrieved. See
  3834. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3835. // for more information.
  3836. func (c *OrganizationsClearOrgPolicyCall) Fields(s ...googleapi.Field) *OrganizationsClearOrgPolicyCall {
  3837. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3838. return c
  3839. }
  3840. // Context sets the context to be used in this call's Do method. Any
  3841. // pending HTTP request will be aborted if the provided context is
  3842. // canceled.
  3843. func (c *OrganizationsClearOrgPolicyCall) Context(ctx context.Context) *OrganizationsClearOrgPolicyCall {
  3844. c.ctx_ = ctx
  3845. return c
  3846. }
  3847. // Header returns an http.Header that can be modified by the caller to
  3848. // add HTTP headers to the request.
  3849. func (c *OrganizationsClearOrgPolicyCall) Header() http.Header {
  3850. if c.header_ == nil {
  3851. c.header_ = make(http.Header)
  3852. }
  3853. return c.header_
  3854. }
  3855. func (c *OrganizationsClearOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  3856. reqHeaders := make(http.Header)
  3857. for k, v := range c.header_ {
  3858. reqHeaders[k] = v
  3859. }
  3860. reqHeaders.Set("User-Agent", c.s.userAgent())
  3861. var body io.Reader = nil
  3862. body, err := googleapi.WithoutDataWrapper.JSONReader(c.clearorgpolicyrequest)
  3863. if err != nil {
  3864. return nil, err
  3865. }
  3866. reqHeaders.Set("Content-Type", "application/json")
  3867. c.urlParams_.Set("alt", alt)
  3868. c.urlParams_.Set("prettyPrint", "false")
  3869. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:clearOrgPolicy")
  3870. urls += "?" + c.urlParams_.Encode()
  3871. req, err := http.NewRequest("POST", urls, body)
  3872. if err != nil {
  3873. return nil, err
  3874. }
  3875. req.Header = reqHeaders
  3876. googleapi.Expand(req.URL, map[string]string{
  3877. "resource": c.resource,
  3878. })
  3879. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3880. }
  3881. // Do executes the "cloudresourcemanager.organizations.clearOrgPolicy" call.
  3882. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3883. // code is an error. Response headers are in either
  3884. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3885. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3886. // check whether the returned error was because http.StatusNotModified
  3887. // was returned.
  3888. func (c *OrganizationsClearOrgPolicyCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3889. gensupport.SetOptions(c.urlParams_, opts...)
  3890. res, err := c.doRequest("json")
  3891. if res != nil && res.StatusCode == http.StatusNotModified {
  3892. if res.Body != nil {
  3893. res.Body.Close()
  3894. }
  3895. return nil, &googleapi.Error{
  3896. Code: res.StatusCode,
  3897. Header: res.Header,
  3898. }
  3899. }
  3900. if err != nil {
  3901. return nil, err
  3902. }
  3903. defer googleapi.CloseBody(res)
  3904. if err := googleapi.CheckResponse(res); err != nil {
  3905. return nil, err
  3906. }
  3907. ret := &Empty{
  3908. ServerResponse: googleapi.ServerResponse{
  3909. Header: res.Header,
  3910. HTTPStatusCode: res.StatusCode,
  3911. },
  3912. }
  3913. target := &ret
  3914. if err := gensupport.DecodeResponse(target, res); err != nil {
  3915. return nil, err
  3916. }
  3917. return ret, nil
  3918. // {
  3919. // "description": "Clears a `Policy` from a resource.",
  3920. // "flatPath": "v1/organizations/{organizationsId}:clearOrgPolicy",
  3921. // "httpMethod": "POST",
  3922. // "id": "cloudresourcemanager.organizations.clearOrgPolicy",
  3923. // "parameterOrder": [
  3924. // "resource"
  3925. // ],
  3926. // "parameters": {
  3927. // "resource": {
  3928. // "description": "Name of the resource for the `Policy` to clear.",
  3929. // "location": "path",
  3930. // "pattern": "^organizations/[^/]+$",
  3931. // "required": true,
  3932. // "type": "string"
  3933. // }
  3934. // },
  3935. // "path": "v1/{+resource}:clearOrgPolicy",
  3936. // "request": {
  3937. // "$ref": "ClearOrgPolicyRequest"
  3938. // },
  3939. // "response": {
  3940. // "$ref": "Empty"
  3941. // },
  3942. // "scopes": [
  3943. // "https://www.googleapis.com/auth/cloud-platform"
  3944. // ]
  3945. // }
  3946. }
  3947. // method id "cloudresourcemanager.organizations.get":
  3948. type OrganizationsGetCall struct {
  3949. s *Service
  3950. name string
  3951. urlParams_ gensupport.URLParams
  3952. ifNoneMatch_ string
  3953. ctx_ context.Context
  3954. header_ http.Header
  3955. }
  3956. // Get: Fetches an Organization resource identified by the specified
  3957. // resource name.
  3958. func (r *OrganizationsService) Get(name string) *OrganizationsGetCall {
  3959. c := &OrganizationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3960. c.name = name
  3961. return c
  3962. }
  3963. // Fields allows partial responses to be retrieved. See
  3964. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3965. // for more information.
  3966. func (c *OrganizationsGetCall) Fields(s ...googleapi.Field) *OrganizationsGetCall {
  3967. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3968. return c
  3969. }
  3970. // IfNoneMatch sets the optional parameter which makes the operation
  3971. // fail if the object's ETag matches the given value. This is useful for
  3972. // getting updates only after the object has changed since the last
  3973. // request. Use googleapi.IsNotModified to check whether the response
  3974. // error from Do is the result of In-None-Match.
  3975. func (c *OrganizationsGetCall) IfNoneMatch(entityTag string) *OrganizationsGetCall {
  3976. c.ifNoneMatch_ = entityTag
  3977. return c
  3978. }
  3979. // Context sets the context to be used in this call's Do method. Any
  3980. // pending HTTP request will be aborted if the provided context is
  3981. // canceled.
  3982. func (c *OrganizationsGetCall) Context(ctx context.Context) *OrganizationsGetCall {
  3983. c.ctx_ = ctx
  3984. return c
  3985. }
  3986. // Header returns an http.Header that can be modified by the caller to
  3987. // add HTTP headers to the request.
  3988. func (c *OrganizationsGetCall) Header() http.Header {
  3989. if c.header_ == nil {
  3990. c.header_ = make(http.Header)
  3991. }
  3992. return c.header_
  3993. }
  3994. func (c *OrganizationsGetCall) doRequest(alt string) (*http.Response, error) {
  3995. reqHeaders := make(http.Header)
  3996. for k, v := range c.header_ {
  3997. reqHeaders[k] = v
  3998. }
  3999. reqHeaders.Set("User-Agent", c.s.userAgent())
  4000. if c.ifNoneMatch_ != "" {
  4001. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4002. }
  4003. var body io.Reader = nil
  4004. c.urlParams_.Set("alt", alt)
  4005. c.urlParams_.Set("prettyPrint", "false")
  4006. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4007. urls += "?" + c.urlParams_.Encode()
  4008. req, err := http.NewRequest("GET", urls, body)
  4009. if err != nil {
  4010. return nil, err
  4011. }
  4012. req.Header = reqHeaders
  4013. googleapi.Expand(req.URL, map[string]string{
  4014. "name": c.name,
  4015. })
  4016. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4017. }
  4018. // Do executes the "cloudresourcemanager.organizations.get" call.
  4019. // Exactly one of *Organization or error will be non-nil. Any non-2xx
  4020. // status code is an error. Response headers are in either
  4021. // *Organization.ServerResponse.Header or (if a response was returned at
  4022. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4023. // to check whether the returned error was because
  4024. // http.StatusNotModified was returned.
  4025. func (c *OrganizationsGetCall) Do(opts ...googleapi.CallOption) (*Organization, error) {
  4026. gensupport.SetOptions(c.urlParams_, opts...)
  4027. res, err := c.doRequest("json")
  4028. if res != nil && res.StatusCode == http.StatusNotModified {
  4029. if res.Body != nil {
  4030. res.Body.Close()
  4031. }
  4032. return nil, &googleapi.Error{
  4033. Code: res.StatusCode,
  4034. Header: res.Header,
  4035. }
  4036. }
  4037. if err != nil {
  4038. return nil, err
  4039. }
  4040. defer googleapi.CloseBody(res)
  4041. if err := googleapi.CheckResponse(res); err != nil {
  4042. return nil, err
  4043. }
  4044. ret := &Organization{
  4045. ServerResponse: googleapi.ServerResponse{
  4046. Header: res.Header,
  4047. HTTPStatusCode: res.StatusCode,
  4048. },
  4049. }
  4050. target := &ret
  4051. if err := gensupport.DecodeResponse(target, res); err != nil {
  4052. return nil, err
  4053. }
  4054. return ret, nil
  4055. // {
  4056. // "description": "Fetches an Organization resource identified by the specified resource name.",
  4057. // "flatPath": "v1/organizations/{organizationsId}",
  4058. // "httpMethod": "GET",
  4059. // "id": "cloudresourcemanager.organizations.get",
  4060. // "parameterOrder": [
  4061. // "name"
  4062. // ],
  4063. // "parameters": {
  4064. // "name": {
  4065. // "description": "The resource name of the Organization to fetch. This is the organization's\nrelative path in the API, formatted as \"organizations/[organizationId]\".\nFor example, \"organizations/1234\".",
  4066. // "location": "path",
  4067. // "pattern": "^organizations/[^/]+$",
  4068. // "required": true,
  4069. // "type": "string"
  4070. // }
  4071. // },
  4072. // "path": "v1/{+name}",
  4073. // "response": {
  4074. // "$ref": "Organization"
  4075. // },
  4076. // "scopes": [
  4077. // "https://www.googleapis.com/auth/cloud-platform",
  4078. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4079. // ]
  4080. // }
  4081. }
  4082. // method id "cloudresourcemanager.organizations.getEffectiveOrgPolicy":
  4083. type OrganizationsGetEffectiveOrgPolicyCall struct {
  4084. s *Service
  4085. resource string
  4086. geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest
  4087. urlParams_ gensupport.URLParams
  4088. ctx_ context.Context
  4089. header_ http.Header
  4090. }
  4091. // GetEffectiveOrgPolicy: Gets the effective `Policy` on a resource.
  4092. // This is the result of merging
  4093. // `Policies` in the resource hierarchy. The returned `Policy` will not
  4094. // have
  4095. // an `etag`set because it is a computed `Policy` across multiple
  4096. // resources.
  4097. // Subtrees of Resource Manager resource hierarchy with 'under:' prefix
  4098. // will
  4099. // not be expanded.
  4100. func (r *OrganizationsService) GetEffectiveOrgPolicy(resource string, geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest) *OrganizationsGetEffectiveOrgPolicyCall {
  4101. c := &OrganizationsGetEffectiveOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4102. c.resource = resource
  4103. c.geteffectiveorgpolicyrequest = geteffectiveorgpolicyrequest
  4104. return c
  4105. }
  4106. // Fields allows partial responses to be retrieved. See
  4107. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4108. // for more information.
  4109. func (c *OrganizationsGetEffectiveOrgPolicyCall) Fields(s ...googleapi.Field) *OrganizationsGetEffectiveOrgPolicyCall {
  4110. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4111. return c
  4112. }
  4113. // Context sets the context to be used in this call's Do method. Any
  4114. // pending HTTP request will be aborted if the provided context is
  4115. // canceled.
  4116. func (c *OrganizationsGetEffectiveOrgPolicyCall) Context(ctx context.Context) *OrganizationsGetEffectiveOrgPolicyCall {
  4117. c.ctx_ = ctx
  4118. return c
  4119. }
  4120. // Header returns an http.Header that can be modified by the caller to
  4121. // add HTTP headers to the request.
  4122. func (c *OrganizationsGetEffectiveOrgPolicyCall) Header() http.Header {
  4123. if c.header_ == nil {
  4124. c.header_ = make(http.Header)
  4125. }
  4126. return c.header_
  4127. }
  4128. func (c *OrganizationsGetEffectiveOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  4129. reqHeaders := make(http.Header)
  4130. for k, v := range c.header_ {
  4131. reqHeaders[k] = v
  4132. }
  4133. reqHeaders.Set("User-Agent", c.s.userAgent())
  4134. var body io.Reader = nil
  4135. body, err := googleapi.WithoutDataWrapper.JSONReader(c.geteffectiveorgpolicyrequest)
  4136. if err != nil {
  4137. return nil, err
  4138. }
  4139. reqHeaders.Set("Content-Type", "application/json")
  4140. c.urlParams_.Set("alt", alt)
  4141. c.urlParams_.Set("prettyPrint", "false")
  4142. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getEffectiveOrgPolicy")
  4143. urls += "?" + c.urlParams_.Encode()
  4144. req, err := http.NewRequest("POST", urls, body)
  4145. if err != nil {
  4146. return nil, err
  4147. }
  4148. req.Header = reqHeaders
  4149. googleapi.Expand(req.URL, map[string]string{
  4150. "resource": c.resource,
  4151. })
  4152. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4153. }
  4154. // Do executes the "cloudresourcemanager.organizations.getEffectiveOrgPolicy" call.
  4155. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  4156. // status code is an error. Response headers are in either
  4157. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  4158. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4159. // to check whether the returned error was because
  4160. // http.StatusNotModified was returned.
  4161. func (c *OrganizationsGetEffectiveOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  4162. gensupport.SetOptions(c.urlParams_, opts...)
  4163. res, err := c.doRequest("json")
  4164. if res != nil && res.StatusCode == http.StatusNotModified {
  4165. if res.Body != nil {
  4166. res.Body.Close()
  4167. }
  4168. return nil, &googleapi.Error{
  4169. Code: res.StatusCode,
  4170. Header: res.Header,
  4171. }
  4172. }
  4173. if err != nil {
  4174. return nil, err
  4175. }
  4176. defer googleapi.CloseBody(res)
  4177. if err := googleapi.CheckResponse(res); err != nil {
  4178. return nil, err
  4179. }
  4180. ret := &OrgPolicy{
  4181. ServerResponse: googleapi.ServerResponse{
  4182. Header: res.Header,
  4183. HTTPStatusCode: res.StatusCode,
  4184. },
  4185. }
  4186. target := &ret
  4187. if err := gensupport.DecodeResponse(target, res); err != nil {
  4188. return nil, err
  4189. }
  4190. return ret, nil
  4191. // {
  4192. // "description": "Gets the effective `Policy` on a resource. This is the result of merging\n`Policies` in the resource hierarchy. The returned `Policy` will not have\nan `etag`set because it is a computed `Policy` across multiple resources.\nSubtrees of Resource Manager resource hierarchy with 'under:' prefix will\nnot be expanded.",
  4193. // "flatPath": "v1/organizations/{organizationsId}:getEffectiveOrgPolicy",
  4194. // "httpMethod": "POST",
  4195. // "id": "cloudresourcemanager.organizations.getEffectiveOrgPolicy",
  4196. // "parameterOrder": [
  4197. // "resource"
  4198. // ],
  4199. // "parameters": {
  4200. // "resource": {
  4201. // "description": "The name of the resource to start computing the effective `Policy`.",
  4202. // "location": "path",
  4203. // "pattern": "^organizations/[^/]+$",
  4204. // "required": true,
  4205. // "type": "string"
  4206. // }
  4207. // },
  4208. // "path": "v1/{+resource}:getEffectiveOrgPolicy",
  4209. // "request": {
  4210. // "$ref": "GetEffectiveOrgPolicyRequest"
  4211. // },
  4212. // "response": {
  4213. // "$ref": "OrgPolicy"
  4214. // },
  4215. // "scopes": [
  4216. // "https://www.googleapis.com/auth/cloud-platform",
  4217. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4218. // ]
  4219. // }
  4220. }
  4221. // method id "cloudresourcemanager.organizations.getIamPolicy":
  4222. type OrganizationsGetIamPolicyCall struct {
  4223. s *Service
  4224. resource string
  4225. getiampolicyrequest *GetIamPolicyRequest
  4226. urlParams_ gensupport.URLParams
  4227. ctx_ context.Context
  4228. header_ http.Header
  4229. }
  4230. // GetIamPolicy: Gets the access control policy for an Organization
  4231. // resource. May be empty
  4232. // if no such policy or resource exists. The `resource` field should be
  4233. // the
  4234. // organization's resource name, e.g.
  4235. // "organizations/123".
  4236. //
  4237. // Authorization requires the Google IAM
  4238. // permission
  4239. // `resourcemanager.organizations.getIamPolicy` on the specified
  4240. // organization
  4241. func (r *OrganizationsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *OrganizationsGetIamPolicyCall {
  4242. c := &OrganizationsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4243. c.resource = resource
  4244. c.getiampolicyrequest = getiampolicyrequest
  4245. return c
  4246. }
  4247. // Fields allows partial responses to be retrieved. See
  4248. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4249. // for more information.
  4250. func (c *OrganizationsGetIamPolicyCall) Fields(s ...googleapi.Field) *OrganizationsGetIamPolicyCall {
  4251. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4252. return c
  4253. }
  4254. // Context sets the context to be used in this call's Do method. Any
  4255. // pending HTTP request will be aborted if the provided context is
  4256. // canceled.
  4257. func (c *OrganizationsGetIamPolicyCall) Context(ctx context.Context) *OrganizationsGetIamPolicyCall {
  4258. c.ctx_ = ctx
  4259. return c
  4260. }
  4261. // Header returns an http.Header that can be modified by the caller to
  4262. // add HTTP headers to the request.
  4263. func (c *OrganizationsGetIamPolicyCall) Header() http.Header {
  4264. if c.header_ == nil {
  4265. c.header_ = make(http.Header)
  4266. }
  4267. return c.header_
  4268. }
  4269. func (c *OrganizationsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4270. reqHeaders := make(http.Header)
  4271. for k, v := range c.header_ {
  4272. reqHeaders[k] = v
  4273. }
  4274. reqHeaders.Set("User-Agent", c.s.userAgent())
  4275. var body io.Reader = nil
  4276. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  4277. if err != nil {
  4278. return nil, err
  4279. }
  4280. reqHeaders.Set("Content-Type", "application/json")
  4281. c.urlParams_.Set("alt", alt)
  4282. c.urlParams_.Set("prettyPrint", "false")
  4283. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  4284. urls += "?" + c.urlParams_.Encode()
  4285. req, err := http.NewRequest("POST", urls, body)
  4286. if err != nil {
  4287. return nil, err
  4288. }
  4289. req.Header = reqHeaders
  4290. googleapi.Expand(req.URL, map[string]string{
  4291. "resource": c.resource,
  4292. })
  4293. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4294. }
  4295. // Do executes the "cloudresourcemanager.organizations.getIamPolicy" call.
  4296. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4297. // code is an error. Response headers are in either
  4298. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4299. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4300. // check whether the returned error was because http.StatusNotModified
  4301. // was returned.
  4302. func (c *OrganizationsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4303. gensupport.SetOptions(c.urlParams_, opts...)
  4304. res, err := c.doRequest("json")
  4305. if res != nil && res.StatusCode == http.StatusNotModified {
  4306. if res.Body != nil {
  4307. res.Body.Close()
  4308. }
  4309. return nil, &googleapi.Error{
  4310. Code: res.StatusCode,
  4311. Header: res.Header,
  4312. }
  4313. }
  4314. if err != nil {
  4315. return nil, err
  4316. }
  4317. defer googleapi.CloseBody(res)
  4318. if err := googleapi.CheckResponse(res); err != nil {
  4319. return nil, err
  4320. }
  4321. ret := &Policy{
  4322. ServerResponse: googleapi.ServerResponse{
  4323. Header: res.Header,
  4324. HTTPStatusCode: res.StatusCode,
  4325. },
  4326. }
  4327. target := &ret
  4328. if err := gensupport.DecodeResponse(target, res); err != nil {
  4329. return nil, err
  4330. }
  4331. return ret, nil
  4332. // {
  4333. // "description": "Gets the access control policy for an Organization resource. May be empty\nif no such policy or resource exists. The `resource` field should be the\norganization's resource name, e.g. \"organizations/123\".\n\nAuthorization requires the Google IAM permission\n`resourcemanager.organizations.getIamPolicy` on the specified organization",
  4334. // "flatPath": "v1/organizations/{organizationsId}:getIamPolicy",
  4335. // "httpMethod": "POST",
  4336. // "id": "cloudresourcemanager.organizations.getIamPolicy",
  4337. // "parameterOrder": [
  4338. // "resource"
  4339. // ],
  4340. // "parameters": {
  4341. // "resource": {
  4342. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  4343. // "location": "path",
  4344. // "pattern": "^organizations/[^/]+$",
  4345. // "required": true,
  4346. // "type": "string"
  4347. // }
  4348. // },
  4349. // "path": "v1/{+resource}:getIamPolicy",
  4350. // "request": {
  4351. // "$ref": "GetIamPolicyRequest"
  4352. // },
  4353. // "response": {
  4354. // "$ref": "Policy"
  4355. // },
  4356. // "scopes": [
  4357. // "https://www.googleapis.com/auth/cloud-platform",
  4358. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4359. // ]
  4360. // }
  4361. }
  4362. // method id "cloudresourcemanager.organizations.getOrgPolicy":
  4363. type OrganizationsGetOrgPolicyCall struct {
  4364. s *Service
  4365. resource string
  4366. getorgpolicyrequest *GetOrgPolicyRequest
  4367. urlParams_ gensupport.URLParams
  4368. ctx_ context.Context
  4369. header_ http.Header
  4370. }
  4371. // GetOrgPolicy: Gets a `Policy` on a resource.
  4372. //
  4373. // If no `Policy` is set on the resource, a `Policy` is returned with
  4374. // default
  4375. // values including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`.
  4376. // The
  4377. // `etag` value can be used with `SetOrgPolicy()` to create or update
  4378. // a
  4379. // `Policy` during read-modify-write.
  4380. func (r *OrganizationsService) GetOrgPolicy(resource string, getorgpolicyrequest *GetOrgPolicyRequest) *OrganizationsGetOrgPolicyCall {
  4381. c := &OrganizationsGetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4382. c.resource = resource
  4383. c.getorgpolicyrequest = getorgpolicyrequest
  4384. return c
  4385. }
  4386. // Fields allows partial responses to be retrieved. See
  4387. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4388. // for more information.
  4389. func (c *OrganizationsGetOrgPolicyCall) Fields(s ...googleapi.Field) *OrganizationsGetOrgPolicyCall {
  4390. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4391. return c
  4392. }
  4393. // Context sets the context to be used in this call's Do method. Any
  4394. // pending HTTP request will be aborted if the provided context is
  4395. // canceled.
  4396. func (c *OrganizationsGetOrgPolicyCall) Context(ctx context.Context) *OrganizationsGetOrgPolicyCall {
  4397. c.ctx_ = ctx
  4398. return c
  4399. }
  4400. // Header returns an http.Header that can be modified by the caller to
  4401. // add HTTP headers to the request.
  4402. func (c *OrganizationsGetOrgPolicyCall) Header() http.Header {
  4403. if c.header_ == nil {
  4404. c.header_ = make(http.Header)
  4405. }
  4406. return c.header_
  4407. }
  4408. func (c *OrganizationsGetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  4409. reqHeaders := make(http.Header)
  4410. for k, v := range c.header_ {
  4411. reqHeaders[k] = v
  4412. }
  4413. reqHeaders.Set("User-Agent", c.s.userAgent())
  4414. var body io.Reader = nil
  4415. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getorgpolicyrequest)
  4416. if err != nil {
  4417. return nil, err
  4418. }
  4419. reqHeaders.Set("Content-Type", "application/json")
  4420. c.urlParams_.Set("alt", alt)
  4421. c.urlParams_.Set("prettyPrint", "false")
  4422. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getOrgPolicy")
  4423. urls += "?" + c.urlParams_.Encode()
  4424. req, err := http.NewRequest("POST", urls, body)
  4425. if err != nil {
  4426. return nil, err
  4427. }
  4428. req.Header = reqHeaders
  4429. googleapi.Expand(req.URL, map[string]string{
  4430. "resource": c.resource,
  4431. })
  4432. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4433. }
  4434. // Do executes the "cloudresourcemanager.organizations.getOrgPolicy" call.
  4435. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  4436. // status code is an error. Response headers are in either
  4437. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  4438. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4439. // to check whether the returned error was because
  4440. // http.StatusNotModified was returned.
  4441. func (c *OrganizationsGetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  4442. gensupport.SetOptions(c.urlParams_, opts...)
  4443. res, err := c.doRequest("json")
  4444. if res != nil && res.StatusCode == http.StatusNotModified {
  4445. if res.Body != nil {
  4446. res.Body.Close()
  4447. }
  4448. return nil, &googleapi.Error{
  4449. Code: res.StatusCode,
  4450. Header: res.Header,
  4451. }
  4452. }
  4453. if err != nil {
  4454. return nil, err
  4455. }
  4456. defer googleapi.CloseBody(res)
  4457. if err := googleapi.CheckResponse(res); err != nil {
  4458. return nil, err
  4459. }
  4460. ret := &OrgPolicy{
  4461. ServerResponse: googleapi.ServerResponse{
  4462. Header: res.Header,
  4463. HTTPStatusCode: res.StatusCode,
  4464. },
  4465. }
  4466. target := &ret
  4467. if err := gensupport.DecodeResponse(target, res); err != nil {
  4468. return nil, err
  4469. }
  4470. return ret, nil
  4471. // {
  4472. // "description": "Gets a `Policy` on a resource.\n\nIf no `Policy` is set on the resource, a `Policy` is returned with default\nvalues including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`. The\n`etag` value can be used with `SetOrgPolicy()` to create or update a\n`Policy` during read-modify-write.",
  4473. // "flatPath": "v1/organizations/{organizationsId}:getOrgPolicy",
  4474. // "httpMethod": "POST",
  4475. // "id": "cloudresourcemanager.organizations.getOrgPolicy",
  4476. // "parameterOrder": [
  4477. // "resource"
  4478. // ],
  4479. // "parameters": {
  4480. // "resource": {
  4481. // "description": "Name of the resource the `Policy` is set on.",
  4482. // "location": "path",
  4483. // "pattern": "^organizations/[^/]+$",
  4484. // "required": true,
  4485. // "type": "string"
  4486. // }
  4487. // },
  4488. // "path": "v1/{+resource}:getOrgPolicy",
  4489. // "request": {
  4490. // "$ref": "GetOrgPolicyRequest"
  4491. // },
  4492. // "response": {
  4493. // "$ref": "OrgPolicy"
  4494. // },
  4495. // "scopes": [
  4496. // "https://www.googleapis.com/auth/cloud-platform",
  4497. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4498. // ]
  4499. // }
  4500. }
  4501. // method id "cloudresourcemanager.organizations.listAvailableOrgPolicyConstraints":
  4502. type OrganizationsListAvailableOrgPolicyConstraintsCall struct {
  4503. s *Service
  4504. resource string
  4505. listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest
  4506. urlParams_ gensupport.URLParams
  4507. ctx_ context.Context
  4508. header_ http.Header
  4509. }
  4510. // ListAvailableOrgPolicyConstraints: Lists `Constraints` that could be
  4511. // applied on the specified resource.
  4512. func (r *OrganizationsService) ListAvailableOrgPolicyConstraints(resource string, listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest) *OrganizationsListAvailableOrgPolicyConstraintsCall {
  4513. c := &OrganizationsListAvailableOrgPolicyConstraintsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4514. c.resource = resource
  4515. c.listavailableorgpolicyconstraintsrequest = listavailableorgpolicyconstraintsrequest
  4516. return c
  4517. }
  4518. // Fields allows partial responses to be retrieved. See
  4519. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4520. // for more information.
  4521. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Fields(s ...googleapi.Field) *OrganizationsListAvailableOrgPolicyConstraintsCall {
  4522. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4523. return c
  4524. }
  4525. // Context sets the context to be used in this call's Do method. Any
  4526. // pending HTTP request will be aborted if the provided context is
  4527. // canceled.
  4528. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Context(ctx context.Context) *OrganizationsListAvailableOrgPolicyConstraintsCall {
  4529. c.ctx_ = ctx
  4530. return c
  4531. }
  4532. // Header returns an http.Header that can be modified by the caller to
  4533. // add HTTP headers to the request.
  4534. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Header() http.Header {
  4535. if c.header_ == nil {
  4536. c.header_ = make(http.Header)
  4537. }
  4538. return c.header_
  4539. }
  4540. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) doRequest(alt string) (*http.Response, error) {
  4541. reqHeaders := make(http.Header)
  4542. for k, v := range c.header_ {
  4543. reqHeaders[k] = v
  4544. }
  4545. reqHeaders.Set("User-Agent", c.s.userAgent())
  4546. var body io.Reader = nil
  4547. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listavailableorgpolicyconstraintsrequest)
  4548. if err != nil {
  4549. return nil, err
  4550. }
  4551. reqHeaders.Set("Content-Type", "application/json")
  4552. c.urlParams_.Set("alt", alt)
  4553. c.urlParams_.Set("prettyPrint", "false")
  4554. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listAvailableOrgPolicyConstraints")
  4555. urls += "?" + c.urlParams_.Encode()
  4556. req, err := http.NewRequest("POST", urls, body)
  4557. if err != nil {
  4558. return nil, err
  4559. }
  4560. req.Header = reqHeaders
  4561. googleapi.Expand(req.URL, map[string]string{
  4562. "resource": c.resource,
  4563. })
  4564. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4565. }
  4566. // Do executes the "cloudresourcemanager.organizations.listAvailableOrgPolicyConstraints" call.
  4567. // Exactly one of *ListAvailableOrgPolicyConstraintsResponse or error
  4568. // will be non-nil. Any non-2xx status code is an error. Response
  4569. // headers are in either
  4570. // *ListAvailableOrgPolicyConstraintsResponse.ServerResponse.Header or
  4571. // (if a response was returned at all) in
  4572. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4573. // whether the returned error was because http.StatusNotModified was
  4574. // returned.
  4575. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Do(opts ...googleapi.CallOption) (*ListAvailableOrgPolicyConstraintsResponse, error) {
  4576. gensupport.SetOptions(c.urlParams_, opts...)
  4577. res, err := c.doRequest("json")
  4578. if res != nil && res.StatusCode == http.StatusNotModified {
  4579. if res.Body != nil {
  4580. res.Body.Close()
  4581. }
  4582. return nil, &googleapi.Error{
  4583. Code: res.StatusCode,
  4584. Header: res.Header,
  4585. }
  4586. }
  4587. if err != nil {
  4588. return nil, err
  4589. }
  4590. defer googleapi.CloseBody(res)
  4591. if err := googleapi.CheckResponse(res); err != nil {
  4592. return nil, err
  4593. }
  4594. ret := &ListAvailableOrgPolicyConstraintsResponse{
  4595. ServerResponse: googleapi.ServerResponse{
  4596. Header: res.Header,
  4597. HTTPStatusCode: res.StatusCode,
  4598. },
  4599. }
  4600. target := &ret
  4601. if err := gensupport.DecodeResponse(target, res); err != nil {
  4602. return nil, err
  4603. }
  4604. return ret, nil
  4605. // {
  4606. // "description": "Lists `Constraints` that could be applied on the specified resource.",
  4607. // "flatPath": "v1/organizations/{organizationsId}:listAvailableOrgPolicyConstraints",
  4608. // "httpMethod": "POST",
  4609. // "id": "cloudresourcemanager.organizations.listAvailableOrgPolicyConstraints",
  4610. // "parameterOrder": [
  4611. // "resource"
  4612. // ],
  4613. // "parameters": {
  4614. // "resource": {
  4615. // "description": "Name of the resource to list `Constraints` for.",
  4616. // "location": "path",
  4617. // "pattern": "^organizations/[^/]+$",
  4618. // "required": true,
  4619. // "type": "string"
  4620. // }
  4621. // },
  4622. // "path": "v1/{+resource}:listAvailableOrgPolicyConstraints",
  4623. // "request": {
  4624. // "$ref": "ListAvailableOrgPolicyConstraintsRequest"
  4625. // },
  4626. // "response": {
  4627. // "$ref": "ListAvailableOrgPolicyConstraintsResponse"
  4628. // },
  4629. // "scopes": [
  4630. // "https://www.googleapis.com/auth/cloud-platform",
  4631. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4632. // ]
  4633. // }
  4634. }
  4635. // Pages invokes f for each page of results.
  4636. // A non-nil error returned from f will halt the iteration.
  4637. // The provided context supersedes any context provided to the Context method.
  4638. func (c *OrganizationsListAvailableOrgPolicyConstraintsCall) Pages(ctx context.Context, f func(*ListAvailableOrgPolicyConstraintsResponse) error) error {
  4639. c.ctx_ = ctx
  4640. defer func(pt string) { c.listavailableorgpolicyconstraintsrequest.PageToken = pt }(c.listavailableorgpolicyconstraintsrequest.PageToken) // reset paging to original point
  4641. for {
  4642. x, err := c.Do()
  4643. if err != nil {
  4644. return err
  4645. }
  4646. if err := f(x); err != nil {
  4647. return err
  4648. }
  4649. if x.NextPageToken == "" {
  4650. return nil
  4651. }
  4652. c.listavailableorgpolicyconstraintsrequest.PageToken = x.NextPageToken
  4653. }
  4654. }
  4655. // method id "cloudresourcemanager.organizations.listOrgPolicies":
  4656. type OrganizationsListOrgPoliciesCall struct {
  4657. s *Service
  4658. resource string
  4659. listorgpoliciesrequest *ListOrgPoliciesRequest
  4660. urlParams_ gensupport.URLParams
  4661. ctx_ context.Context
  4662. header_ http.Header
  4663. }
  4664. // ListOrgPolicies: Lists all the `Policies` set for a particular
  4665. // resource.
  4666. func (r *OrganizationsService) ListOrgPolicies(resource string, listorgpoliciesrequest *ListOrgPoliciesRequest) *OrganizationsListOrgPoliciesCall {
  4667. c := &OrganizationsListOrgPoliciesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4668. c.resource = resource
  4669. c.listorgpoliciesrequest = listorgpoliciesrequest
  4670. return c
  4671. }
  4672. // Fields allows partial responses to be retrieved. See
  4673. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4674. // for more information.
  4675. func (c *OrganizationsListOrgPoliciesCall) Fields(s ...googleapi.Field) *OrganizationsListOrgPoliciesCall {
  4676. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4677. return c
  4678. }
  4679. // Context sets the context to be used in this call's Do method. Any
  4680. // pending HTTP request will be aborted if the provided context is
  4681. // canceled.
  4682. func (c *OrganizationsListOrgPoliciesCall) Context(ctx context.Context) *OrganizationsListOrgPoliciesCall {
  4683. c.ctx_ = ctx
  4684. return c
  4685. }
  4686. // Header returns an http.Header that can be modified by the caller to
  4687. // add HTTP headers to the request.
  4688. func (c *OrganizationsListOrgPoliciesCall) Header() http.Header {
  4689. if c.header_ == nil {
  4690. c.header_ = make(http.Header)
  4691. }
  4692. return c.header_
  4693. }
  4694. func (c *OrganizationsListOrgPoliciesCall) doRequest(alt string) (*http.Response, error) {
  4695. reqHeaders := make(http.Header)
  4696. for k, v := range c.header_ {
  4697. reqHeaders[k] = v
  4698. }
  4699. reqHeaders.Set("User-Agent", c.s.userAgent())
  4700. var body io.Reader = nil
  4701. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listorgpoliciesrequest)
  4702. if err != nil {
  4703. return nil, err
  4704. }
  4705. reqHeaders.Set("Content-Type", "application/json")
  4706. c.urlParams_.Set("alt", alt)
  4707. c.urlParams_.Set("prettyPrint", "false")
  4708. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listOrgPolicies")
  4709. urls += "?" + c.urlParams_.Encode()
  4710. req, err := http.NewRequest("POST", urls, body)
  4711. if err != nil {
  4712. return nil, err
  4713. }
  4714. req.Header = reqHeaders
  4715. googleapi.Expand(req.URL, map[string]string{
  4716. "resource": c.resource,
  4717. })
  4718. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4719. }
  4720. // Do executes the "cloudresourcemanager.organizations.listOrgPolicies" call.
  4721. // Exactly one of *ListOrgPoliciesResponse or error will be non-nil. Any
  4722. // non-2xx status code is an error. Response headers are in either
  4723. // *ListOrgPoliciesResponse.ServerResponse.Header or (if a response was
  4724. // returned at all) in error.(*googleapi.Error).Header. Use
  4725. // googleapi.IsNotModified to check whether the returned error was
  4726. // because http.StatusNotModified was returned.
  4727. func (c *OrganizationsListOrgPoliciesCall) Do(opts ...googleapi.CallOption) (*ListOrgPoliciesResponse, error) {
  4728. gensupport.SetOptions(c.urlParams_, opts...)
  4729. res, err := c.doRequest("json")
  4730. if res != nil && res.StatusCode == http.StatusNotModified {
  4731. if res.Body != nil {
  4732. res.Body.Close()
  4733. }
  4734. return nil, &googleapi.Error{
  4735. Code: res.StatusCode,
  4736. Header: res.Header,
  4737. }
  4738. }
  4739. if err != nil {
  4740. return nil, err
  4741. }
  4742. defer googleapi.CloseBody(res)
  4743. if err := googleapi.CheckResponse(res); err != nil {
  4744. return nil, err
  4745. }
  4746. ret := &ListOrgPoliciesResponse{
  4747. ServerResponse: googleapi.ServerResponse{
  4748. Header: res.Header,
  4749. HTTPStatusCode: res.StatusCode,
  4750. },
  4751. }
  4752. target := &ret
  4753. if err := gensupport.DecodeResponse(target, res); err != nil {
  4754. return nil, err
  4755. }
  4756. return ret, nil
  4757. // {
  4758. // "description": "Lists all the `Policies` set for a particular resource.",
  4759. // "flatPath": "v1/organizations/{organizationsId}:listOrgPolicies",
  4760. // "httpMethod": "POST",
  4761. // "id": "cloudresourcemanager.organizations.listOrgPolicies",
  4762. // "parameterOrder": [
  4763. // "resource"
  4764. // ],
  4765. // "parameters": {
  4766. // "resource": {
  4767. // "description": "Name of the resource to list Policies for.",
  4768. // "location": "path",
  4769. // "pattern": "^organizations/[^/]+$",
  4770. // "required": true,
  4771. // "type": "string"
  4772. // }
  4773. // },
  4774. // "path": "v1/{+resource}:listOrgPolicies",
  4775. // "request": {
  4776. // "$ref": "ListOrgPoliciesRequest"
  4777. // },
  4778. // "response": {
  4779. // "$ref": "ListOrgPoliciesResponse"
  4780. // },
  4781. // "scopes": [
  4782. // "https://www.googleapis.com/auth/cloud-platform",
  4783. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4784. // ]
  4785. // }
  4786. }
  4787. // Pages invokes f for each page of results.
  4788. // A non-nil error returned from f will halt the iteration.
  4789. // The provided context supersedes any context provided to the Context method.
  4790. func (c *OrganizationsListOrgPoliciesCall) Pages(ctx context.Context, f func(*ListOrgPoliciesResponse) error) error {
  4791. c.ctx_ = ctx
  4792. defer func(pt string) { c.listorgpoliciesrequest.PageToken = pt }(c.listorgpoliciesrequest.PageToken) // reset paging to original point
  4793. for {
  4794. x, err := c.Do()
  4795. if err != nil {
  4796. return err
  4797. }
  4798. if err := f(x); err != nil {
  4799. return err
  4800. }
  4801. if x.NextPageToken == "" {
  4802. return nil
  4803. }
  4804. c.listorgpoliciesrequest.PageToken = x.NextPageToken
  4805. }
  4806. }
  4807. // method id "cloudresourcemanager.organizations.search":
  4808. type OrganizationsSearchCall struct {
  4809. s *Service
  4810. searchorganizationsrequest *SearchOrganizationsRequest
  4811. urlParams_ gensupport.URLParams
  4812. ctx_ context.Context
  4813. header_ http.Header
  4814. }
  4815. // Search: Searches Organization resources that are visible to the user
  4816. // and satisfy
  4817. // the specified filter. This method returns Organizations in an
  4818. // unspecified
  4819. // order. New Organizations do not necessarily appear at the end of
  4820. // the
  4821. // results.
  4822. //
  4823. // Search will only return organizations on which the user has the
  4824. // permission
  4825. // `resourcemanager.organizations.get`
  4826. func (r *OrganizationsService) Search(searchorganizationsrequest *SearchOrganizationsRequest) *OrganizationsSearchCall {
  4827. c := &OrganizationsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4828. c.searchorganizationsrequest = searchorganizationsrequest
  4829. return c
  4830. }
  4831. // Fields allows partial responses to be retrieved. See
  4832. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4833. // for more information.
  4834. func (c *OrganizationsSearchCall) Fields(s ...googleapi.Field) *OrganizationsSearchCall {
  4835. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4836. return c
  4837. }
  4838. // Context sets the context to be used in this call's Do method. Any
  4839. // pending HTTP request will be aborted if the provided context is
  4840. // canceled.
  4841. func (c *OrganizationsSearchCall) Context(ctx context.Context) *OrganizationsSearchCall {
  4842. c.ctx_ = ctx
  4843. return c
  4844. }
  4845. // Header returns an http.Header that can be modified by the caller to
  4846. // add HTTP headers to the request.
  4847. func (c *OrganizationsSearchCall) Header() http.Header {
  4848. if c.header_ == nil {
  4849. c.header_ = make(http.Header)
  4850. }
  4851. return c.header_
  4852. }
  4853. func (c *OrganizationsSearchCall) doRequest(alt string) (*http.Response, error) {
  4854. reqHeaders := make(http.Header)
  4855. for k, v := range c.header_ {
  4856. reqHeaders[k] = v
  4857. }
  4858. reqHeaders.Set("User-Agent", c.s.userAgent())
  4859. var body io.Reader = nil
  4860. body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchorganizationsrequest)
  4861. if err != nil {
  4862. return nil, err
  4863. }
  4864. reqHeaders.Set("Content-Type", "application/json")
  4865. c.urlParams_.Set("alt", alt)
  4866. c.urlParams_.Set("prettyPrint", "false")
  4867. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/organizations:search")
  4868. urls += "?" + c.urlParams_.Encode()
  4869. req, err := http.NewRequest("POST", urls, body)
  4870. if err != nil {
  4871. return nil, err
  4872. }
  4873. req.Header = reqHeaders
  4874. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4875. }
  4876. // Do executes the "cloudresourcemanager.organizations.search" call.
  4877. // Exactly one of *SearchOrganizationsResponse or error will be non-nil.
  4878. // Any non-2xx status code is an error. Response headers are in either
  4879. // *SearchOrganizationsResponse.ServerResponse.Header or (if a response
  4880. // was returned at all) in error.(*googleapi.Error).Header. Use
  4881. // googleapi.IsNotModified to check whether the returned error was
  4882. // because http.StatusNotModified was returned.
  4883. func (c *OrganizationsSearchCall) Do(opts ...googleapi.CallOption) (*SearchOrganizationsResponse, error) {
  4884. gensupport.SetOptions(c.urlParams_, opts...)
  4885. res, err := c.doRequest("json")
  4886. if res != nil && res.StatusCode == http.StatusNotModified {
  4887. if res.Body != nil {
  4888. res.Body.Close()
  4889. }
  4890. return nil, &googleapi.Error{
  4891. Code: res.StatusCode,
  4892. Header: res.Header,
  4893. }
  4894. }
  4895. if err != nil {
  4896. return nil, err
  4897. }
  4898. defer googleapi.CloseBody(res)
  4899. if err := googleapi.CheckResponse(res); err != nil {
  4900. return nil, err
  4901. }
  4902. ret := &SearchOrganizationsResponse{
  4903. ServerResponse: googleapi.ServerResponse{
  4904. Header: res.Header,
  4905. HTTPStatusCode: res.StatusCode,
  4906. },
  4907. }
  4908. target := &ret
  4909. if err := gensupport.DecodeResponse(target, res); err != nil {
  4910. return nil, err
  4911. }
  4912. return ret, nil
  4913. // {
  4914. // "description": "Searches Organization resources that are visible to the user and satisfy\nthe specified filter. This method returns Organizations in an unspecified\norder. New Organizations do not necessarily appear at the end of the\nresults.\n\nSearch will only return organizations on which the user has the permission\n`resourcemanager.organizations.get`",
  4915. // "flatPath": "v1/organizations:search",
  4916. // "httpMethod": "POST",
  4917. // "id": "cloudresourcemanager.organizations.search",
  4918. // "parameterOrder": [],
  4919. // "parameters": {},
  4920. // "path": "v1/organizations:search",
  4921. // "request": {
  4922. // "$ref": "SearchOrganizationsRequest"
  4923. // },
  4924. // "response": {
  4925. // "$ref": "SearchOrganizationsResponse"
  4926. // },
  4927. // "scopes": [
  4928. // "https://www.googleapis.com/auth/cloud-platform",
  4929. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4930. // ]
  4931. // }
  4932. }
  4933. // Pages invokes f for each page of results.
  4934. // A non-nil error returned from f will halt the iteration.
  4935. // The provided context supersedes any context provided to the Context method.
  4936. func (c *OrganizationsSearchCall) Pages(ctx context.Context, f func(*SearchOrganizationsResponse) error) error {
  4937. c.ctx_ = ctx
  4938. defer func(pt string) { c.searchorganizationsrequest.PageToken = pt }(c.searchorganizationsrequest.PageToken) // reset paging to original point
  4939. for {
  4940. x, err := c.Do()
  4941. if err != nil {
  4942. return err
  4943. }
  4944. if err := f(x); err != nil {
  4945. return err
  4946. }
  4947. if x.NextPageToken == "" {
  4948. return nil
  4949. }
  4950. c.searchorganizationsrequest.PageToken = x.NextPageToken
  4951. }
  4952. }
  4953. // method id "cloudresourcemanager.organizations.setIamPolicy":
  4954. type OrganizationsSetIamPolicyCall struct {
  4955. s *Service
  4956. resource string
  4957. setiampolicyrequest *SetIamPolicyRequest
  4958. urlParams_ gensupport.URLParams
  4959. ctx_ context.Context
  4960. header_ http.Header
  4961. }
  4962. // SetIamPolicy: Sets the access control policy on an Organization
  4963. // resource. Replaces any
  4964. // existing policy. The `resource` field should be the organization's
  4965. // resource
  4966. // name, e.g. "organizations/123".
  4967. //
  4968. // Authorization requires the Google IAM
  4969. // permission
  4970. // `resourcemanager.organizations.setIamPolicy` on the specified
  4971. // organization
  4972. func (r *OrganizationsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *OrganizationsSetIamPolicyCall {
  4973. c := &OrganizationsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4974. c.resource = resource
  4975. c.setiampolicyrequest = setiampolicyrequest
  4976. return c
  4977. }
  4978. // Fields allows partial responses to be retrieved. See
  4979. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4980. // for more information.
  4981. func (c *OrganizationsSetIamPolicyCall) Fields(s ...googleapi.Field) *OrganizationsSetIamPolicyCall {
  4982. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4983. return c
  4984. }
  4985. // Context sets the context to be used in this call's Do method. Any
  4986. // pending HTTP request will be aborted if the provided context is
  4987. // canceled.
  4988. func (c *OrganizationsSetIamPolicyCall) Context(ctx context.Context) *OrganizationsSetIamPolicyCall {
  4989. c.ctx_ = ctx
  4990. return c
  4991. }
  4992. // Header returns an http.Header that can be modified by the caller to
  4993. // add HTTP headers to the request.
  4994. func (c *OrganizationsSetIamPolicyCall) Header() http.Header {
  4995. if c.header_ == nil {
  4996. c.header_ = make(http.Header)
  4997. }
  4998. return c.header_
  4999. }
  5000. func (c *OrganizationsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5001. reqHeaders := make(http.Header)
  5002. for k, v := range c.header_ {
  5003. reqHeaders[k] = v
  5004. }
  5005. reqHeaders.Set("User-Agent", c.s.userAgent())
  5006. var body io.Reader = nil
  5007. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  5008. if err != nil {
  5009. return nil, err
  5010. }
  5011. reqHeaders.Set("Content-Type", "application/json")
  5012. c.urlParams_.Set("alt", alt)
  5013. c.urlParams_.Set("prettyPrint", "false")
  5014. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  5015. urls += "?" + c.urlParams_.Encode()
  5016. req, err := http.NewRequest("POST", urls, body)
  5017. if err != nil {
  5018. return nil, err
  5019. }
  5020. req.Header = reqHeaders
  5021. googleapi.Expand(req.URL, map[string]string{
  5022. "resource": c.resource,
  5023. })
  5024. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5025. }
  5026. // Do executes the "cloudresourcemanager.organizations.setIamPolicy" call.
  5027. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5028. // code is an error. Response headers are in either
  5029. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5030. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5031. // check whether the returned error was because http.StatusNotModified
  5032. // was returned.
  5033. func (c *OrganizationsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5034. gensupport.SetOptions(c.urlParams_, opts...)
  5035. res, err := c.doRequest("json")
  5036. if res != nil && res.StatusCode == http.StatusNotModified {
  5037. if res.Body != nil {
  5038. res.Body.Close()
  5039. }
  5040. return nil, &googleapi.Error{
  5041. Code: res.StatusCode,
  5042. Header: res.Header,
  5043. }
  5044. }
  5045. if err != nil {
  5046. return nil, err
  5047. }
  5048. defer googleapi.CloseBody(res)
  5049. if err := googleapi.CheckResponse(res); err != nil {
  5050. return nil, err
  5051. }
  5052. ret := &Policy{
  5053. ServerResponse: googleapi.ServerResponse{
  5054. Header: res.Header,
  5055. HTTPStatusCode: res.StatusCode,
  5056. },
  5057. }
  5058. target := &ret
  5059. if err := gensupport.DecodeResponse(target, res); err != nil {
  5060. return nil, err
  5061. }
  5062. return ret, nil
  5063. // {
  5064. // "description": "Sets the access control policy on an Organization resource. Replaces any\nexisting policy. The `resource` field should be the organization's resource\nname, e.g. \"organizations/123\".\n\nAuthorization requires the Google IAM permission\n`resourcemanager.organizations.setIamPolicy` on the specified organization",
  5065. // "flatPath": "v1/organizations/{organizationsId}:setIamPolicy",
  5066. // "httpMethod": "POST",
  5067. // "id": "cloudresourcemanager.organizations.setIamPolicy",
  5068. // "parameterOrder": [
  5069. // "resource"
  5070. // ],
  5071. // "parameters": {
  5072. // "resource": {
  5073. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  5074. // "location": "path",
  5075. // "pattern": "^organizations/[^/]+$",
  5076. // "required": true,
  5077. // "type": "string"
  5078. // }
  5079. // },
  5080. // "path": "v1/{+resource}:setIamPolicy",
  5081. // "request": {
  5082. // "$ref": "SetIamPolicyRequest"
  5083. // },
  5084. // "response": {
  5085. // "$ref": "Policy"
  5086. // },
  5087. // "scopes": [
  5088. // "https://www.googleapis.com/auth/cloud-platform"
  5089. // ]
  5090. // }
  5091. }
  5092. // method id "cloudresourcemanager.organizations.setOrgPolicy":
  5093. type OrganizationsSetOrgPolicyCall struct {
  5094. s *Service
  5095. resource string
  5096. setorgpolicyrequest *SetOrgPolicyRequest
  5097. urlParams_ gensupport.URLParams
  5098. ctx_ context.Context
  5099. header_ http.Header
  5100. }
  5101. // SetOrgPolicy: Updates the specified `Policy` on the resource. Creates
  5102. // a new `Policy` for
  5103. // that `Constraint` on the resource if one does not exist.
  5104. //
  5105. // Not supplying an `etag` on the request `Policy` results in an
  5106. // unconditional
  5107. // write of the `Policy`.
  5108. func (r *OrganizationsService) SetOrgPolicy(resource string, setorgpolicyrequest *SetOrgPolicyRequest) *OrganizationsSetOrgPolicyCall {
  5109. c := &OrganizationsSetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5110. c.resource = resource
  5111. c.setorgpolicyrequest = setorgpolicyrequest
  5112. return c
  5113. }
  5114. // Fields allows partial responses to be retrieved. See
  5115. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5116. // for more information.
  5117. func (c *OrganizationsSetOrgPolicyCall) Fields(s ...googleapi.Field) *OrganizationsSetOrgPolicyCall {
  5118. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5119. return c
  5120. }
  5121. // Context sets the context to be used in this call's Do method. Any
  5122. // pending HTTP request will be aborted if the provided context is
  5123. // canceled.
  5124. func (c *OrganizationsSetOrgPolicyCall) Context(ctx context.Context) *OrganizationsSetOrgPolicyCall {
  5125. c.ctx_ = ctx
  5126. return c
  5127. }
  5128. // Header returns an http.Header that can be modified by the caller to
  5129. // add HTTP headers to the request.
  5130. func (c *OrganizationsSetOrgPolicyCall) Header() http.Header {
  5131. if c.header_ == nil {
  5132. c.header_ = make(http.Header)
  5133. }
  5134. return c.header_
  5135. }
  5136. func (c *OrganizationsSetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  5137. reqHeaders := make(http.Header)
  5138. for k, v := range c.header_ {
  5139. reqHeaders[k] = v
  5140. }
  5141. reqHeaders.Set("User-Agent", c.s.userAgent())
  5142. var body io.Reader = nil
  5143. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setorgpolicyrequest)
  5144. if err != nil {
  5145. return nil, err
  5146. }
  5147. reqHeaders.Set("Content-Type", "application/json")
  5148. c.urlParams_.Set("alt", alt)
  5149. c.urlParams_.Set("prettyPrint", "false")
  5150. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setOrgPolicy")
  5151. urls += "?" + c.urlParams_.Encode()
  5152. req, err := http.NewRequest("POST", urls, body)
  5153. if err != nil {
  5154. return nil, err
  5155. }
  5156. req.Header = reqHeaders
  5157. googleapi.Expand(req.URL, map[string]string{
  5158. "resource": c.resource,
  5159. })
  5160. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5161. }
  5162. // Do executes the "cloudresourcemanager.organizations.setOrgPolicy" call.
  5163. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  5164. // status code is an error. Response headers are in either
  5165. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  5166. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5167. // to check whether the returned error was because
  5168. // http.StatusNotModified was returned.
  5169. func (c *OrganizationsSetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  5170. gensupport.SetOptions(c.urlParams_, opts...)
  5171. res, err := c.doRequest("json")
  5172. if res != nil && res.StatusCode == http.StatusNotModified {
  5173. if res.Body != nil {
  5174. res.Body.Close()
  5175. }
  5176. return nil, &googleapi.Error{
  5177. Code: res.StatusCode,
  5178. Header: res.Header,
  5179. }
  5180. }
  5181. if err != nil {
  5182. return nil, err
  5183. }
  5184. defer googleapi.CloseBody(res)
  5185. if err := googleapi.CheckResponse(res); err != nil {
  5186. return nil, err
  5187. }
  5188. ret := &OrgPolicy{
  5189. ServerResponse: googleapi.ServerResponse{
  5190. Header: res.Header,
  5191. HTTPStatusCode: res.StatusCode,
  5192. },
  5193. }
  5194. target := &ret
  5195. if err := gensupport.DecodeResponse(target, res); err != nil {
  5196. return nil, err
  5197. }
  5198. return ret, nil
  5199. // {
  5200. // "description": "Updates the specified `Policy` on the resource. Creates a new `Policy` for\nthat `Constraint` on the resource if one does not exist.\n\nNot supplying an `etag` on the request `Policy` results in an unconditional\nwrite of the `Policy`.",
  5201. // "flatPath": "v1/organizations/{organizationsId}:setOrgPolicy",
  5202. // "httpMethod": "POST",
  5203. // "id": "cloudresourcemanager.organizations.setOrgPolicy",
  5204. // "parameterOrder": [
  5205. // "resource"
  5206. // ],
  5207. // "parameters": {
  5208. // "resource": {
  5209. // "description": "Resource name of the resource to attach the `Policy`.",
  5210. // "location": "path",
  5211. // "pattern": "^organizations/[^/]+$",
  5212. // "required": true,
  5213. // "type": "string"
  5214. // }
  5215. // },
  5216. // "path": "v1/{+resource}:setOrgPolicy",
  5217. // "request": {
  5218. // "$ref": "SetOrgPolicyRequest"
  5219. // },
  5220. // "response": {
  5221. // "$ref": "OrgPolicy"
  5222. // },
  5223. // "scopes": [
  5224. // "https://www.googleapis.com/auth/cloud-platform"
  5225. // ]
  5226. // }
  5227. }
  5228. // method id "cloudresourcemanager.organizations.testIamPermissions":
  5229. type OrganizationsTestIamPermissionsCall struct {
  5230. s *Service
  5231. resource string
  5232. testiampermissionsrequest *TestIamPermissionsRequest
  5233. urlParams_ gensupport.URLParams
  5234. ctx_ context.Context
  5235. header_ http.Header
  5236. }
  5237. // TestIamPermissions: Returns permissions that a caller has on the
  5238. // specified Organization.
  5239. // The `resource` field should be the organization's resource name,
  5240. // e.g. "organizations/123".
  5241. //
  5242. // There are no permissions required for making this API call.
  5243. func (r *OrganizationsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *OrganizationsTestIamPermissionsCall {
  5244. c := &OrganizationsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5245. c.resource = resource
  5246. c.testiampermissionsrequest = testiampermissionsrequest
  5247. return c
  5248. }
  5249. // Fields allows partial responses to be retrieved. See
  5250. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5251. // for more information.
  5252. func (c *OrganizationsTestIamPermissionsCall) Fields(s ...googleapi.Field) *OrganizationsTestIamPermissionsCall {
  5253. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5254. return c
  5255. }
  5256. // Context sets the context to be used in this call's Do method. Any
  5257. // pending HTTP request will be aborted if the provided context is
  5258. // canceled.
  5259. func (c *OrganizationsTestIamPermissionsCall) Context(ctx context.Context) *OrganizationsTestIamPermissionsCall {
  5260. c.ctx_ = ctx
  5261. return c
  5262. }
  5263. // Header returns an http.Header that can be modified by the caller to
  5264. // add HTTP headers to the request.
  5265. func (c *OrganizationsTestIamPermissionsCall) Header() http.Header {
  5266. if c.header_ == nil {
  5267. c.header_ = make(http.Header)
  5268. }
  5269. return c.header_
  5270. }
  5271. func (c *OrganizationsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  5272. reqHeaders := make(http.Header)
  5273. for k, v := range c.header_ {
  5274. reqHeaders[k] = v
  5275. }
  5276. reqHeaders.Set("User-Agent", c.s.userAgent())
  5277. var body io.Reader = nil
  5278. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  5279. if err != nil {
  5280. return nil, err
  5281. }
  5282. reqHeaders.Set("Content-Type", "application/json")
  5283. c.urlParams_.Set("alt", alt)
  5284. c.urlParams_.Set("prettyPrint", "false")
  5285. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  5286. urls += "?" + c.urlParams_.Encode()
  5287. req, err := http.NewRequest("POST", urls, body)
  5288. if err != nil {
  5289. return nil, err
  5290. }
  5291. req.Header = reqHeaders
  5292. googleapi.Expand(req.URL, map[string]string{
  5293. "resource": c.resource,
  5294. })
  5295. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5296. }
  5297. // Do executes the "cloudresourcemanager.organizations.testIamPermissions" call.
  5298. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  5299. // Any non-2xx status code is an error. Response headers are in either
  5300. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  5301. // was returned at all) in error.(*googleapi.Error).Header. Use
  5302. // googleapi.IsNotModified to check whether the returned error was
  5303. // because http.StatusNotModified was returned.
  5304. func (c *OrganizationsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  5305. gensupport.SetOptions(c.urlParams_, opts...)
  5306. res, err := c.doRequest("json")
  5307. if res != nil && res.StatusCode == http.StatusNotModified {
  5308. if res.Body != nil {
  5309. res.Body.Close()
  5310. }
  5311. return nil, &googleapi.Error{
  5312. Code: res.StatusCode,
  5313. Header: res.Header,
  5314. }
  5315. }
  5316. if err != nil {
  5317. return nil, err
  5318. }
  5319. defer googleapi.CloseBody(res)
  5320. if err := googleapi.CheckResponse(res); err != nil {
  5321. return nil, err
  5322. }
  5323. ret := &TestIamPermissionsResponse{
  5324. ServerResponse: googleapi.ServerResponse{
  5325. Header: res.Header,
  5326. HTTPStatusCode: res.StatusCode,
  5327. },
  5328. }
  5329. target := &ret
  5330. if err := gensupport.DecodeResponse(target, res); err != nil {
  5331. return nil, err
  5332. }
  5333. return ret, nil
  5334. // {
  5335. // "description": "Returns permissions that a caller has on the specified Organization.\nThe `resource` field should be the organization's resource name,\ne.g. \"organizations/123\".\n\nThere are no permissions required for making this API call.",
  5336. // "flatPath": "v1/organizations/{organizationsId}:testIamPermissions",
  5337. // "httpMethod": "POST",
  5338. // "id": "cloudresourcemanager.organizations.testIamPermissions",
  5339. // "parameterOrder": [
  5340. // "resource"
  5341. // ],
  5342. // "parameters": {
  5343. // "resource": {
  5344. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  5345. // "location": "path",
  5346. // "pattern": "^organizations/[^/]+$",
  5347. // "required": true,
  5348. // "type": "string"
  5349. // }
  5350. // },
  5351. // "path": "v1/{+resource}:testIamPermissions",
  5352. // "request": {
  5353. // "$ref": "TestIamPermissionsRequest"
  5354. // },
  5355. // "response": {
  5356. // "$ref": "TestIamPermissionsResponse"
  5357. // },
  5358. // "scopes": [
  5359. // "https://www.googleapis.com/auth/cloud-platform",
  5360. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5361. // ]
  5362. // }
  5363. }
  5364. // method id "cloudresourcemanager.projects.clearOrgPolicy":
  5365. type ProjectsClearOrgPolicyCall struct {
  5366. s *Service
  5367. resource string
  5368. clearorgpolicyrequest *ClearOrgPolicyRequest
  5369. urlParams_ gensupport.URLParams
  5370. ctx_ context.Context
  5371. header_ http.Header
  5372. }
  5373. // ClearOrgPolicy: Clears a `Policy` from a resource.
  5374. func (r *ProjectsService) ClearOrgPolicy(resource string, clearorgpolicyrequest *ClearOrgPolicyRequest) *ProjectsClearOrgPolicyCall {
  5375. c := &ProjectsClearOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5376. c.resource = resource
  5377. c.clearorgpolicyrequest = clearorgpolicyrequest
  5378. return c
  5379. }
  5380. // Fields allows partial responses to be retrieved. See
  5381. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5382. // for more information.
  5383. func (c *ProjectsClearOrgPolicyCall) Fields(s ...googleapi.Field) *ProjectsClearOrgPolicyCall {
  5384. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5385. return c
  5386. }
  5387. // Context sets the context to be used in this call's Do method. Any
  5388. // pending HTTP request will be aborted if the provided context is
  5389. // canceled.
  5390. func (c *ProjectsClearOrgPolicyCall) Context(ctx context.Context) *ProjectsClearOrgPolicyCall {
  5391. c.ctx_ = ctx
  5392. return c
  5393. }
  5394. // Header returns an http.Header that can be modified by the caller to
  5395. // add HTTP headers to the request.
  5396. func (c *ProjectsClearOrgPolicyCall) Header() http.Header {
  5397. if c.header_ == nil {
  5398. c.header_ = make(http.Header)
  5399. }
  5400. return c.header_
  5401. }
  5402. func (c *ProjectsClearOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  5403. reqHeaders := make(http.Header)
  5404. for k, v := range c.header_ {
  5405. reqHeaders[k] = v
  5406. }
  5407. reqHeaders.Set("User-Agent", c.s.userAgent())
  5408. var body io.Reader = nil
  5409. body, err := googleapi.WithoutDataWrapper.JSONReader(c.clearorgpolicyrequest)
  5410. if err != nil {
  5411. return nil, err
  5412. }
  5413. reqHeaders.Set("Content-Type", "application/json")
  5414. c.urlParams_.Set("alt", alt)
  5415. c.urlParams_.Set("prettyPrint", "false")
  5416. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:clearOrgPolicy")
  5417. urls += "?" + c.urlParams_.Encode()
  5418. req, err := http.NewRequest("POST", urls, body)
  5419. if err != nil {
  5420. return nil, err
  5421. }
  5422. req.Header = reqHeaders
  5423. googleapi.Expand(req.URL, map[string]string{
  5424. "resource": c.resource,
  5425. })
  5426. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5427. }
  5428. // Do executes the "cloudresourcemanager.projects.clearOrgPolicy" call.
  5429. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5430. // code is an error. Response headers are in either
  5431. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5432. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5433. // check whether the returned error was because http.StatusNotModified
  5434. // was returned.
  5435. func (c *ProjectsClearOrgPolicyCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5436. gensupport.SetOptions(c.urlParams_, opts...)
  5437. res, err := c.doRequest("json")
  5438. if res != nil && res.StatusCode == http.StatusNotModified {
  5439. if res.Body != nil {
  5440. res.Body.Close()
  5441. }
  5442. return nil, &googleapi.Error{
  5443. Code: res.StatusCode,
  5444. Header: res.Header,
  5445. }
  5446. }
  5447. if err != nil {
  5448. return nil, err
  5449. }
  5450. defer googleapi.CloseBody(res)
  5451. if err := googleapi.CheckResponse(res); err != nil {
  5452. return nil, err
  5453. }
  5454. ret := &Empty{
  5455. ServerResponse: googleapi.ServerResponse{
  5456. Header: res.Header,
  5457. HTTPStatusCode: res.StatusCode,
  5458. },
  5459. }
  5460. target := &ret
  5461. if err := gensupport.DecodeResponse(target, res); err != nil {
  5462. return nil, err
  5463. }
  5464. return ret, nil
  5465. // {
  5466. // "description": "Clears a `Policy` from a resource.",
  5467. // "flatPath": "v1/projects/{projectsId}:clearOrgPolicy",
  5468. // "httpMethod": "POST",
  5469. // "id": "cloudresourcemanager.projects.clearOrgPolicy",
  5470. // "parameterOrder": [
  5471. // "resource"
  5472. // ],
  5473. // "parameters": {
  5474. // "resource": {
  5475. // "description": "Name of the resource for the `Policy` to clear.",
  5476. // "location": "path",
  5477. // "pattern": "^projects/[^/]+$",
  5478. // "required": true,
  5479. // "type": "string"
  5480. // }
  5481. // },
  5482. // "path": "v1/{+resource}:clearOrgPolicy",
  5483. // "request": {
  5484. // "$ref": "ClearOrgPolicyRequest"
  5485. // },
  5486. // "response": {
  5487. // "$ref": "Empty"
  5488. // },
  5489. // "scopes": [
  5490. // "https://www.googleapis.com/auth/cloud-platform"
  5491. // ]
  5492. // }
  5493. }
  5494. // method id "cloudresourcemanager.projects.create":
  5495. type ProjectsCreateCall struct {
  5496. s *Service
  5497. project *Project
  5498. urlParams_ gensupport.URLParams
  5499. ctx_ context.Context
  5500. header_ http.Header
  5501. }
  5502. // Create: Request that a new Project be created. The result is an
  5503. // Operation which
  5504. // can be used to track the creation process. It is automatically
  5505. // deleted
  5506. // after a few hours, so there is no need to call DeleteOperation.
  5507. //
  5508. // Our SLO permits Project creation to take up to 30 seconds at the
  5509. // 90th
  5510. // percentile. As of 2016-08-29, we are observing 6 seconds 50th
  5511. // percentile
  5512. // latency. 95th percentile latency is around 11 seconds. We
  5513. // recommend
  5514. // polling at the 5th second with an exponential backoff.
  5515. //
  5516. // Authorization requires the Google IAM
  5517. // permission
  5518. // `resourcemanager.projects.create` on the specified parent for the
  5519. // new
  5520. // project. The parent is identified by a specified ResourceId,
  5521. // which must include both an ID and a type, such as organization.
  5522. //
  5523. // This method does not associate the new project with a billing
  5524. // account.
  5525. // You can set or update the billing account associated with a project
  5526. // using
  5527. // the
  5528. // [`projects.updateBillingInfo`]
  5529. // (/billing/reference/rest/v1/projects/up
  5530. // dateBillingInfo) method.
  5531. func (r *ProjectsService) Create(project *Project) *ProjectsCreateCall {
  5532. c := &ProjectsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5533. c.project = project
  5534. return c
  5535. }
  5536. // Fields allows partial responses to be retrieved. See
  5537. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5538. // for more information.
  5539. func (c *ProjectsCreateCall) Fields(s ...googleapi.Field) *ProjectsCreateCall {
  5540. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5541. return c
  5542. }
  5543. // Context sets the context to be used in this call's Do method. Any
  5544. // pending HTTP request will be aborted if the provided context is
  5545. // canceled.
  5546. func (c *ProjectsCreateCall) Context(ctx context.Context) *ProjectsCreateCall {
  5547. c.ctx_ = ctx
  5548. return c
  5549. }
  5550. // Header returns an http.Header that can be modified by the caller to
  5551. // add HTTP headers to the request.
  5552. func (c *ProjectsCreateCall) Header() http.Header {
  5553. if c.header_ == nil {
  5554. c.header_ = make(http.Header)
  5555. }
  5556. return c.header_
  5557. }
  5558. func (c *ProjectsCreateCall) doRequest(alt string) (*http.Response, error) {
  5559. reqHeaders := make(http.Header)
  5560. for k, v := range c.header_ {
  5561. reqHeaders[k] = v
  5562. }
  5563. reqHeaders.Set("User-Agent", c.s.userAgent())
  5564. var body io.Reader = nil
  5565. body, err := googleapi.WithoutDataWrapper.JSONReader(c.project)
  5566. if err != nil {
  5567. return nil, err
  5568. }
  5569. reqHeaders.Set("Content-Type", "application/json")
  5570. c.urlParams_.Set("alt", alt)
  5571. c.urlParams_.Set("prettyPrint", "false")
  5572. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects")
  5573. urls += "?" + c.urlParams_.Encode()
  5574. req, err := http.NewRequest("POST", urls, body)
  5575. if err != nil {
  5576. return nil, err
  5577. }
  5578. req.Header = reqHeaders
  5579. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5580. }
  5581. // Do executes the "cloudresourcemanager.projects.create" call.
  5582. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  5583. // status code is an error. Response headers are in either
  5584. // *Operation.ServerResponse.Header or (if a response was returned at
  5585. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5586. // to check whether the returned error was because
  5587. // http.StatusNotModified was returned.
  5588. func (c *ProjectsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  5589. gensupport.SetOptions(c.urlParams_, opts...)
  5590. res, err := c.doRequest("json")
  5591. if res != nil && res.StatusCode == http.StatusNotModified {
  5592. if res.Body != nil {
  5593. res.Body.Close()
  5594. }
  5595. return nil, &googleapi.Error{
  5596. Code: res.StatusCode,
  5597. Header: res.Header,
  5598. }
  5599. }
  5600. if err != nil {
  5601. return nil, err
  5602. }
  5603. defer googleapi.CloseBody(res)
  5604. if err := googleapi.CheckResponse(res); err != nil {
  5605. return nil, err
  5606. }
  5607. ret := &Operation{
  5608. ServerResponse: googleapi.ServerResponse{
  5609. Header: res.Header,
  5610. HTTPStatusCode: res.StatusCode,
  5611. },
  5612. }
  5613. target := &ret
  5614. if err := gensupport.DecodeResponse(target, res); err != nil {
  5615. return nil, err
  5616. }
  5617. return ret, nil
  5618. // {
  5619. // "description": "Request that a new Project be created. The result is an Operation which\ncan be used to track the creation process. It is automatically deleted\nafter a few hours, so there is no need to call DeleteOperation.\n\nOur SLO permits Project creation to take up to 30 seconds at the 90th\npercentile. As of 2016-08-29, we are observing 6 seconds 50th percentile\nlatency. 95th percentile latency is around 11 seconds. We recommend\npolling at the 5th second with an exponential backoff.\n\nAuthorization requires the Google IAM permission\n`resourcemanager.projects.create` on the specified parent for the new\nproject. The parent is identified by a specified ResourceId,\nwhich must include both an ID and a type, such as organization.\n\nThis method does not associate the new project with a billing account.\nYou can set or update the billing account associated with a project using\nthe [`projects.updateBillingInfo`]\n(/billing/reference/rest/v1/projects/updateBillingInfo) method.",
  5620. // "flatPath": "v1/projects",
  5621. // "httpMethod": "POST",
  5622. // "id": "cloudresourcemanager.projects.create",
  5623. // "parameterOrder": [],
  5624. // "parameters": {},
  5625. // "path": "v1/projects",
  5626. // "request": {
  5627. // "$ref": "Project"
  5628. // },
  5629. // "response": {
  5630. // "$ref": "Operation"
  5631. // },
  5632. // "scopes": [
  5633. // "https://www.googleapis.com/auth/cloud-platform"
  5634. // ]
  5635. // }
  5636. }
  5637. // method id "cloudresourcemanager.projects.delete":
  5638. type ProjectsDeleteCall struct {
  5639. s *Service
  5640. projectId string
  5641. urlParams_ gensupport.URLParams
  5642. ctx_ context.Context
  5643. header_ http.Header
  5644. }
  5645. // Delete: Marks the Project identified by the specified
  5646. // `project_id` (for example, `my-project-123`) for deletion.
  5647. // This method will only affect the Project if it has a lifecycle state
  5648. // of
  5649. // ACTIVE.
  5650. //
  5651. // This method changes the Project's lifecycle state from
  5652. // ACTIVE
  5653. // to DELETE_REQUESTED.
  5654. // The deletion starts at an unspecified time,
  5655. // at which point the Project is no longer accessible.
  5656. //
  5657. // Until the deletion completes, you can check the lifecycle
  5658. // state
  5659. // checked by retrieving the Project with GetProject,
  5660. // and the Project remains visible to ListProjects.
  5661. // However, you cannot update the project.
  5662. //
  5663. // After the deletion completes, the Project is not retrievable by
  5664. // the GetProject and
  5665. // ListProjects methods.
  5666. //
  5667. // The caller must have modify permissions for this Project.
  5668. func (r *ProjectsService) Delete(projectId string) *ProjectsDeleteCall {
  5669. c := &ProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5670. c.projectId = projectId
  5671. return c
  5672. }
  5673. // Fields allows partial responses to be retrieved. See
  5674. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5675. // for more information.
  5676. func (c *ProjectsDeleteCall) Fields(s ...googleapi.Field) *ProjectsDeleteCall {
  5677. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5678. return c
  5679. }
  5680. // Context sets the context to be used in this call's Do method. Any
  5681. // pending HTTP request will be aborted if the provided context is
  5682. // canceled.
  5683. func (c *ProjectsDeleteCall) Context(ctx context.Context) *ProjectsDeleteCall {
  5684. c.ctx_ = ctx
  5685. return c
  5686. }
  5687. // Header returns an http.Header that can be modified by the caller to
  5688. // add HTTP headers to the request.
  5689. func (c *ProjectsDeleteCall) Header() http.Header {
  5690. if c.header_ == nil {
  5691. c.header_ = make(http.Header)
  5692. }
  5693. return c.header_
  5694. }
  5695. func (c *ProjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5696. reqHeaders := make(http.Header)
  5697. for k, v := range c.header_ {
  5698. reqHeaders[k] = v
  5699. }
  5700. reqHeaders.Set("User-Agent", c.s.userAgent())
  5701. var body io.Reader = nil
  5702. c.urlParams_.Set("alt", alt)
  5703. c.urlParams_.Set("prettyPrint", "false")
  5704. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}")
  5705. urls += "?" + c.urlParams_.Encode()
  5706. req, err := http.NewRequest("DELETE", urls, body)
  5707. if err != nil {
  5708. return nil, err
  5709. }
  5710. req.Header = reqHeaders
  5711. googleapi.Expand(req.URL, map[string]string{
  5712. "projectId": c.projectId,
  5713. })
  5714. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5715. }
  5716. // Do executes the "cloudresourcemanager.projects.delete" call.
  5717. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  5718. // code is an error. Response headers are in either
  5719. // *Empty.ServerResponse.Header or (if a response was returned at all)
  5720. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5721. // check whether the returned error was because http.StatusNotModified
  5722. // was returned.
  5723. func (c *ProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  5724. gensupport.SetOptions(c.urlParams_, opts...)
  5725. res, err := c.doRequest("json")
  5726. if res != nil && res.StatusCode == http.StatusNotModified {
  5727. if res.Body != nil {
  5728. res.Body.Close()
  5729. }
  5730. return nil, &googleapi.Error{
  5731. Code: res.StatusCode,
  5732. Header: res.Header,
  5733. }
  5734. }
  5735. if err != nil {
  5736. return nil, err
  5737. }
  5738. defer googleapi.CloseBody(res)
  5739. if err := googleapi.CheckResponse(res); err != nil {
  5740. return nil, err
  5741. }
  5742. ret := &Empty{
  5743. ServerResponse: googleapi.ServerResponse{
  5744. Header: res.Header,
  5745. HTTPStatusCode: res.StatusCode,
  5746. },
  5747. }
  5748. target := &ret
  5749. if err := gensupport.DecodeResponse(target, res); err != nil {
  5750. return nil, err
  5751. }
  5752. return ret, nil
  5753. // {
  5754. // "description": "Marks the Project identified by the specified\n`project_id` (for example, `my-project-123`) for deletion.\nThis method will only affect the Project if it has a lifecycle state of\nACTIVE.\n\nThis method changes the Project's lifecycle state from\nACTIVE\nto DELETE_REQUESTED.\nThe deletion starts at an unspecified time,\nat which point the Project is no longer accessible.\n\nUntil the deletion completes, you can check the lifecycle state\nchecked by retrieving the Project with GetProject,\nand the Project remains visible to ListProjects.\nHowever, you cannot update the project.\n\nAfter the deletion completes, the Project is not retrievable by\nthe GetProject and\nListProjects methods.\n\nThe caller must have modify permissions for this Project.",
  5755. // "flatPath": "v1/projects/{projectId}",
  5756. // "httpMethod": "DELETE",
  5757. // "id": "cloudresourcemanager.projects.delete",
  5758. // "parameterOrder": [
  5759. // "projectId"
  5760. // ],
  5761. // "parameters": {
  5762. // "projectId": {
  5763. // "description": "The Project ID (for example, `foo-bar-123`).\n\nRequired.",
  5764. // "location": "path",
  5765. // "required": true,
  5766. // "type": "string"
  5767. // }
  5768. // },
  5769. // "path": "v1/projects/{projectId}",
  5770. // "response": {
  5771. // "$ref": "Empty"
  5772. // },
  5773. // "scopes": [
  5774. // "https://www.googleapis.com/auth/cloud-platform"
  5775. // ]
  5776. // }
  5777. }
  5778. // method id "cloudresourcemanager.projects.get":
  5779. type ProjectsGetCall struct {
  5780. s *Service
  5781. projectId string
  5782. urlParams_ gensupport.URLParams
  5783. ifNoneMatch_ string
  5784. ctx_ context.Context
  5785. header_ http.Header
  5786. }
  5787. // Get: Retrieves the Project identified by the specified
  5788. // `project_id` (for example, `my-project-123`).
  5789. //
  5790. // The caller must have read permissions for this Project.
  5791. func (r *ProjectsService) Get(projectId string) *ProjectsGetCall {
  5792. c := &ProjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5793. c.projectId = projectId
  5794. return c
  5795. }
  5796. // Fields allows partial responses to be retrieved. See
  5797. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5798. // for more information.
  5799. func (c *ProjectsGetCall) Fields(s ...googleapi.Field) *ProjectsGetCall {
  5800. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5801. return c
  5802. }
  5803. // IfNoneMatch sets the optional parameter which makes the operation
  5804. // fail if the object's ETag matches the given value. This is useful for
  5805. // getting updates only after the object has changed since the last
  5806. // request. Use googleapi.IsNotModified to check whether the response
  5807. // error from Do is the result of In-None-Match.
  5808. func (c *ProjectsGetCall) IfNoneMatch(entityTag string) *ProjectsGetCall {
  5809. c.ifNoneMatch_ = entityTag
  5810. return c
  5811. }
  5812. // Context sets the context to be used in this call's Do method. Any
  5813. // pending HTTP request will be aborted if the provided context is
  5814. // canceled.
  5815. func (c *ProjectsGetCall) Context(ctx context.Context) *ProjectsGetCall {
  5816. c.ctx_ = ctx
  5817. return c
  5818. }
  5819. // Header returns an http.Header that can be modified by the caller to
  5820. // add HTTP headers to the request.
  5821. func (c *ProjectsGetCall) Header() http.Header {
  5822. if c.header_ == nil {
  5823. c.header_ = make(http.Header)
  5824. }
  5825. return c.header_
  5826. }
  5827. func (c *ProjectsGetCall) doRequest(alt string) (*http.Response, error) {
  5828. reqHeaders := make(http.Header)
  5829. for k, v := range c.header_ {
  5830. reqHeaders[k] = v
  5831. }
  5832. reqHeaders.Set("User-Agent", c.s.userAgent())
  5833. if c.ifNoneMatch_ != "" {
  5834. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5835. }
  5836. var body io.Reader = nil
  5837. c.urlParams_.Set("alt", alt)
  5838. c.urlParams_.Set("prettyPrint", "false")
  5839. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}")
  5840. urls += "?" + c.urlParams_.Encode()
  5841. req, err := http.NewRequest("GET", urls, body)
  5842. if err != nil {
  5843. return nil, err
  5844. }
  5845. req.Header = reqHeaders
  5846. googleapi.Expand(req.URL, map[string]string{
  5847. "projectId": c.projectId,
  5848. })
  5849. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5850. }
  5851. // Do executes the "cloudresourcemanager.projects.get" call.
  5852. // Exactly one of *Project or error will be non-nil. Any non-2xx status
  5853. // code is an error. Response headers are in either
  5854. // *Project.ServerResponse.Header or (if a response was returned at all)
  5855. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5856. // check whether the returned error was because http.StatusNotModified
  5857. // was returned.
  5858. func (c *ProjectsGetCall) Do(opts ...googleapi.CallOption) (*Project, error) {
  5859. gensupport.SetOptions(c.urlParams_, opts...)
  5860. res, err := c.doRequest("json")
  5861. if res != nil && res.StatusCode == http.StatusNotModified {
  5862. if res.Body != nil {
  5863. res.Body.Close()
  5864. }
  5865. return nil, &googleapi.Error{
  5866. Code: res.StatusCode,
  5867. Header: res.Header,
  5868. }
  5869. }
  5870. if err != nil {
  5871. return nil, err
  5872. }
  5873. defer googleapi.CloseBody(res)
  5874. if err := googleapi.CheckResponse(res); err != nil {
  5875. return nil, err
  5876. }
  5877. ret := &Project{
  5878. ServerResponse: googleapi.ServerResponse{
  5879. Header: res.Header,
  5880. HTTPStatusCode: res.StatusCode,
  5881. },
  5882. }
  5883. target := &ret
  5884. if err := gensupport.DecodeResponse(target, res); err != nil {
  5885. return nil, err
  5886. }
  5887. return ret, nil
  5888. // {
  5889. // "description": "Retrieves the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.",
  5890. // "flatPath": "v1/projects/{projectId}",
  5891. // "httpMethod": "GET",
  5892. // "id": "cloudresourcemanager.projects.get",
  5893. // "parameterOrder": [
  5894. // "projectId"
  5895. // ],
  5896. // "parameters": {
  5897. // "projectId": {
  5898. // "description": "The Project ID (for example, `my-project-123`).\n\nRequired.",
  5899. // "location": "path",
  5900. // "required": true,
  5901. // "type": "string"
  5902. // }
  5903. // },
  5904. // "path": "v1/projects/{projectId}",
  5905. // "response": {
  5906. // "$ref": "Project"
  5907. // },
  5908. // "scopes": [
  5909. // "https://www.googleapis.com/auth/cloud-platform",
  5910. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5911. // ]
  5912. // }
  5913. }
  5914. // method id "cloudresourcemanager.projects.getAncestry":
  5915. type ProjectsGetAncestryCall struct {
  5916. s *Service
  5917. projectId string
  5918. getancestryrequest *GetAncestryRequest
  5919. urlParams_ gensupport.URLParams
  5920. ctx_ context.Context
  5921. header_ http.Header
  5922. }
  5923. // GetAncestry: Gets a list of ancestors in the resource hierarchy for
  5924. // the Project
  5925. // identified by the specified `project_id` (for example,
  5926. // `my-project-123`).
  5927. //
  5928. // The caller must have read permissions for this Project.
  5929. func (r *ProjectsService) GetAncestry(projectId string, getancestryrequest *GetAncestryRequest) *ProjectsGetAncestryCall {
  5930. c := &ProjectsGetAncestryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5931. c.projectId = projectId
  5932. c.getancestryrequest = getancestryrequest
  5933. return c
  5934. }
  5935. // Fields allows partial responses to be retrieved. See
  5936. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5937. // for more information.
  5938. func (c *ProjectsGetAncestryCall) Fields(s ...googleapi.Field) *ProjectsGetAncestryCall {
  5939. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5940. return c
  5941. }
  5942. // Context sets the context to be used in this call's Do method. Any
  5943. // pending HTTP request will be aborted if the provided context is
  5944. // canceled.
  5945. func (c *ProjectsGetAncestryCall) Context(ctx context.Context) *ProjectsGetAncestryCall {
  5946. c.ctx_ = ctx
  5947. return c
  5948. }
  5949. // Header returns an http.Header that can be modified by the caller to
  5950. // add HTTP headers to the request.
  5951. func (c *ProjectsGetAncestryCall) Header() http.Header {
  5952. if c.header_ == nil {
  5953. c.header_ = make(http.Header)
  5954. }
  5955. return c.header_
  5956. }
  5957. func (c *ProjectsGetAncestryCall) doRequest(alt string) (*http.Response, error) {
  5958. reqHeaders := make(http.Header)
  5959. for k, v := range c.header_ {
  5960. reqHeaders[k] = v
  5961. }
  5962. reqHeaders.Set("User-Agent", c.s.userAgent())
  5963. var body io.Reader = nil
  5964. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getancestryrequest)
  5965. if err != nil {
  5966. return nil, err
  5967. }
  5968. reqHeaders.Set("Content-Type", "application/json")
  5969. c.urlParams_.Set("alt", alt)
  5970. c.urlParams_.Set("prettyPrint", "false")
  5971. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}:getAncestry")
  5972. urls += "?" + c.urlParams_.Encode()
  5973. req, err := http.NewRequest("POST", urls, body)
  5974. if err != nil {
  5975. return nil, err
  5976. }
  5977. req.Header = reqHeaders
  5978. googleapi.Expand(req.URL, map[string]string{
  5979. "projectId": c.projectId,
  5980. })
  5981. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5982. }
  5983. // Do executes the "cloudresourcemanager.projects.getAncestry" call.
  5984. // Exactly one of *GetAncestryResponse or error will be non-nil. Any
  5985. // non-2xx status code is an error. Response headers are in either
  5986. // *GetAncestryResponse.ServerResponse.Header or (if a response was
  5987. // returned at all) in error.(*googleapi.Error).Header. Use
  5988. // googleapi.IsNotModified to check whether the returned error was
  5989. // because http.StatusNotModified was returned.
  5990. func (c *ProjectsGetAncestryCall) Do(opts ...googleapi.CallOption) (*GetAncestryResponse, error) {
  5991. gensupport.SetOptions(c.urlParams_, opts...)
  5992. res, err := c.doRequest("json")
  5993. if res != nil && res.StatusCode == http.StatusNotModified {
  5994. if res.Body != nil {
  5995. res.Body.Close()
  5996. }
  5997. return nil, &googleapi.Error{
  5998. Code: res.StatusCode,
  5999. Header: res.Header,
  6000. }
  6001. }
  6002. if err != nil {
  6003. return nil, err
  6004. }
  6005. defer googleapi.CloseBody(res)
  6006. if err := googleapi.CheckResponse(res); err != nil {
  6007. return nil, err
  6008. }
  6009. ret := &GetAncestryResponse{
  6010. ServerResponse: googleapi.ServerResponse{
  6011. Header: res.Header,
  6012. HTTPStatusCode: res.StatusCode,
  6013. },
  6014. }
  6015. target := &ret
  6016. if err := gensupport.DecodeResponse(target, res); err != nil {
  6017. return nil, err
  6018. }
  6019. return ret, nil
  6020. // {
  6021. // "description": "Gets a list of ancestors in the resource hierarchy for the Project\nidentified by the specified `project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.",
  6022. // "flatPath": "v1/projects/{projectId}:getAncestry",
  6023. // "httpMethod": "POST",
  6024. // "id": "cloudresourcemanager.projects.getAncestry",
  6025. // "parameterOrder": [
  6026. // "projectId"
  6027. // ],
  6028. // "parameters": {
  6029. // "projectId": {
  6030. // "description": "The Project ID (for example, `my-project-123`).\n\nRequired.",
  6031. // "location": "path",
  6032. // "required": true,
  6033. // "type": "string"
  6034. // }
  6035. // },
  6036. // "path": "v1/projects/{projectId}:getAncestry",
  6037. // "request": {
  6038. // "$ref": "GetAncestryRequest"
  6039. // },
  6040. // "response": {
  6041. // "$ref": "GetAncestryResponse"
  6042. // },
  6043. // "scopes": [
  6044. // "https://www.googleapis.com/auth/cloud-platform",
  6045. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6046. // ]
  6047. // }
  6048. }
  6049. // method id "cloudresourcemanager.projects.getEffectiveOrgPolicy":
  6050. type ProjectsGetEffectiveOrgPolicyCall struct {
  6051. s *Service
  6052. resource string
  6053. geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest
  6054. urlParams_ gensupport.URLParams
  6055. ctx_ context.Context
  6056. header_ http.Header
  6057. }
  6058. // GetEffectiveOrgPolicy: Gets the effective `Policy` on a resource.
  6059. // This is the result of merging
  6060. // `Policies` in the resource hierarchy. The returned `Policy` will not
  6061. // have
  6062. // an `etag`set because it is a computed `Policy` across multiple
  6063. // resources.
  6064. // Subtrees of Resource Manager resource hierarchy with 'under:' prefix
  6065. // will
  6066. // not be expanded.
  6067. func (r *ProjectsService) GetEffectiveOrgPolicy(resource string, geteffectiveorgpolicyrequest *GetEffectiveOrgPolicyRequest) *ProjectsGetEffectiveOrgPolicyCall {
  6068. c := &ProjectsGetEffectiveOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6069. c.resource = resource
  6070. c.geteffectiveorgpolicyrequest = geteffectiveorgpolicyrequest
  6071. return c
  6072. }
  6073. // Fields allows partial responses to be retrieved. See
  6074. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6075. // for more information.
  6076. func (c *ProjectsGetEffectiveOrgPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetEffectiveOrgPolicyCall {
  6077. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6078. return c
  6079. }
  6080. // Context sets the context to be used in this call's Do method. Any
  6081. // pending HTTP request will be aborted if the provided context is
  6082. // canceled.
  6083. func (c *ProjectsGetEffectiveOrgPolicyCall) Context(ctx context.Context) *ProjectsGetEffectiveOrgPolicyCall {
  6084. c.ctx_ = ctx
  6085. return c
  6086. }
  6087. // Header returns an http.Header that can be modified by the caller to
  6088. // add HTTP headers to the request.
  6089. func (c *ProjectsGetEffectiveOrgPolicyCall) Header() http.Header {
  6090. if c.header_ == nil {
  6091. c.header_ = make(http.Header)
  6092. }
  6093. return c.header_
  6094. }
  6095. func (c *ProjectsGetEffectiveOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  6096. reqHeaders := make(http.Header)
  6097. for k, v := range c.header_ {
  6098. reqHeaders[k] = v
  6099. }
  6100. reqHeaders.Set("User-Agent", c.s.userAgent())
  6101. var body io.Reader = nil
  6102. body, err := googleapi.WithoutDataWrapper.JSONReader(c.geteffectiveorgpolicyrequest)
  6103. if err != nil {
  6104. return nil, err
  6105. }
  6106. reqHeaders.Set("Content-Type", "application/json")
  6107. c.urlParams_.Set("alt", alt)
  6108. c.urlParams_.Set("prettyPrint", "false")
  6109. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getEffectiveOrgPolicy")
  6110. urls += "?" + c.urlParams_.Encode()
  6111. req, err := http.NewRequest("POST", urls, body)
  6112. if err != nil {
  6113. return nil, err
  6114. }
  6115. req.Header = reqHeaders
  6116. googleapi.Expand(req.URL, map[string]string{
  6117. "resource": c.resource,
  6118. })
  6119. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6120. }
  6121. // Do executes the "cloudresourcemanager.projects.getEffectiveOrgPolicy" call.
  6122. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  6123. // status code is an error. Response headers are in either
  6124. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  6125. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6126. // to check whether the returned error was because
  6127. // http.StatusNotModified was returned.
  6128. func (c *ProjectsGetEffectiveOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  6129. gensupport.SetOptions(c.urlParams_, opts...)
  6130. res, err := c.doRequest("json")
  6131. if res != nil && res.StatusCode == http.StatusNotModified {
  6132. if res.Body != nil {
  6133. res.Body.Close()
  6134. }
  6135. return nil, &googleapi.Error{
  6136. Code: res.StatusCode,
  6137. Header: res.Header,
  6138. }
  6139. }
  6140. if err != nil {
  6141. return nil, err
  6142. }
  6143. defer googleapi.CloseBody(res)
  6144. if err := googleapi.CheckResponse(res); err != nil {
  6145. return nil, err
  6146. }
  6147. ret := &OrgPolicy{
  6148. ServerResponse: googleapi.ServerResponse{
  6149. Header: res.Header,
  6150. HTTPStatusCode: res.StatusCode,
  6151. },
  6152. }
  6153. target := &ret
  6154. if err := gensupport.DecodeResponse(target, res); err != nil {
  6155. return nil, err
  6156. }
  6157. return ret, nil
  6158. // {
  6159. // "description": "Gets the effective `Policy` on a resource. This is the result of merging\n`Policies` in the resource hierarchy. The returned `Policy` will not have\nan `etag`set because it is a computed `Policy` across multiple resources.\nSubtrees of Resource Manager resource hierarchy with 'under:' prefix will\nnot be expanded.",
  6160. // "flatPath": "v1/projects/{projectsId}:getEffectiveOrgPolicy",
  6161. // "httpMethod": "POST",
  6162. // "id": "cloudresourcemanager.projects.getEffectiveOrgPolicy",
  6163. // "parameterOrder": [
  6164. // "resource"
  6165. // ],
  6166. // "parameters": {
  6167. // "resource": {
  6168. // "description": "The name of the resource to start computing the effective `Policy`.",
  6169. // "location": "path",
  6170. // "pattern": "^projects/[^/]+$",
  6171. // "required": true,
  6172. // "type": "string"
  6173. // }
  6174. // },
  6175. // "path": "v1/{+resource}:getEffectiveOrgPolicy",
  6176. // "request": {
  6177. // "$ref": "GetEffectiveOrgPolicyRequest"
  6178. // },
  6179. // "response": {
  6180. // "$ref": "OrgPolicy"
  6181. // },
  6182. // "scopes": [
  6183. // "https://www.googleapis.com/auth/cloud-platform",
  6184. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6185. // ]
  6186. // }
  6187. }
  6188. // method id "cloudresourcemanager.projects.getIamPolicy":
  6189. type ProjectsGetIamPolicyCall struct {
  6190. s *Service
  6191. resource string
  6192. getiampolicyrequest *GetIamPolicyRequest
  6193. urlParams_ gensupport.URLParams
  6194. ctx_ context.Context
  6195. header_ http.Header
  6196. }
  6197. // GetIamPolicy: Returns the IAM access control policy for the specified
  6198. // Project.
  6199. // Permission is denied if the policy or the resource does not
  6200. // exist.
  6201. //
  6202. // Authorization requires the Google IAM
  6203. // permission
  6204. // `resourcemanager.projects.getIamPolicy` on the project.
  6205. //
  6206. // For additional information about resource structure and
  6207. // identification,
  6208. // see [Resource Names](/apis/design/resource_names).
  6209. func (r *ProjectsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsGetIamPolicyCall {
  6210. c := &ProjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6211. c.resource = resource
  6212. c.getiampolicyrequest = getiampolicyrequest
  6213. return c
  6214. }
  6215. // Fields allows partial responses to be retrieved. See
  6216. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6217. // for more information.
  6218. func (c *ProjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetIamPolicyCall {
  6219. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6220. return c
  6221. }
  6222. // Context sets the context to be used in this call's Do method. Any
  6223. // pending HTTP request will be aborted if the provided context is
  6224. // canceled.
  6225. func (c *ProjectsGetIamPolicyCall) Context(ctx context.Context) *ProjectsGetIamPolicyCall {
  6226. c.ctx_ = ctx
  6227. return c
  6228. }
  6229. // Header returns an http.Header that can be modified by the caller to
  6230. // add HTTP headers to the request.
  6231. func (c *ProjectsGetIamPolicyCall) Header() http.Header {
  6232. if c.header_ == nil {
  6233. c.header_ = make(http.Header)
  6234. }
  6235. return c.header_
  6236. }
  6237. func (c *ProjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  6238. reqHeaders := make(http.Header)
  6239. for k, v := range c.header_ {
  6240. reqHeaders[k] = v
  6241. }
  6242. reqHeaders.Set("User-Agent", c.s.userAgent())
  6243. var body io.Reader = nil
  6244. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest)
  6245. if err != nil {
  6246. return nil, err
  6247. }
  6248. reqHeaders.Set("Content-Type", "application/json")
  6249. c.urlParams_.Set("alt", alt)
  6250. c.urlParams_.Set("prettyPrint", "false")
  6251. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{resource}:getIamPolicy")
  6252. urls += "?" + c.urlParams_.Encode()
  6253. req, err := http.NewRequest("POST", urls, body)
  6254. if err != nil {
  6255. return nil, err
  6256. }
  6257. req.Header = reqHeaders
  6258. googleapi.Expand(req.URL, map[string]string{
  6259. "resource": c.resource,
  6260. })
  6261. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6262. }
  6263. // Do executes the "cloudresourcemanager.projects.getIamPolicy" call.
  6264. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  6265. // code is an error. Response headers are in either
  6266. // *Policy.ServerResponse.Header or (if a response was returned at all)
  6267. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6268. // check whether the returned error was because http.StatusNotModified
  6269. // was returned.
  6270. func (c *ProjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  6271. gensupport.SetOptions(c.urlParams_, opts...)
  6272. res, err := c.doRequest("json")
  6273. if res != nil && res.StatusCode == http.StatusNotModified {
  6274. if res.Body != nil {
  6275. res.Body.Close()
  6276. }
  6277. return nil, &googleapi.Error{
  6278. Code: res.StatusCode,
  6279. Header: res.Header,
  6280. }
  6281. }
  6282. if err != nil {
  6283. return nil, err
  6284. }
  6285. defer googleapi.CloseBody(res)
  6286. if err := googleapi.CheckResponse(res); err != nil {
  6287. return nil, err
  6288. }
  6289. ret := &Policy{
  6290. ServerResponse: googleapi.ServerResponse{
  6291. Header: res.Header,
  6292. HTTPStatusCode: res.StatusCode,
  6293. },
  6294. }
  6295. target := &ret
  6296. if err := gensupport.DecodeResponse(target, res); err != nil {
  6297. return nil, err
  6298. }
  6299. return ret, nil
  6300. // {
  6301. // "description": "Returns the IAM access control policy for the specified Project.\nPermission is denied if the policy or the resource does not exist.\n\nAuthorization requires the Google IAM permission\n`resourcemanager.projects.getIamPolicy` on the project.\n\nFor additional information about resource structure and identification,\nsee [Resource Names](/apis/design/resource_names).",
  6302. // "flatPath": "v1/projects/{resource}:getIamPolicy",
  6303. // "httpMethod": "POST",
  6304. // "id": "cloudresourcemanager.projects.getIamPolicy",
  6305. // "parameterOrder": [
  6306. // "resource"
  6307. // ],
  6308. // "parameters": {
  6309. // "resource": {
  6310. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  6311. // "location": "path",
  6312. // "required": true,
  6313. // "type": "string"
  6314. // }
  6315. // },
  6316. // "path": "v1/projects/{resource}:getIamPolicy",
  6317. // "request": {
  6318. // "$ref": "GetIamPolicyRequest"
  6319. // },
  6320. // "response": {
  6321. // "$ref": "Policy"
  6322. // },
  6323. // "scopes": [
  6324. // "https://www.googleapis.com/auth/cloud-platform",
  6325. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6326. // ]
  6327. // }
  6328. }
  6329. // method id "cloudresourcemanager.projects.getOrgPolicy":
  6330. type ProjectsGetOrgPolicyCall struct {
  6331. s *Service
  6332. resource string
  6333. getorgpolicyrequest *GetOrgPolicyRequest
  6334. urlParams_ gensupport.URLParams
  6335. ctx_ context.Context
  6336. header_ http.Header
  6337. }
  6338. // GetOrgPolicy: Gets a `Policy` on a resource.
  6339. //
  6340. // If no `Policy` is set on the resource, a `Policy` is returned with
  6341. // default
  6342. // values including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`.
  6343. // The
  6344. // `etag` value can be used with `SetOrgPolicy()` to create or update
  6345. // a
  6346. // `Policy` during read-modify-write.
  6347. func (r *ProjectsService) GetOrgPolicy(resource string, getorgpolicyrequest *GetOrgPolicyRequest) *ProjectsGetOrgPolicyCall {
  6348. c := &ProjectsGetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6349. c.resource = resource
  6350. c.getorgpolicyrequest = getorgpolicyrequest
  6351. return c
  6352. }
  6353. // Fields allows partial responses to be retrieved. See
  6354. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6355. // for more information.
  6356. func (c *ProjectsGetOrgPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetOrgPolicyCall {
  6357. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6358. return c
  6359. }
  6360. // Context sets the context to be used in this call's Do method. Any
  6361. // pending HTTP request will be aborted if the provided context is
  6362. // canceled.
  6363. func (c *ProjectsGetOrgPolicyCall) Context(ctx context.Context) *ProjectsGetOrgPolicyCall {
  6364. c.ctx_ = ctx
  6365. return c
  6366. }
  6367. // Header returns an http.Header that can be modified by the caller to
  6368. // add HTTP headers to the request.
  6369. func (c *ProjectsGetOrgPolicyCall) Header() http.Header {
  6370. if c.header_ == nil {
  6371. c.header_ = make(http.Header)
  6372. }
  6373. return c.header_
  6374. }
  6375. func (c *ProjectsGetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  6376. reqHeaders := make(http.Header)
  6377. for k, v := range c.header_ {
  6378. reqHeaders[k] = v
  6379. }
  6380. reqHeaders.Set("User-Agent", c.s.userAgent())
  6381. var body io.Reader = nil
  6382. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getorgpolicyrequest)
  6383. if err != nil {
  6384. return nil, err
  6385. }
  6386. reqHeaders.Set("Content-Type", "application/json")
  6387. c.urlParams_.Set("alt", alt)
  6388. c.urlParams_.Set("prettyPrint", "false")
  6389. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getOrgPolicy")
  6390. urls += "?" + c.urlParams_.Encode()
  6391. req, err := http.NewRequest("POST", urls, body)
  6392. if err != nil {
  6393. return nil, err
  6394. }
  6395. req.Header = reqHeaders
  6396. googleapi.Expand(req.URL, map[string]string{
  6397. "resource": c.resource,
  6398. })
  6399. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6400. }
  6401. // Do executes the "cloudresourcemanager.projects.getOrgPolicy" call.
  6402. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  6403. // status code is an error. Response headers are in either
  6404. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  6405. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6406. // to check whether the returned error was because
  6407. // http.StatusNotModified was returned.
  6408. func (c *ProjectsGetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  6409. gensupport.SetOptions(c.urlParams_, opts...)
  6410. res, err := c.doRequest("json")
  6411. if res != nil && res.StatusCode == http.StatusNotModified {
  6412. if res.Body != nil {
  6413. res.Body.Close()
  6414. }
  6415. return nil, &googleapi.Error{
  6416. Code: res.StatusCode,
  6417. Header: res.Header,
  6418. }
  6419. }
  6420. if err != nil {
  6421. return nil, err
  6422. }
  6423. defer googleapi.CloseBody(res)
  6424. if err := googleapi.CheckResponse(res); err != nil {
  6425. return nil, err
  6426. }
  6427. ret := &OrgPolicy{
  6428. ServerResponse: googleapi.ServerResponse{
  6429. Header: res.Header,
  6430. HTTPStatusCode: res.StatusCode,
  6431. },
  6432. }
  6433. target := &ret
  6434. if err := gensupport.DecodeResponse(target, res); err != nil {
  6435. return nil, err
  6436. }
  6437. return ret, nil
  6438. // {
  6439. // "description": "Gets a `Policy` on a resource.\n\nIf no `Policy` is set on the resource, a `Policy` is returned with default\nvalues including `POLICY_TYPE_NOT_SET` for the `policy_type oneof`. The\n`etag` value can be used with `SetOrgPolicy()` to create or update a\n`Policy` during read-modify-write.",
  6440. // "flatPath": "v1/projects/{projectsId}:getOrgPolicy",
  6441. // "httpMethod": "POST",
  6442. // "id": "cloudresourcemanager.projects.getOrgPolicy",
  6443. // "parameterOrder": [
  6444. // "resource"
  6445. // ],
  6446. // "parameters": {
  6447. // "resource": {
  6448. // "description": "Name of the resource the `Policy` is set on.",
  6449. // "location": "path",
  6450. // "pattern": "^projects/[^/]+$",
  6451. // "required": true,
  6452. // "type": "string"
  6453. // }
  6454. // },
  6455. // "path": "v1/{+resource}:getOrgPolicy",
  6456. // "request": {
  6457. // "$ref": "GetOrgPolicyRequest"
  6458. // },
  6459. // "response": {
  6460. // "$ref": "OrgPolicy"
  6461. // },
  6462. // "scopes": [
  6463. // "https://www.googleapis.com/auth/cloud-platform",
  6464. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6465. // ]
  6466. // }
  6467. }
  6468. // method id "cloudresourcemanager.projects.list":
  6469. type ProjectsListCall struct {
  6470. s *Service
  6471. urlParams_ gensupport.URLParams
  6472. ifNoneMatch_ string
  6473. ctx_ context.Context
  6474. header_ http.Header
  6475. }
  6476. // List: Lists Projects that are visible to the user and satisfy
  6477. // the
  6478. // specified filter. This method returns Projects in an unspecified
  6479. // order.
  6480. // This method is eventually consistent with project mutations; this
  6481. // means
  6482. // that a newly created project may not appear in the results or
  6483. // recent
  6484. // updates to an existing project may not be reflected in the results.
  6485. // To
  6486. // retrieve the latest state of a project, use the
  6487. // GetProject method.
  6488. func (r *ProjectsService) List() *ProjectsListCall {
  6489. c := &ProjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6490. return c
  6491. }
  6492. // Filter sets the optional parameter "filter": An expression for
  6493. // filtering the results of the request. Filter rules are
  6494. // case insensitive. The fields eligible for filtering are:
  6495. //
  6496. // + `name`
  6497. // + `id`
  6498. // + <code>labels.<em>key</em></code> where *key* is the name of a
  6499. // label
  6500. //
  6501. // Some examples of using labels as
  6502. // filters:
  6503. //
  6504. // |Filter|Description|
  6505. // |------|-----------|
  6506. // |name:how*|The project's name starts with "how".|
  6507. // |name:Howl|The project's name is `Howl` or
  6508. // `howl`.|
  6509. // |name:HOWL|Equivalent to above.|
  6510. // |NAME:howl|Equivalent to above.|
  6511. // |labels.color:*|The project has the label
  6512. // `color`.|
  6513. // |labels.color:red|The project's label `color` has the value
  6514. // `red`.|
  6515. // |labels.color:red&nbsp;labels.size:big|The project's label `color`
  6516. // has the value `red` and its label `size` has the value `big`.
  6517. //
  6518. // If you specify a filter that has both `parent.type` and `parent.id`,
  6519. // then
  6520. // the `resourcemanager.projects.list` permission is checked on the
  6521. // parent.
  6522. // If the user has this permission, all projects under the parent will
  6523. // be
  6524. // returned after remaining filters have been applied. If the user lacks
  6525. // this
  6526. // permission, then all projects for which the user has
  6527. // the
  6528. // `resourcemanager.projects.get` permission will be returned after
  6529. // remaining
  6530. // filters have been applied. If no filter is specified, the call will
  6531. // return
  6532. // projects for which the user has `resourcemanager.projects.get`
  6533. // permissions.
  6534. func (c *ProjectsListCall) Filter(filter string) *ProjectsListCall {
  6535. c.urlParams_.Set("filter", filter)
  6536. return c
  6537. }
  6538. // PageSize sets the optional parameter "pageSize": The maximum number
  6539. // of Projects to return in the response.
  6540. // The server can return fewer Projects than requested.
  6541. // If unspecified, server picks an appropriate default.
  6542. func (c *ProjectsListCall) PageSize(pageSize int64) *ProjectsListCall {
  6543. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6544. return c
  6545. }
  6546. // PageToken sets the optional parameter "pageToken": A pagination token
  6547. // returned from a previous call to ListProjects
  6548. // that indicates from where listing should continue.
  6549. func (c *ProjectsListCall) PageToken(pageToken string) *ProjectsListCall {
  6550. c.urlParams_.Set("pageToken", pageToken)
  6551. return c
  6552. }
  6553. // Fields allows partial responses to be retrieved. See
  6554. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6555. // for more information.
  6556. func (c *ProjectsListCall) Fields(s ...googleapi.Field) *ProjectsListCall {
  6557. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6558. return c
  6559. }
  6560. // IfNoneMatch sets the optional parameter which makes the operation
  6561. // fail if the object's ETag matches the given value. This is useful for
  6562. // getting updates only after the object has changed since the last
  6563. // request. Use googleapi.IsNotModified to check whether the response
  6564. // error from Do is the result of In-None-Match.
  6565. func (c *ProjectsListCall) IfNoneMatch(entityTag string) *ProjectsListCall {
  6566. c.ifNoneMatch_ = entityTag
  6567. return c
  6568. }
  6569. // Context sets the context to be used in this call's Do method. Any
  6570. // pending HTTP request will be aborted if the provided context is
  6571. // canceled.
  6572. func (c *ProjectsListCall) Context(ctx context.Context) *ProjectsListCall {
  6573. c.ctx_ = ctx
  6574. return c
  6575. }
  6576. // Header returns an http.Header that can be modified by the caller to
  6577. // add HTTP headers to the request.
  6578. func (c *ProjectsListCall) Header() http.Header {
  6579. if c.header_ == nil {
  6580. c.header_ = make(http.Header)
  6581. }
  6582. return c.header_
  6583. }
  6584. func (c *ProjectsListCall) doRequest(alt string) (*http.Response, error) {
  6585. reqHeaders := make(http.Header)
  6586. for k, v := range c.header_ {
  6587. reqHeaders[k] = v
  6588. }
  6589. reqHeaders.Set("User-Agent", c.s.userAgent())
  6590. if c.ifNoneMatch_ != "" {
  6591. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6592. }
  6593. var body io.Reader = nil
  6594. c.urlParams_.Set("alt", alt)
  6595. c.urlParams_.Set("prettyPrint", "false")
  6596. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects")
  6597. urls += "?" + c.urlParams_.Encode()
  6598. req, err := http.NewRequest("GET", urls, body)
  6599. if err != nil {
  6600. return nil, err
  6601. }
  6602. req.Header = reqHeaders
  6603. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6604. }
  6605. // Do executes the "cloudresourcemanager.projects.list" call.
  6606. // Exactly one of *ListProjectsResponse or error will be non-nil. Any
  6607. // non-2xx status code is an error. Response headers are in either
  6608. // *ListProjectsResponse.ServerResponse.Header or (if a response was
  6609. // returned at all) in error.(*googleapi.Error).Header. Use
  6610. // googleapi.IsNotModified to check whether the returned error was
  6611. // because http.StatusNotModified was returned.
  6612. func (c *ProjectsListCall) Do(opts ...googleapi.CallOption) (*ListProjectsResponse, error) {
  6613. gensupport.SetOptions(c.urlParams_, opts...)
  6614. res, err := c.doRequest("json")
  6615. if res != nil && res.StatusCode == http.StatusNotModified {
  6616. if res.Body != nil {
  6617. res.Body.Close()
  6618. }
  6619. return nil, &googleapi.Error{
  6620. Code: res.StatusCode,
  6621. Header: res.Header,
  6622. }
  6623. }
  6624. if err != nil {
  6625. return nil, err
  6626. }
  6627. defer googleapi.CloseBody(res)
  6628. if err := googleapi.CheckResponse(res); err != nil {
  6629. return nil, err
  6630. }
  6631. ret := &ListProjectsResponse{
  6632. ServerResponse: googleapi.ServerResponse{
  6633. Header: res.Header,
  6634. HTTPStatusCode: res.StatusCode,
  6635. },
  6636. }
  6637. target := &ret
  6638. if err := gensupport.DecodeResponse(target, res); err != nil {
  6639. return nil, err
  6640. }
  6641. return ret, nil
  6642. // {
  6643. // "description": "Lists Projects that are visible to the user and satisfy the\nspecified filter. This method returns Projects in an unspecified order.\nThis method is eventually consistent with project mutations; this means\nthat a newly created project may not appear in the results or recent\nupdates to an existing project may not be reflected in the results. To\nretrieve the latest state of a project, use the\nGetProject method.",
  6644. // "flatPath": "v1/projects",
  6645. // "httpMethod": "GET",
  6646. // "id": "cloudresourcemanager.projects.list",
  6647. // "parameterOrder": [],
  6648. // "parameters": {
  6649. // "filter": {
  6650. // "description": "An expression for filtering the results of the request. Filter rules are\ncase insensitive. The fields eligible for filtering are:\n\n+ `name`\n+ `id`\n+ \u003ccode\u003elabels.\u003cem\u003ekey\u003c/em\u003e\u003c/code\u003e where *key* is the name of a label\n\nSome examples of using labels as filters:\n\n|Filter|Description|\n|------|-----------|\n|name:how*|The project's name starts with \"how\".|\n|name:Howl|The project's name is `Howl` or `howl`.|\n|name:HOWL|Equivalent to above.|\n|NAME:howl|Equivalent to above.|\n|labels.color:*|The project has the label `color`.|\n|labels.color:red|The project's label `color` has the value `red`.|\n|labels.color:red\u0026nbsp;labels.size:big|The project's label `color` has the value `red` and its label `size` has the value `big`.\n\nIf you specify a filter that has both `parent.type` and `parent.id`, then\nthe `resourcemanager.projects.list` permission is checked on the parent.\nIf the user has this permission, all projects under the parent will be\nreturned after remaining filters have been applied. If the user lacks this\npermission, then all projects for which the user has the\n`resourcemanager.projects.get` permission will be returned after remaining\nfilters have been applied. If no filter is specified, the call will return\nprojects for which the user has `resourcemanager.projects.get` permissions.\n\nOptional.",
  6651. // "location": "query",
  6652. // "type": "string"
  6653. // },
  6654. // "pageSize": {
  6655. // "description": "The maximum number of Projects to return in the response.\nThe server can return fewer Projects than requested.\nIf unspecified, server picks an appropriate default.\n\nOptional.",
  6656. // "format": "int32",
  6657. // "location": "query",
  6658. // "type": "integer"
  6659. // },
  6660. // "pageToken": {
  6661. // "description": "A pagination token returned from a previous call to ListProjects\nthat indicates from where listing should continue.\n\nOptional.",
  6662. // "location": "query",
  6663. // "type": "string"
  6664. // }
  6665. // },
  6666. // "path": "v1/projects",
  6667. // "response": {
  6668. // "$ref": "ListProjectsResponse"
  6669. // },
  6670. // "scopes": [
  6671. // "https://www.googleapis.com/auth/cloud-platform",
  6672. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6673. // ]
  6674. // }
  6675. }
  6676. // Pages invokes f for each page of results.
  6677. // A non-nil error returned from f will halt the iteration.
  6678. // The provided context supersedes any context provided to the Context method.
  6679. func (c *ProjectsListCall) Pages(ctx context.Context, f func(*ListProjectsResponse) error) error {
  6680. c.ctx_ = ctx
  6681. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6682. for {
  6683. x, err := c.Do()
  6684. if err != nil {
  6685. return err
  6686. }
  6687. if err := f(x); err != nil {
  6688. return err
  6689. }
  6690. if x.NextPageToken == "" {
  6691. return nil
  6692. }
  6693. c.PageToken(x.NextPageToken)
  6694. }
  6695. }
  6696. // method id "cloudresourcemanager.projects.listAvailableOrgPolicyConstraints":
  6697. type ProjectsListAvailableOrgPolicyConstraintsCall struct {
  6698. s *Service
  6699. resource string
  6700. listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest
  6701. urlParams_ gensupport.URLParams
  6702. ctx_ context.Context
  6703. header_ http.Header
  6704. }
  6705. // ListAvailableOrgPolicyConstraints: Lists `Constraints` that could be
  6706. // applied on the specified resource.
  6707. func (r *ProjectsService) ListAvailableOrgPolicyConstraints(resource string, listavailableorgpolicyconstraintsrequest *ListAvailableOrgPolicyConstraintsRequest) *ProjectsListAvailableOrgPolicyConstraintsCall {
  6708. c := &ProjectsListAvailableOrgPolicyConstraintsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6709. c.resource = resource
  6710. c.listavailableorgpolicyconstraintsrequest = listavailableorgpolicyconstraintsrequest
  6711. return c
  6712. }
  6713. // Fields allows partial responses to be retrieved. See
  6714. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6715. // for more information.
  6716. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Fields(s ...googleapi.Field) *ProjectsListAvailableOrgPolicyConstraintsCall {
  6717. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6718. return c
  6719. }
  6720. // Context sets the context to be used in this call's Do method. Any
  6721. // pending HTTP request will be aborted if the provided context is
  6722. // canceled.
  6723. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Context(ctx context.Context) *ProjectsListAvailableOrgPolicyConstraintsCall {
  6724. c.ctx_ = ctx
  6725. return c
  6726. }
  6727. // Header returns an http.Header that can be modified by the caller to
  6728. // add HTTP headers to the request.
  6729. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Header() http.Header {
  6730. if c.header_ == nil {
  6731. c.header_ = make(http.Header)
  6732. }
  6733. return c.header_
  6734. }
  6735. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) doRequest(alt string) (*http.Response, error) {
  6736. reqHeaders := make(http.Header)
  6737. for k, v := range c.header_ {
  6738. reqHeaders[k] = v
  6739. }
  6740. reqHeaders.Set("User-Agent", c.s.userAgent())
  6741. var body io.Reader = nil
  6742. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listavailableorgpolicyconstraintsrequest)
  6743. if err != nil {
  6744. return nil, err
  6745. }
  6746. reqHeaders.Set("Content-Type", "application/json")
  6747. c.urlParams_.Set("alt", alt)
  6748. c.urlParams_.Set("prettyPrint", "false")
  6749. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listAvailableOrgPolicyConstraints")
  6750. urls += "?" + c.urlParams_.Encode()
  6751. req, err := http.NewRequest("POST", urls, body)
  6752. if err != nil {
  6753. return nil, err
  6754. }
  6755. req.Header = reqHeaders
  6756. googleapi.Expand(req.URL, map[string]string{
  6757. "resource": c.resource,
  6758. })
  6759. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6760. }
  6761. // Do executes the "cloudresourcemanager.projects.listAvailableOrgPolicyConstraints" call.
  6762. // Exactly one of *ListAvailableOrgPolicyConstraintsResponse or error
  6763. // will be non-nil. Any non-2xx status code is an error. Response
  6764. // headers are in either
  6765. // *ListAvailableOrgPolicyConstraintsResponse.ServerResponse.Header or
  6766. // (if a response was returned at all) in
  6767. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6768. // whether the returned error was because http.StatusNotModified was
  6769. // returned.
  6770. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Do(opts ...googleapi.CallOption) (*ListAvailableOrgPolicyConstraintsResponse, error) {
  6771. gensupport.SetOptions(c.urlParams_, opts...)
  6772. res, err := c.doRequest("json")
  6773. if res != nil && res.StatusCode == http.StatusNotModified {
  6774. if res.Body != nil {
  6775. res.Body.Close()
  6776. }
  6777. return nil, &googleapi.Error{
  6778. Code: res.StatusCode,
  6779. Header: res.Header,
  6780. }
  6781. }
  6782. if err != nil {
  6783. return nil, err
  6784. }
  6785. defer googleapi.CloseBody(res)
  6786. if err := googleapi.CheckResponse(res); err != nil {
  6787. return nil, err
  6788. }
  6789. ret := &ListAvailableOrgPolicyConstraintsResponse{
  6790. ServerResponse: googleapi.ServerResponse{
  6791. Header: res.Header,
  6792. HTTPStatusCode: res.StatusCode,
  6793. },
  6794. }
  6795. target := &ret
  6796. if err := gensupport.DecodeResponse(target, res); err != nil {
  6797. return nil, err
  6798. }
  6799. return ret, nil
  6800. // {
  6801. // "description": "Lists `Constraints` that could be applied on the specified resource.",
  6802. // "flatPath": "v1/projects/{projectsId}:listAvailableOrgPolicyConstraints",
  6803. // "httpMethod": "POST",
  6804. // "id": "cloudresourcemanager.projects.listAvailableOrgPolicyConstraints",
  6805. // "parameterOrder": [
  6806. // "resource"
  6807. // ],
  6808. // "parameters": {
  6809. // "resource": {
  6810. // "description": "Name of the resource to list `Constraints` for.",
  6811. // "location": "path",
  6812. // "pattern": "^projects/[^/]+$",
  6813. // "required": true,
  6814. // "type": "string"
  6815. // }
  6816. // },
  6817. // "path": "v1/{+resource}:listAvailableOrgPolicyConstraints",
  6818. // "request": {
  6819. // "$ref": "ListAvailableOrgPolicyConstraintsRequest"
  6820. // },
  6821. // "response": {
  6822. // "$ref": "ListAvailableOrgPolicyConstraintsResponse"
  6823. // },
  6824. // "scopes": [
  6825. // "https://www.googleapis.com/auth/cloud-platform",
  6826. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6827. // ]
  6828. // }
  6829. }
  6830. // Pages invokes f for each page of results.
  6831. // A non-nil error returned from f will halt the iteration.
  6832. // The provided context supersedes any context provided to the Context method.
  6833. func (c *ProjectsListAvailableOrgPolicyConstraintsCall) Pages(ctx context.Context, f func(*ListAvailableOrgPolicyConstraintsResponse) error) error {
  6834. c.ctx_ = ctx
  6835. defer func(pt string) { c.listavailableorgpolicyconstraintsrequest.PageToken = pt }(c.listavailableorgpolicyconstraintsrequest.PageToken) // reset paging to original point
  6836. for {
  6837. x, err := c.Do()
  6838. if err != nil {
  6839. return err
  6840. }
  6841. if err := f(x); err != nil {
  6842. return err
  6843. }
  6844. if x.NextPageToken == "" {
  6845. return nil
  6846. }
  6847. c.listavailableorgpolicyconstraintsrequest.PageToken = x.NextPageToken
  6848. }
  6849. }
  6850. // method id "cloudresourcemanager.projects.listOrgPolicies":
  6851. type ProjectsListOrgPoliciesCall struct {
  6852. s *Service
  6853. resource string
  6854. listorgpoliciesrequest *ListOrgPoliciesRequest
  6855. urlParams_ gensupport.URLParams
  6856. ctx_ context.Context
  6857. header_ http.Header
  6858. }
  6859. // ListOrgPolicies: Lists all the `Policies` set for a particular
  6860. // resource.
  6861. func (r *ProjectsService) ListOrgPolicies(resource string, listorgpoliciesrequest *ListOrgPoliciesRequest) *ProjectsListOrgPoliciesCall {
  6862. c := &ProjectsListOrgPoliciesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6863. c.resource = resource
  6864. c.listorgpoliciesrequest = listorgpoliciesrequest
  6865. return c
  6866. }
  6867. // Fields allows partial responses to be retrieved. See
  6868. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6869. // for more information.
  6870. func (c *ProjectsListOrgPoliciesCall) Fields(s ...googleapi.Field) *ProjectsListOrgPoliciesCall {
  6871. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6872. return c
  6873. }
  6874. // Context sets the context to be used in this call's Do method. Any
  6875. // pending HTTP request will be aborted if the provided context is
  6876. // canceled.
  6877. func (c *ProjectsListOrgPoliciesCall) Context(ctx context.Context) *ProjectsListOrgPoliciesCall {
  6878. c.ctx_ = ctx
  6879. return c
  6880. }
  6881. // Header returns an http.Header that can be modified by the caller to
  6882. // add HTTP headers to the request.
  6883. func (c *ProjectsListOrgPoliciesCall) Header() http.Header {
  6884. if c.header_ == nil {
  6885. c.header_ = make(http.Header)
  6886. }
  6887. return c.header_
  6888. }
  6889. func (c *ProjectsListOrgPoliciesCall) doRequest(alt string) (*http.Response, error) {
  6890. reqHeaders := make(http.Header)
  6891. for k, v := range c.header_ {
  6892. reqHeaders[k] = v
  6893. }
  6894. reqHeaders.Set("User-Agent", c.s.userAgent())
  6895. var body io.Reader = nil
  6896. body, err := googleapi.WithoutDataWrapper.JSONReader(c.listorgpoliciesrequest)
  6897. if err != nil {
  6898. return nil, err
  6899. }
  6900. reqHeaders.Set("Content-Type", "application/json")
  6901. c.urlParams_.Set("alt", alt)
  6902. c.urlParams_.Set("prettyPrint", "false")
  6903. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:listOrgPolicies")
  6904. urls += "?" + c.urlParams_.Encode()
  6905. req, err := http.NewRequest("POST", urls, body)
  6906. if err != nil {
  6907. return nil, err
  6908. }
  6909. req.Header = reqHeaders
  6910. googleapi.Expand(req.URL, map[string]string{
  6911. "resource": c.resource,
  6912. })
  6913. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6914. }
  6915. // Do executes the "cloudresourcemanager.projects.listOrgPolicies" call.
  6916. // Exactly one of *ListOrgPoliciesResponse or error will be non-nil. Any
  6917. // non-2xx status code is an error. Response headers are in either
  6918. // *ListOrgPoliciesResponse.ServerResponse.Header or (if a response was
  6919. // returned at all) in error.(*googleapi.Error).Header. Use
  6920. // googleapi.IsNotModified to check whether the returned error was
  6921. // because http.StatusNotModified was returned.
  6922. func (c *ProjectsListOrgPoliciesCall) Do(opts ...googleapi.CallOption) (*ListOrgPoliciesResponse, error) {
  6923. gensupport.SetOptions(c.urlParams_, opts...)
  6924. res, err := c.doRequest("json")
  6925. if res != nil && res.StatusCode == http.StatusNotModified {
  6926. if res.Body != nil {
  6927. res.Body.Close()
  6928. }
  6929. return nil, &googleapi.Error{
  6930. Code: res.StatusCode,
  6931. Header: res.Header,
  6932. }
  6933. }
  6934. if err != nil {
  6935. return nil, err
  6936. }
  6937. defer googleapi.CloseBody(res)
  6938. if err := googleapi.CheckResponse(res); err != nil {
  6939. return nil, err
  6940. }
  6941. ret := &ListOrgPoliciesResponse{
  6942. ServerResponse: googleapi.ServerResponse{
  6943. Header: res.Header,
  6944. HTTPStatusCode: res.StatusCode,
  6945. },
  6946. }
  6947. target := &ret
  6948. if err := gensupport.DecodeResponse(target, res); err != nil {
  6949. return nil, err
  6950. }
  6951. return ret, nil
  6952. // {
  6953. // "description": "Lists all the `Policies` set for a particular resource.",
  6954. // "flatPath": "v1/projects/{projectsId}:listOrgPolicies",
  6955. // "httpMethod": "POST",
  6956. // "id": "cloudresourcemanager.projects.listOrgPolicies",
  6957. // "parameterOrder": [
  6958. // "resource"
  6959. // ],
  6960. // "parameters": {
  6961. // "resource": {
  6962. // "description": "Name of the resource to list Policies for.",
  6963. // "location": "path",
  6964. // "pattern": "^projects/[^/]+$",
  6965. // "required": true,
  6966. // "type": "string"
  6967. // }
  6968. // },
  6969. // "path": "v1/{+resource}:listOrgPolicies",
  6970. // "request": {
  6971. // "$ref": "ListOrgPoliciesRequest"
  6972. // },
  6973. // "response": {
  6974. // "$ref": "ListOrgPoliciesResponse"
  6975. // },
  6976. // "scopes": [
  6977. // "https://www.googleapis.com/auth/cloud-platform",
  6978. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6979. // ]
  6980. // }
  6981. }
  6982. // Pages invokes f for each page of results.
  6983. // A non-nil error returned from f will halt the iteration.
  6984. // The provided context supersedes any context provided to the Context method.
  6985. func (c *ProjectsListOrgPoliciesCall) Pages(ctx context.Context, f func(*ListOrgPoliciesResponse) error) error {
  6986. c.ctx_ = ctx
  6987. defer func(pt string) { c.listorgpoliciesrequest.PageToken = pt }(c.listorgpoliciesrequest.PageToken) // reset paging to original point
  6988. for {
  6989. x, err := c.Do()
  6990. if err != nil {
  6991. return err
  6992. }
  6993. if err := f(x); err != nil {
  6994. return err
  6995. }
  6996. if x.NextPageToken == "" {
  6997. return nil
  6998. }
  6999. c.listorgpoliciesrequest.PageToken = x.NextPageToken
  7000. }
  7001. }
  7002. // method id "cloudresourcemanager.projects.setIamPolicy":
  7003. type ProjectsSetIamPolicyCall struct {
  7004. s *Service
  7005. resource string
  7006. setiampolicyrequest *SetIamPolicyRequest
  7007. urlParams_ gensupport.URLParams
  7008. ctx_ context.Context
  7009. header_ http.Header
  7010. }
  7011. // SetIamPolicy: Sets the IAM access control policy for the specified
  7012. // Project. Overwrites
  7013. // any existing policy.
  7014. //
  7015. // The following constraints apply when using `setIamPolicy()`:
  7016. //
  7017. // + Project does not support `allUsers` and `allAuthenticatedUsers`
  7018. // as
  7019. // `members` in a `Binding` of a `Policy`.
  7020. //
  7021. // + The owner role can be granted only to `user` and
  7022. // `serviceAccount`.
  7023. //
  7024. // + Service accounts can be made owners of a project directly
  7025. // without any restrictions. However, to be added as an owner, a user
  7026. // must be
  7027. // invited via Cloud Platform console and must accept the invitation.
  7028. //
  7029. // + A user cannot be granted the owner role using `setIamPolicy()`. The
  7030. // user
  7031. // must be granted the owner role using the Cloud Platform Console and
  7032. // must
  7033. // explicitly accept the invitation.
  7034. //
  7035. // + You can only grant ownership of a project to a member by using
  7036. // the
  7037. // GCP Console. Inviting a member will deliver an invitation email
  7038. // that
  7039. // they must accept. An invitation email is not generated if you
  7040. // are
  7041. // granting a role other than owner, or if both the member you are
  7042. // inviting
  7043. // and the project are part of your organization.
  7044. //
  7045. // + Membership changes that leave the project without any owners that
  7046. // have
  7047. // accepted the Terms of Service (ToS) will be rejected.
  7048. //
  7049. // + If the project is not part of an organization, there must be at
  7050. // least
  7051. // one owner who has accepted the Terms of Service (ToS) agreement in
  7052. // the
  7053. // policy. Calling `setIamPolicy()` to remove the last ToS-accepted
  7054. // owner
  7055. // from the policy will fail. This restriction also applies to
  7056. // legacy
  7057. // projects that no longer have owners who have accepted the ToS. Edits
  7058. // to
  7059. // IAM policies will be rejected until the lack of a ToS-accepting owner
  7060. // is
  7061. // rectified.
  7062. //
  7063. // + This method will replace the existing policy, and cannot be used
  7064. // to
  7065. // append additional IAM settings.
  7066. //
  7067. // Note: Removing service accounts from policies or changing their
  7068. // roles
  7069. // can render services completely inoperable. It is important to
  7070. // understand
  7071. // how the service account is being used before removing or updating
  7072. // its
  7073. // roles.
  7074. //
  7075. // Authorization requires the Google IAM
  7076. // permission
  7077. // `resourcemanager.projects.setIamPolicy` on the project
  7078. func (r *ProjectsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSetIamPolicyCall {
  7079. c := &ProjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7080. c.resource = resource
  7081. c.setiampolicyrequest = setiampolicyrequest
  7082. return c
  7083. }
  7084. // Fields allows partial responses to be retrieved. See
  7085. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7086. // for more information.
  7087. func (c *ProjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetIamPolicyCall {
  7088. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7089. return c
  7090. }
  7091. // Context sets the context to be used in this call's Do method. Any
  7092. // pending HTTP request will be aborted if the provided context is
  7093. // canceled.
  7094. func (c *ProjectsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSetIamPolicyCall {
  7095. c.ctx_ = ctx
  7096. return c
  7097. }
  7098. // Header returns an http.Header that can be modified by the caller to
  7099. // add HTTP headers to the request.
  7100. func (c *ProjectsSetIamPolicyCall) Header() http.Header {
  7101. if c.header_ == nil {
  7102. c.header_ = make(http.Header)
  7103. }
  7104. return c.header_
  7105. }
  7106. func (c *ProjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  7107. reqHeaders := make(http.Header)
  7108. for k, v := range c.header_ {
  7109. reqHeaders[k] = v
  7110. }
  7111. reqHeaders.Set("User-Agent", c.s.userAgent())
  7112. var body io.Reader = nil
  7113. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  7114. if err != nil {
  7115. return nil, err
  7116. }
  7117. reqHeaders.Set("Content-Type", "application/json")
  7118. c.urlParams_.Set("alt", alt)
  7119. c.urlParams_.Set("prettyPrint", "false")
  7120. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{resource}:setIamPolicy")
  7121. urls += "?" + c.urlParams_.Encode()
  7122. req, err := http.NewRequest("POST", urls, body)
  7123. if err != nil {
  7124. return nil, err
  7125. }
  7126. req.Header = reqHeaders
  7127. googleapi.Expand(req.URL, map[string]string{
  7128. "resource": c.resource,
  7129. })
  7130. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7131. }
  7132. // Do executes the "cloudresourcemanager.projects.setIamPolicy" call.
  7133. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  7134. // code is an error. Response headers are in either
  7135. // *Policy.ServerResponse.Header or (if a response was returned at all)
  7136. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7137. // check whether the returned error was because http.StatusNotModified
  7138. // was returned.
  7139. func (c *ProjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  7140. gensupport.SetOptions(c.urlParams_, opts...)
  7141. res, err := c.doRequest("json")
  7142. if res != nil && res.StatusCode == http.StatusNotModified {
  7143. if res.Body != nil {
  7144. res.Body.Close()
  7145. }
  7146. return nil, &googleapi.Error{
  7147. Code: res.StatusCode,
  7148. Header: res.Header,
  7149. }
  7150. }
  7151. if err != nil {
  7152. return nil, err
  7153. }
  7154. defer googleapi.CloseBody(res)
  7155. if err := googleapi.CheckResponse(res); err != nil {
  7156. return nil, err
  7157. }
  7158. ret := &Policy{
  7159. ServerResponse: googleapi.ServerResponse{
  7160. Header: res.Header,
  7161. HTTPStatusCode: res.StatusCode,
  7162. },
  7163. }
  7164. target := &ret
  7165. if err := gensupport.DecodeResponse(target, res); err != nil {
  7166. return nil, err
  7167. }
  7168. return ret, nil
  7169. // {
  7170. // "description": "Sets the IAM access control policy for the specified Project. Overwrites\nany existing policy.\n\nThe following constraints apply when using `setIamPolicy()`:\n\n+ Project does not support `allUsers` and `allAuthenticatedUsers` as\n`members` in a `Binding` of a `Policy`.\n\n+ The owner role can be granted only to `user` and `serviceAccount`.\n\n+ Service accounts can be made owners of a project directly\nwithout any restrictions. However, to be added as an owner, a user must be\ninvited via Cloud Platform console and must accept the invitation.\n\n+ A user cannot be granted the owner role using `setIamPolicy()`. The user\nmust be granted the owner role using the Cloud Platform Console and must\nexplicitly accept the invitation.\n\n+ You can only grant ownership of a project to a member by using the\nGCP Console. Inviting a member will deliver an invitation email that\nthey must accept. An invitation email is not generated if you are\ngranting a role other than owner, or if both the member you are inviting\nand the project are part of your organization.\n\n+ Membership changes that leave the project without any owners that have\naccepted the Terms of Service (ToS) will be rejected.\n\n+ If the project is not part of an organization, there must be at least\none owner who has accepted the Terms of Service (ToS) agreement in the\npolicy. Calling `setIamPolicy()` to remove the last ToS-accepted owner\nfrom the policy will fail. This restriction also applies to legacy\nprojects that no longer have owners who have accepted the ToS. Edits to\nIAM policies will be rejected until the lack of a ToS-accepting owner is\nrectified.\n\n+ This method will replace the existing policy, and cannot be used to\nappend additional IAM settings.\n\nNote: Removing service accounts from policies or changing their roles\ncan render services completely inoperable. It is important to understand\nhow the service account is being used before removing or updating its\nroles.\n\nAuthorization requires the Google IAM permission\n`resourcemanager.projects.setIamPolicy` on the project",
  7171. // "flatPath": "v1/projects/{resource}:setIamPolicy",
  7172. // "httpMethod": "POST",
  7173. // "id": "cloudresourcemanager.projects.setIamPolicy",
  7174. // "parameterOrder": [
  7175. // "resource"
  7176. // ],
  7177. // "parameters": {
  7178. // "resource": {
  7179. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  7180. // "location": "path",
  7181. // "required": true,
  7182. // "type": "string"
  7183. // }
  7184. // },
  7185. // "path": "v1/projects/{resource}:setIamPolicy",
  7186. // "request": {
  7187. // "$ref": "SetIamPolicyRequest"
  7188. // },
  7189. // "response": {
  7190. // "$ref": "Policy"
  7191. // },
  7192. // "scopes": [
  7193. // "https://www.googleapis.com/auth/cloud-platform"
  7194. // ]
  7195. // }
  7196. }
  7197. // method id "cloudresourcemanager.projects.setOrgPolicy":
  7198. type ProjectsSetOrgPolicyCall struct {
  7199. s *Service
  7200. resource string
  7201. setorgpolicyrequest *SetOrgPolicyRequest
  7202. urlParams_ gensupport.URLParams
  7203. ctx_ context.Context
  7204. header_ http.Header
  7205. }
  7206. // SetOrgPolicy: Updates the specified `Policy` on the resource. Creates
  7207. // a new `Policy` for
  7208. // that `Constraint` on the resource if one does not exist.
  7209. //
  7210. // Not supplying an `etag` on the request `Policy` results in an
  7211. // unconditional
  7212. // write of the `Policy`.
  7213. func (r *ProjectsService) SetOrgPolicy(resource string, setorgpolicyrequest *SetOrgPolicyRequest) *ProjectsSetOrgPolicyCall {
  7214. c := &ProjectsSetOrgPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7215. c.resource = resource
  7216. c.setorgpolicyrequest = setorgpolicyrequest
  7217. return c
  7218. }
  7219. // Fields allows partial responses to be retrieved. See
  7220. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7221. // for more information.
  7222. func (c *ProjectsSetOrgPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetOrgPolicyCall {
  7223. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7224. return c
  7225. }
  7226. // Context sets the context to be used in this call's Do method. Any
  7227. // pending HTTP request will be aborted if the provided context is
  7228. // canceled.
  7229. func (c *ProjectsSetOrgPolicyCall) Context(ctx context.Context) *ProjectsSetOrgPolicyCall {
  7230. c.ctx_ = ctx
  7231. return c
  7232. }
  7233. // Header returns an http.Header that can be modified by the caller to
  7234. // add HTTP headers to the request.
  7235. func (c *ProjectsSetOrgPolicyCall) Header() http.Header {
  7236. if c.header_ == nil {
  7237. c.header_ = make(http.Header)
  7238. }
  7239. return c.header_
  7240. }
  7241. func (c *ProjectsSetOrgPolicyCall) doRequest(alt string) (*http.Response, error) {
  7242. reqHeaders := make(http.Header)
  7243. for k, v := range c.header_ {
  7244. reqHeaders[k] = v
  7245. }
  7246. reqHeaders.Set("User-Agent", c.s.userAgent())
  7247. var body io.Reader = nil
  7248. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setorgpolicyrequest)
  7249. if err != nil {
  7250. return nil, err
  7251. }
  7252. reqHeaders.Set("Content-Type", "application/json")
  7253. c.urlParams_.Set("alt", alt)
  7254. c.urlParams_.Set("prettyPrint", "false")
  7255. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setOrgPolicy")
  7256. urls += "?" + c.urlParams_.Encode()
  7257. req, err := http.NewRequest("POST", urls, body)
  7258. if err != nil {
  7259. return nil, err
  7260. }
  7261. req.Header = reqHeaders
  7262. googleapi.Expand(req.URL, map[string]string{
  7263. "resource": c.resource,
  7264. })
  7265. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7266. }
  7267. // Do executes the "cloudresourcemanager.projects.setOrgPolicy" call.
  7268. // Exactly one of *OrgPolicy or error will be non-nil. Any non-2xx
  7269. // status code is an error. Response headers are in either
  7270. // *OrgPolicy.ServerResponse.Header or (if a response was returned at
  7271. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7272. // to check whether the returned error was because
  7273. // http.StatusNotModified was returned.
  7274. func (c *ProjectsSetOrgPolicyCall) Do(opts ...googleapi.CallOption) (*OrgPolicy, error) {
  7275. gensupport.SetOptions(c.urlParams_, opts...)
  7276. res, err := c.doRequest("json")
  7277. if res != nil && res.StatusCode == http.StatusNotModified {
  7278. if res.Body != nil {
  7279. res.Body.Close()
  7280. }
  7281. return nil, &googleapi.Error{
  7282. Code: res.StatusCode,
  7283. Header: res.Header,
  7284. }
  7285. }
  7286. if err != nil {
  7287. return nil, err
  7288. }
  7289. defer googleapi.CloseBody(res)
  7290. if err := googleapi.CheckResponse(res); err != nil {
  7291. return nil, err
  7292. }
  7293. ret := &OrgPolicy{
  7294. ServerResponse: googleapi.ServerResponse{
  7295. Header: res.Header,
  7296. HTTPStatusCode: res.StatusCode,
  7297. },
  7298. }
  7299. target := &ret
  7300. if err := gensupport.DecodeResponse(target, res); err != nil {
  7301. return nil, err
  7302. }
  7303. return ret, nil
  7304. // {
  7305. // "description": "Updates the specified `Policy` on the resource. Creates a new `Policy` for\nthat `Constraint` on the resource if one does not exist.\n\nNot supplying an `etag` on the request `Policy` results in an unconditional\nwrite of the `Policy`.",
  7306. // "flatPath": "v1/projects/{projectsId}:setOrgPolicy",
  7307. // "httpMethod": "POST",
  7308. // "id": "cloudresourcemanager.projects.setOrgPolicy",
  7309. // "parameterOrder": [
  7310. // "resource"
  7311. // ],
  7312. // "parameters": {
  7313. // "resource": {
  7314. // "description": "Resource name of the resource to attach the `Policy`.",
  7315. // "location": "path",
  7316. // "pattern": "^projects/[^/]+$",
  7317. // "required": true,
  7318. // "type": "string"
  7319. // }
  7320. // },
  7321. // "path": "v1/{+resource}:setOrgPolicy",
  7322. // "request": {
  7323. // "$ref": "SetOrgPolicyRequest"
  7324. // },
  7325. // "response": {
  7326. // "$ref": "OrgPolicy"
  7327. // },
  7328. // "scopes": [
  7329. // "https://www.googleapis.com/auth/cloud-platform"
  7330. // ]
  7331. // }
  7332. }
  7333. // method id "cloudresourcemanager.projects.testIamPermissions":
  7334. type ProjectsTestIamPermissionsCall struct {
  7335. s *Service
  7336. resource string
  7337. testiampermissionsrequest *TestIamPermissionsRequest
  7338. urlParams_ gensupport.URLParams
  7339. ctx_ context.Context
  7340. header_ http.Header
  7341. }
  7342. // TestIamPermissions: Returns permissions that a caller has on the
  7343. // specified Project.
  7344. //
  7345. // There are no permissions required for making this API call.
  7346. func (r *ProjectsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTestIamPermissionsCall {
  7347. c := &ProjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7348. c.resource = resource
  7349. c.testiampermissionsrequest = testiampermissionsrequest
  7350. return c
  7351. }
  7352. // Fields allows partial responses to be retrieved. See
  7353. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7354. // for more information.
  7355. func (c *ProjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTestIamPermissionsCall {
  7356. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7357. return c
  7358. }
  7359. // Context sets the context to be used in this call's Do method. Any
  7360. // pending HTTP request will be aborted if the provided context is
  7361. // canceled.
  7362. func (c *ProjectsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTestIamPermissionsCall {
  7363. c.ctx_ = ctx
  7364. return c
  7365. }
  7366. // Header returns an http.Header that can be modified by the caller to
  7367. // add HTTP headers to the request.
  7368. func (c *ProjectsTestIamPermissionsCall) Header() http.Header {
  7369. if c.header_ == nil {
  7370. c.header_ = make(http.Header)
  7371. }
  7372. return c.header_
  7373. }
  7374. func (c *ProjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  7375. reqHeaders := make(http.Header)
  7376. for k, v := range c.header_ {
  7377. reqHeaders[k] = v
  7378. }
  7379. reqHeaders.Set("User-Agent", c.s.userAgent())
  7380. var body io.Reader = nil
  7381. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  7382. if err != nil {
  7383. return nil, err
  7384. }
  7385. reqHeaders.Set("Content-Type", "application/json")
  7386. c.urlParams_.Set("alt", alt)
  7387. c.urlParams_.Set("prettyPrint", "false")
  7388. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{resource}:testIamPermissions")
  7389. urls += "?" + c.urlParams_.Encode()
  7390. req, err := http.NewRequest("POST", urls, body)
  7391. if err != nil {
  7392. return nil, err
  7393. }
  7394. req.Header = reqHeaders
  7395. googleapi.Expand(req.URL, map[string]string{
  7396. "resource": c.resource,
  7397. })
  7398. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7399. }
  7400. // Do executes the "cloudresourcemanager.projects.testIamPermissions" call.
  7401. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  7402. // Any non-2xx status code is an error. Response headers are in either
  7403. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  7404. // was returned at all) in error.(*googleapi.Error).Header. Use
  7405. // googleapi.IsNotModified to check whether the returned error was
  7406. // because http.StatusNotModified was returned.
  7407. func (c *ProjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  7408. gensupport.SetOptions(c.urlParams_, opts...)
  7409. res, err := c.doRequest("json")
  7410. if res != nil && res.StatusCode == http.StatusNotModified {
  7411. if res.Body != nil {
  7412. res.Body.Close()
  7413. }
  7414. return nil, &googleapi.Error{
  7415. Code: res.StatusCode,
  7416. Header: res.Header,
  7417. }
  7418. }
  7419. if err != nil {
  7420. return nil, err
  7421. }
  7422. defer googleapi.CloseBody(res)
  7423. if err := googleapi.CheckResponse(res); err != nil {
  7424. return nil, err
  7425. }
  7426. ret := &TestIamPermissionsResponse{
  7427. ServerResponse: googleapi.ServerResponse{
  7428. Header: res.Header,
  7429. HTTPStatusCode: res.StatusCode,
  7430. },
  7431. }
  7432. target := &ret
  7433. if err := gensupport.DecodeResponse(target, res); err != nil {
  7434. return nil, err
  7435. }
  7436. return ret, nil
  7437. // {
  7438. // "description": "Returns permissions that a caller has on the specified Project.\n\nThere are no permissions required for making this API call.",
  7439. // "flatPath": "v1/projects/{resource}:testIamPermissions",
  7440. // "httpMethod": "POST",
  7441. // "id": "cloudresourcemanager.projects.testIamPermissions",
  7442. // "parameterOrder": [
  7443. // "resource"
  7444. // ],
  7445. // "parameters": {
  7446. // "resource": {
  7447. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  7448. // "location": "path",
  7449. // "required": true,
  7450. // "type": "string"
  7451. // }
  7452. // },
  7453. // "path": "v1/projects/{resource}:testIamPermissions",
  7454. // "request": {
  7455. // "$ref": "TestIamPermissionsRequest"
  7456. // },
  7457. // "response": {
  7458. // "$ref": "TestIamPermissionsResponse"
  7459. // },
  7460. // "scopes": [
  7461. // "https://www.googleapis.com/auth/cloud-platform",
  7462. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  7463. // ]
  7464. // }
  7465. }
  7466. // method id "cloudresourcemanager.projects.undelete":
  7467. type ProjectsUndeleteCall struct {
  7468. s *Service
  7469. projectId string
  7470. undeleteprojectrequest *UndeleteProjectRequest
  7471. urlParams_ gensupport.URLParams
  7472. ctx_ context.Context
  7473. header_ http.Header
  7474. }
  7475. // Undelete: Restores the Project identified by the
  7476. // specified
  7477. // `project_id` (for example, `my-project-123`).
  7478. // You can only use this method for a Project that has a lifecycle state
  7479. // of
  7480. // DELETE_REQUESTED.
  7481. // After deletion starts, the Project cannot be restored.
  7482. //
  7483. // The caller must have modify permissions for this Project.
  7484. func (r *ProjectsService) Undelete(projectId string, undeleteprojectrequest *UndeleteProjectRequest) *ProjectsUndeleteCall {
  7485. c := &ProjectsUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7486. c.projectId = projectId
  7487. c.undeleteprojectrequest = undeleteprojectrequest
  7488. return c
  7489. }
  7490. // Fields allows partial responses to be retrieved. See
  7491. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7492. // for more information.
  7493. func (c *ProjectsUndeleteCall) Fields(s ...googleapi.Field) *ProjectsUndeleteCall {
  7494. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7495. return c
  7496. }
  7497. // Context sets the context to be used in this call's Do method. Any
  7498. // pending HTTP request will be aborted if the provided context is
  7499. // canceled.
  7500. func (c *ProjectsUndeleteCall) Context(ctx context.Context) *ProjectsUndeleteCall {
  7501. c.ctx_ = ctx
  7502. return c
  7503. }
  7504. // Header returns an http.Header that can be modified by the caller to
  7505. // add HTTP headers to the request.
  7506. func (c *ProjectsUndeleteCall) Header() http.Header {
  7507. if c.header_ == nil {
  7508. c.header_ = make(http.Header)
  7509. }
  7510. return c.header_
  7511. }
  7512. func (c *ProjectsUndeleteCall) doRequest(alt string) (*http.Response, error) {
  7513. reqHeaders := make(http.Header)
  7514. for k, v := range c.header_ {
  7515. reqHeaders[k] = v
  7516. }
  7517. reqHeaders.Set("User-Agent", c.s.userAgent())
  7518. var body io.Reader = nil
  7519. body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeleteprojectrequest)
  7520. if err != nil {
  7521. return nil, err
  7522. }
  7523. reqHeaders.Set("Content-Type", "application/json")
  7524. c.urlParams_.Set("alt", alt)
  7525. c.urlParams_.Set("prettyPrint", "false")
  7526. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}:undelete")
  7527. urls += "?" + c.urlParams_.Encode()
  7528. req, err := http.NewRequest("POST", urls, body)
  7529. if err != nil {
  7530. return nil, err
  7531. }
  7532. req.Header = reqHeaders
  7533. googleapi.Expand(req.URL, map[string]string{
  7534. "projectId": c.projectId,
  7535. })
  7536. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7537. }
  7538. // Do executes the "cloudresourcemanager.projects.undelete" call.
  7539. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  7540. // code is an error. Response headers are in either
  7541. // *Empty.ServerResponse.Header or (if a response was returned at all)
  7542. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7543. // check whether the returned error was because http.StatusNotModified
  7544. // was returned.
  7545. func (c *ProjectsUndeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  7546. gensupport.SetOptions(c.urlParams_, opts...)
  7547. res, err := c.doRequest("json")
  7548. if res != nil && res.StatusCode == http.StatusNotModified {
  7549. if res.Body != nil {
  7550. res.Body.Close()
  7551. }
  7552. return nil, &googleapi.Error{
  7553. Code: res.StatusCode,
  7554. Header: res.Header,
  7555. }
  7556. }
  7557. if err != nil {
  7558. return nil, err
  7559. }
  7560. defer googleapi.CloseBody(res)
  7561. if err := googleapi.CheckResponse(res); err != nil {
  7562. return nil, err
  7563. }
  7564. ret := &Empty{
  7565. ServerResponse: googleapi.ServerResponse{
  7566. Header: res.Header,
  7567. HTTPStatusCode: res.StatusCode,
  7568. },
  7569. }
  7570. target := &ret
  7571. if err := gensupport.DecodeResponse(target, res); err != nil {
  7572. return nil, err
  7573. }
  7574. return ret, nil
  7575. // {
  7576. // "description": "Restores the Project identified by the specified\n`project_id` (for example, `my-project-123`).\nYou can only use this method for a Project that has a lifecycle state of\nDELETE_REQUESTED.\nAfter deletion starts, the Project cannot be restored.\n\nThe caller must have modify permissions for this Project.",
  7577. // "flatPath": "v1/projects/{projectId}:undelete",
  7578. // "httpMethod": "POST",
  7579. // "id": "cloudresourcemanager.projects.undelete",
  7580. // "parameterOrder": [
  7581. // "projectId"
  7582. // ],
  7583. // "parameters": {
  7584. // "projectId": {
  7585. // "description": "The project ID (for example, `foo-bar-123`).\n\nRequired.",
  7586. // "location": "path",
  7587. // "required": true,
  7588. // "type": "string"
  7589. // }
  7590. // },
  7591. // "path": "v1/projects/{projectId}:undelete",
  7592. // "request": {
  7593. // "$ref": "UndeleteProjectRequest"
  7594. // },
  7595. // "response": {
  7596. // "$ref": "Empty"
  7597. // },
  7598. // "scopes": [
  7599. // "https://www.googleapis.com/auth/cloud-platform"
  7600. // ]
  7601. // }
  7602. }
  7603. // method id "cloudresourcemanager.projects.update":
  7604. type ProjectsUpdateCall struct {
  7605. s *Service
  7606. projectId string
  7607. project *Project
  7608. urlParams_ gensupport.URLParams
  7609. ctx_ context.Context
  7610. header_ http.Header
  7611. }
  7612. // Update: Updates the attributes of the Project identified by the
  7613. // specified
  7614. // `project_id` (for example, `my-project-123`).
  7615. //
  7616. // The caller must have modify permissions for this Project.
  7617. func (r *ProjectsService) Update(projectId string, project *Project) *ProjectsUpdateCall {
  7618. c := &ProjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7619. c.projectId = projectId
  7620. c.project = project
  7621. return c
  7622. }
  7623. // Fields allows partial responses to be retrieved. See
  7624. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7625. // for more information.
  7626. func (c *ProjectsUpdateCall) Fields(s ...googleapi.Field) *ProjectsUpdateCall {
  7627. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7628. return c
  7629. }
  7630. // Context sets the context to be used in this call's Do method. Any
  7631. // pending HTTP request will be aborted if the provided context is
  7632. // canceled.
  7633. func (c *ProjectsUpdateCall) Context(ctx context.Context) *ProjectsUpdateCall {
  7634. c.ctx_ = ctx
  7635. return c
  7636. }
  7637. // Header returns an http.Header that can be modified by the caller to
  7638. // add HTTP headers to the request.
  7639. func (c *ProjectsUpdateCall) Header() http.Header {
  7640. if c.header_ == nil {
  7641. c.header_ = make(http.Header)
  7642. }
  7643. return c.header_
  7644. }
  7645. func (c *ProjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
  7646. reqHeaders := make(http.Header)
  7647. for k, v := range c.header_ {
  7648. reqHeaders[k] = v
  7649. }
  7650. reqHeaders.Set("User-Agent", c.s.userAgent())
  7651. var body io.Reader = nil
  7652. body, err := googleapi.WithoutDataWrapper.JSONReader(c.project)
  7653. if err != nil {
  7654. return nil, err
  7655. }
  7656. reqHeaders.Set("Content-Type", "application/json")
  7657. c.urlParams_.Set("alt", alt)
  7658. c.urlParams_.Set("prettyPrint", "false")
  7659. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}")
  7660. urls += "?" + c.urlParams_.Encode()
  7661. req, err := http.NewRequest("PUT", urls, body)
  7662. if err != nil {
  7663. return nil, err
  7664. }
  7665. req.Header = reqHeaders
  7666. googleapi.Expand(req.URL, map[string]string{
  7667. "projectId": c.projectId,
  7668. })
  7669. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7670. }
  7671. // Do executes the "cloudresourcemanager.projects.update" call.
  7672. // Exactly one of *Project or error will be non-nil. Any non-2xx status
  7673. // code is an error. Response headers are in either
  7674. // *Project.ServerResponse.Header or (if a response was returned at all)
  7675. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7676. // check whether the returned error was because http.StatusNotModified
  7677. // was returned.
  7678. func (c *ProjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Project, error) {
  7679. gensupport.SetOptions(c.urlParams_, opts...)
  7680. res, err := c.doRequest("json")
  7681. if res != nil && res.StatusCode == http.StatusNotModified {
  7682. if res.Body != nil {
  7683. res.Body.Close()
  7684. }
  7685. return nil, &googleapi.Error{
  7686. Code: res.StatusCode,
  7687. Header: res.Header,
  7688. }
  7689. }
  7690. if err != nil {
  7691. return nil, err
  7692. }
  7693. defer googleapi.CloseBody(res)
  7694. if err := googleapi.CheckResponse(res); err != nil {
  7695. return nil, err
  7696. }
  7697. ret := &Project{
  7698. ServerResponse: googleapi.ServerResponse{
  7699. Header: res.Header,
  7700. HTTPStatusCode: res.StatusCode,
  7701. },
  7702. }
  7703. target := &ret
  7704. if err := gensupport.DecodeResponse(target, res); err != nil {
  7705. return nil, err
  7706. }
  7707. return ret, nil
  7708. // {
  7709. // "description": "Updates the attributes of the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have modify permissions for this Project.",
  7710. // "flatPath": "v1/projects/{projectId}",
  7711. // "httpMethod": "PUT",
  7712. // "id": "cloudresourcemanager.projects.update",
  7713. // "parameterOrder": [
  7714. // "projectId"
  7715. // ],
  7716. // "parameters": {
  7717. // "projectId": {
  7718. // "description": "The project ID (for example, `my-project-123`).\n\nRequired.",
  7719. // "location": "path",
  7720. // "required": true,
  7721. // "type": "string"
  7722. // }
  7723. // },
  7724. // "path": "v1/projects/{projectId}",
  7725. // "request": {
  7726. // "$ref": "Project"
  7727. // },
  7728. // "response": {
  7729. // "$ref": "Project"
  7730. // },
  7731. // "scopes": [
  7732. // "https://www.googleapis.com/auth/cloud-platform"
  7733. // ]
  7734. // }
  7735. }